congress.datasources.nova_driver module

congress.datasources.nova_driver module

Schema change history

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

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

Overwrite ExecutionDriver.execute().

flavors_translator = {'field-translators': ({'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'id', 'desc': 'ID of the flavor'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'name', 'desc': 'Name of the flavor'}, {'translator': {'data-type': <class 'congress.data_types.Int'>, 'translation-type': 'VALUE'}, 'fieldname': 'vcpus', 'desc': 'Number of vcpus'}, {'translator': {'data-type': <class 'congress.data_types.Int'>, 'translation-type': 'VALUE'}, 'fieldname': 'ram', 'desc': 'Memory size in MB'}, {'translator': {'data-type': <class 'congress.data_types.Int'>, 'translation-type': 'VALUE'}, 'fieldname': 'disk', 'desc': 'Disk size in GB'}, {'translator': {'data-type': <class 'congress.data_types.Int'>, 'translation-type': 'VALUE'}, 'fieldname': 'ephemeral', 'desc': 'Ephemeral space size in GB'}, {'translator': {'data-type': <class 'congress.data_types.Float'>, 'translation-type': 'VALUE'}, 'fieldname': 'rxtx_factor', 'desc': 'RX/TX factor'}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'flavors', 'translation-type': 'HDICT'}
static get_datasource_info()
hypervisors_translator = {'field-translators': ({'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'hypervisor_hostname', 'desc': 'Hypervisor host'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id', 'desc': 'hypervisori id'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'state', 'desc': 'State of the hypervisor'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'status', 'desc': 'Status of the hypervisor'}), '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': ({'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'id', 'desc': 'The UUID for the server'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'name', 'desc': 'Name of the server'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'hostId', 'col': 'host_id', 'desc': 'The UUID for the host'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'status', 'desc': 'The server status'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'tenant_id', 'desc': 'The tenant ID'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'user_id', 'desc': 'The user ID of the user who owns the server'}, {'translator': {'extract-fn': <function safe_id at 0x7faa46414230>, 'translation-type': 'VALUE'}, 'fieldname': 'image', 'col': 'image_id', 'desc': 'Name or ID of image'}, {'translator': {'extract-fn': <function safe_id at 0x7faa46414230>, 'translation-type': 'VALUE'}, 'fieldname': 'flavor', 'col': 'flavor_id', 'desc': 'ID of the flavor'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'OS-EXT-AZ:availability_zone', 'col': 'zone', 'desc': 'The availability zone of host'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'OS-EXT-SRV-ATTR:hypervisor_hostname', 'col': 'host_name', 'desc': 'The hostname of hypervisor where the server is running'}, {'translator': {'parent-key': 'id', 'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'parent-key-desc': 'UUID of server', 'val-col-desc': 'server tag string', 'parent-col-name': 'server_id', 'table-name': 'tags', 'val-col': 'tag', 'translation-type': 'LIST'}, 'fieldname': 'tags'}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'servers', 'translation-type': 'HDICT'}
services_translator = {'field-translators': ({'translator': {'data-type': <class 'congress.data_types.Int'>, 'translation-type': 'VALUE'}, 'fieldname': 'id', 'col': 'service_id', 'desc': 'Service ID'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'binary', 'desc': 'Service binary'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'host', 'desc': 'Host Name'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'zone', 'desc': 'Availability Zone'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'status', 'desc': 'Status of service'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'state', 'desc': 'State of service'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'updated_at', 'desc': 'Last updated time'}, {'translator': {'data-type': <class 'congress.data_types.Str'>, 'translation-type': 'VALUE'}, 'fieldname': 'disabled_reason', 'desc': 'Disabled reason'}), '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.