congress.datasources.vCenter_driver module

class congress.datasources.vCenter_driver.VCenterDriver(name='', args=None, session=None)

Bases: congress.datasources.datasource_driver.PollingDataSourceDriver, congress.datasources.datasource_driver.ExecutionDriver

HOSTS = 'hosts'
HOST_DNS = 'host.DNS_IPs'
HOST_PNICS = 'host.PNICs'
HOST_VNICS = 'host.VNICs'
TRANSLATORS = [{'translation-type': 'HDICT', 'table-name': 'hosts', 'selector-type': 'DICT_SELECTOR', 'field-translators': ({'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'host.DNS_IPs', 'col': 'Host:DNS_id', 'translator': {'translation-type': 'LIST', 'table-name': 'host.DNS_IPs', 'id-col': 'Host:DNS_id', 'val-col': 'DNS_IPs', 'translator': {'translation-type': 'VALUE'}}})}, {'translation-type': 'HDICT', 'table-name': 'host.PNICs', 'selector-type': 'DICT_SELECTOR', 'field-translators': ({'fieldname': 'host_uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'device', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'mac', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'ipAddress', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'subnetMask', 'translator': {'translation-type': 'VALUE'}})}, {'translation-type': 'HDICT', 'table-name': 'host.VNICs', 'selector-type': 'DICT_SELECTOR', 'field-translators': ({'fieldname': 'host_uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'device', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'mac', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'portgroup', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'ipAddress', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'subnetMask', 'translator': {'translation-type': 'VALUE'}})}, {'translation-type': 'HDICT', 'table-name': 'vms', 'selector-type': 'DICT_SELECTOR', 'field-translators': ({'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'host_uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'pathName', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'status', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'CpuDemand', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'CpuUsage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'memorySizeMB', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'MemoryUsage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'committedStorage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'uncommittedStorage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'annotation', 'translator': {'translation-type': 'VALUE'}})}]
VMS = 'vms'
execute(action, action_args)

Overwrite ExecutionDriver.execute().

static get_datasource_info()
hosts_translator = {'field-translators': ({'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'host.DNS_IPs', 'col': 'Host:DNS_id', 'translator': {'translation-type': 'LIST', 'table-name': 'host.DNS_IPs', 'id-col': 'Host:DNS_id', 'val-col': 'DNS_IPs', 'translator': {'translation-type': 'VALUE'}}}), 'selector-type': 'DICT_SELECTOR', 'table-name': 'hosts', 'translation-type': 'HDICT'}
pnic_translator = {'field-translators': ({'fieldname': 'host_uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'device', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'mac', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'ipAddress', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'subnetMask', 'translator': {'translation-type': 'VALUE'}}), 'selector-type': 'DICT_SELECTOR', 'table-name': 'host.PNICs', 'translation-type': 'HDICT'}
update_from_datasource()

Called when it is time to pull new data from this datasource.

Pulls lists of objects from vCenter, if the data does not match the correspondig table in the driver’s raw state or has not yet been added to the state, the driver calls methods to parse this data.

value_trans = {'translation-type': 'VALUE'}
vms_translator = {'field-translators': ({'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'host_uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'pathName', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'status', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'CpuDemand', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'CpuUsage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'memorySizeMB', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'MemoryUsage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'committedStorage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'uncommittedStorage', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'annotation', 'translator': {'translation-type': 'VALUE'}}), 'selector-type': 'DICT_SELECTOR', 'table-name': 'vms', 'translation-type': 'HDICT'}
vnic_translator = {'field-translators': ({'fieldname': 'host_uuid', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'device', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'mac', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'portgroup', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'ipAddress', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'subnetMask', 'translator': {'translation-type': 'VALUE'}}), 'selector-type': 'DICT_SELECTOR', 'table-name': 'host.VNICs', 'translation-type': 'HDICT'}