congress.datasources.nova_driver module

congress.datasources.nova_driver module

Schema change history date: 2019-03-07 changes:

  • Added the created_at column to the servers table.

date: 2018-10-18 changes:

  • Added the servers.addresses table for server address information.

date: 2018-03-15 changes:

  • (incompatible) Removed the hosts table for OS hosts information because access to the information has been removed from the latest Nova API and client.
  • Added the hypervisors table for hypervisor information.

date: 2017-10-01 changes:

  • Added the tags table for server tags information.
class congress.datasources.nova_driver.NovaDriver(name='', args=None)

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

ADDRESSES = 'servers.addresses'
AVAILABILITY_ZONES = 'availability_zones'
FLAVORS = 'flavors'
HYPERVISORS = 'hypervisors'
SERVERS = 'servers'
SERVICES = 'services'
TAGS = 'tags'
TRANSLATORS = [{'translation-type': 'HDICT', 'table-name': 'servers', 'selector-type': 'DOT_SELECTOR', 'field-translators': ({'fieldname': 'id', 'desc': 'The UUID for the server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'name', 'desc': 'Name of the server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'hostId', 'col': 'host_id', 'desc': 'The UUID for the host', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'status', 'desc': 'The server status', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'tenant_id', 'desc': 'The tenant ID', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'user_id', 'desc': 'The user ID of the user who owns the server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'image', 'col': 'image_id', 'desc': 'Name or ID of image', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function NovaDriver.safe_id>}}, {'fieldname': 'flavor', 'col': 'flavor_id', 'desc': 'ID of the flavor', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function NovaDriver.safe_id>}}, {'fieldname': 'OS-EXT-AZ:availability_zone', 'col': 'zone', 'desc': 'The availability zone of host', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'OS-EXT-SRV-ATTR:hypervisor_hostname', 'desc': 'The hostname of hypervisor where the server is running', 'col': 'host_name', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'created', 'col': 'created_at', 'desc': 'Time at which server is created', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'addresses', 'translator': {'translation-type': 'HDICT', 'table-name': 'servers.addresses', 'parent-key': 'id', 'parent-col-name': 'server_id', 'parent-key-desc': 'UUID of server', 'objects-extract-fn': <function NovaDriver.extract_addresses>, 'selector-type': 'DICT_SELECTOR', 'in-list': True, 'field-translators': ({'fieldname': 'network_name', 'desc': 'Name of attached network to server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'addr', 'desc': 'IP address of the server', 'col': 'address', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'version', 'desc': 'Internet Protocol Version of network', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'OS-EXT-IPS-MAC:mac_addr', 'desc': 'MAC address associated to the IP of the server', 'col': 'mac_address', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'OS-EXT-IPS:type', 'desc': 'IP address type', 'col': 'address_type', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}})}}, {'fieldname': 'tags', 'translator': {'translation-type': 'LIST', 'table-name': 'tags', 'parent-key': 'id', 'parent-col-name': 'server_id', 'parent-key-desc': 'UUID of server', 'val-col': 'tag', 'val-col-desc': 'server tag string', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}})}, {'translation-type': 'HDICT', 'table-name': 'flavors', 'selector-type': 'DOT_SELECTOR', 'field-translators': ({'fieldname': 'id', 'desc': 'ID of the flavor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'name', 'desc': 'Name of the flavor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'vcpus', 'desc': 'Number of vcpus', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'ram', 'desc': 'Memory size in MB', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'disk', 'desc': 'Disk size in GB', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'ephemeral', 'desc': 'Ephemeral space size in GB', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'rxtx_factor', 'desc': 'RX/TX factor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Float'>}})}, {'translation-type': 'HDICT', 'table-name': 'services', 'selector-type': 'DOT_SELECTOR', 'field-translators': ({'fieldname': 'id', 'col': 'service_id', 'desc': 'Service ID', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'binary', 'desc': 'Service binary', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'host', 'desc': 'Host Name', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'zone', 'desc': 'Availability Zone', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'status', 'desc': 'Status of service', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'state', 'desc': 'State of service', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'updated_at', 'desc': 'Last updated time', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'disabled_reason', 'desc': 'Disabled reason', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}})}, {'translation-type': 'HDICT', 'table-name': 'hypervisors', 'selector-type': 'DOT_SELECTOR', 'field-translators': ({'fieldname': 'hypervisor_hostname', 'desc': 'Hypervisor host', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'id', 'desc': 'hypervisori id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'state', 'desc': 'State of the hypervisor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'status', 'desc': 'Status of the hypervisor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}})}, {'translation-type': 'HDICT', 'table-name': 'availability_zones', 'selector-type': 'DOT_SELECTOR', 'field-translators': ({'fieldname': 'zoneName', 'col': 'zone', 'desc': 'Availability zone name', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'zoneState', 'col': 'state', 'desc': 'Availability zone state', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}})}]
availability_zones_translator = {'field-translators': ({'fieldname': 'zoneName', 'col': 'zone', 'desc': 'Availability zone name', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'zoneState', 'col': 'state', 'desc': 'Availability zone state', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'availability_zones', 'translation-type': 'HDICT'}
execute(action, action_args)

Overwrite ExecutionDriver.execute().

extract_addresses()
flavors_translator = {'field-translators': ({'fieldname': 'id', 'desc': 'ID of the flavor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'name', 'desc': 'Name of the flavor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'vcpus', 'desc': 'Number of vcpus', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'ram', 'desc': 'Memory size in MB', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'disk', 'desc': 'Disk size in GB', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'ephemeral', 'desc': 'Ephemeral space size in GB', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'rxtx_factor', 'desc': 'RX/TX factor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Float'>}}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'flavors', 'translation-type': 'HDICT'}
static get_datasource_info()
hypervisors_translator = {'field-translators': ({'fieldname': 'hypervisor_hostname', 'desc': 'Hypervisor host', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'id', 'desc': 'hypervisori id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'state', 'desc': 'State of the hypervisor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'status', 'desc': 'Status of the hypervisor', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'hypervisors', 'translation-type': 'HDICT'}
initialize_update_methods()
safe_id()
servers_set_meta(args)

A wrapper for servers.set_meta().

‘execute[p(x)]’ doesn’t take optional args at the moment. Therefore, this function translates the positional ARGS to optional args and call the servers.set_meta() api. :param: <list> args: expected server ID and pairs of meta data in positional args such as:

{'positional': ['server_id', 'meta1', 'value1', 'meta2', 'value2']}

Usage:

execute[nova.servers_set_meta(svr_id, meta1, val1, meta2, val2) :-
    triggering_table(id)
servers_translator = {'field-translators': ({'fieldname': 'id', 'desc': 'The UUID for the server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'name', 'desc': 'Name of the server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'hostId', 'col': 'host_id', 'desc': 'The UUID for the host', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'status', 'desc': 'The server status', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'tenant_id', 'desc': 'The tenant ID', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'user_id', 'desc': 'The user ID of the user who owns the server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'image', 'col': 'image_id', 'desc': 'Name or ID of image', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function NovaDriver.safe_id>}}, {'fieldname': 'flavor', 'col': 'flavor_id', 'desc': 'ID of the flavor', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function NovaDriver.safe_id>}}, {'fieldname': 'OS-EXT-AZ:availability_zone', 'col': 'zone', 'desc': 'The availability zone of host', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'OS-EXT-SRV-ATTR:hypervisor_hostname', 'desc': 'The hostname of hypervisor where the server is running', 'col': 'host_name', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'created', 'col': 'created_at', 'desc': 'Time at which server is created', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'addresses', 'translator': {'translation-type': 'HDICT', 'table-name': 'servers.addresses', 'parent-key': 'id', 'parent-col-name': 'server_id', 'parent-key-desc': 'UUID of server', 'objects-extract-fn': <function NovaDriver.extract_addresses>, 'selector-type': 'DICT_SELECTOR', 'in-list': True, 'field-translators': ({'fieldname': 'network_name', 'desc': 'Name of attached network to server', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'addr', 'desc': 'IP address of the server', 'col': 'address', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'version', 'desc': 'Internet Protocol Version of network', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'OS-EXT-IPS-MAC:mac_addr', 'desc': 'MAC address associated to the IP of the server', 'col': 'mac_address', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'OS-EXT-IPS:type', 'desc': 'IP address type', 'col': 'address_type', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}})}}, {'fieldname': 'tags', 'translator': {'translation-type': 'LIST', 'table-name': 'tags', 'parent-key': 'id', 'parent-col-name': 'server_id', 'parent-key-desc': 'UUID of server', 'val-col': 'tag', 'val-col-desc': 'server tag string', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'servers', 'translation-type': 'HDICT'}
services_translator = {'field-translators': ({'fieldname': 'id', 'col': 'service_id', 'desc': 'Service ID', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Int'>}}, {'fieldname': 'binary', 'desc': 'Service binary', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'host', 'desc': 'Host Name', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'zone', 'desc': 'Availability Zone', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'status', 'desc': 'Status of service', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'state', 'desc': 'State of service', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'updated_at', 'desc': 'Last updated time', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}, {'fieldname': 'disabled_reason', 'desc': 'Disabled reason', 'translator': {'translation-type': 'VALUE', 'data-type': <class 'congress.data_types.Str'>}}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'services', 'translation-type': 'HDICT'}
value_trans_bool = {'data-type': <class 'congress.data_types.Bool'>, 'translation-type': 'VALUE'}
value_trans_int = {'data-type': <class 'congress.data_types.Int'>, 'translation-type': 'VALUE'}
value_trans_str = {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.