The congress.datasources.nova_driver Module

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’
HOSTS = ‘hosts’
SERVERS = ‘servers’
SERVICES = ‘services’
TRANSLATORS = [{‘field-translators’: ({‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The UUID for the server’, ‘fieldname’: ‘id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name of the server’, ‘fieldname’: ‘name’}, {‘col’: ‘host_id’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The UUID for the host’, ‘fieldname’: ‘hostId’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The server status’, ‘fieldname’: ‘status’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The tenant ID’, ‘fieldname’: ‘tenant_id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The user ID of the user who owns the server’, ‘fieldname’: ‘user_id’}, {‘col’: ‘image_id’, ‘translator’: {‘extract-fn’: <function safe_id>, ‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name or ID of image’, ‘fieldname’: ‘image’}, {‘col’: ‘flavor_id’, ‘translator’: {‘extract-fn’: <function safe_id>, ‘translation-type’: ‘VALUE’}, ‘desc’: ‘ID of the flavor’, ‘fieldname’: ‘flavor’}, {‘col’: ‘zone’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The availability zone of host’, ‘fieldname’: ‘OS-EXT-AZ:availability_zone’}, {‘col’: ‘host_name’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The hostname of hypervisor where the server is running’, ‘fieldname’: ‘OS-EXT-SRV-ATTR:hypervisor_hostname’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘servers’}, {‘field-translators’: ({‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘ID of the flavor’, ‘fieldname’: ‘id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name of the flavor’, ‘fieldname’: ‘name’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Number of vcpus’, ‘fieldname’: ‘vcpus’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Memory size in MB’, ‘fieldname’: ‘ram’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Disk size in GB’, ‘fieldname’: ‘disk’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Ephemeral space size in GB’, ‘fieldname’: ‘ephemeral’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘RX/TX factor’, ‘fieldname’: ‘rxtx_factor’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘flavors’}, {‘field-translators’: ({‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name of host’, ‘fieldname’: ‘host_name’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Enabled service’, ‘fieldname’: ‘service’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The availability zone of host’, ‘fieldname’: ‘zone’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘hosts’}, {‘field-translators’: ({‘col’: ‘service_id’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Service ID’, ‘fieldname’: ‘id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Service binary’, ‘fieldname’: ‘binary’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Host Name’, ‘fieldname’: ‘host’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Availability Zone’, ‘fieldname’: ‘zone’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Status of service’, ‘fieldname’: ‘status’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘State of service’, ‘fieldname’: ‘state’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Last updated time’, ‘fieldname’: ‘updated_at’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Disabled reason’, ‘fieldname’: ‘disabled_reason’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘services’}, {‘field-translators’: ({‘col’: ‘zone’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Availability zone name’, ‘fieldname’: ‘zoneName’}, {‘col’: ‘state’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Availability zone state’, ‘fieldname’: ‘zoneState’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘availability_zones’}]
availability_zones_translator = {‘field-translators’: ({‘col’: ‘zone’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Availability zone name’, ‘fieldname’: ‘zoneName’}, {‘col’: ‘state’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Availability zone state’, ‘fieldname’: ‘zoneState’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘availability_zones’}
execute(action, action_args)

Overwrite ExecutionDriver.execute().

flavors_translator = {‘field-translators’: ({‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘ID of the flavor’, ‘fieldname’: ‘id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name of the flavor’, ‘fieldname’: ‘name’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Number of vcpus’, ‘fieldname’: ‘vcpus’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Memory size in MB’, ‘fieldname’: ‘ram’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Disk size in GB’, ‘fieldname’: ‘disk’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Ephemeral space size in GB’, ‘fieldname’: ‘ephemeral’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘RX/TX factor’, ‘fieldname’: ‘rxtx_factor’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘flavors’}
static get_datasource_info()
hosts_translator = {‘field-translators’: ({‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name of host’, ‘fieldname’: ‘host_name’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Enabled service’, ‘fieldname’: ‘service’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The availability zone of host’, ‘fieldname’: ‘zone’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘hosts’}
initialize_update_methods()
safe_id(x)
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’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The UUID for the server’, ‘fieldname’: ‘id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name of the server’, ‘fieldname’: ‘name’}, {‘col’: ‘host_id’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The UUID for the host’, ‘fieldname’: ‘hostId’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The server status’, ‘fieldname’: ‘status’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The tenant ID’, ‘fieldname’: ‘tenant_id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The user ID of the user who owns the server’, ‘fieldname’: ‘user_id’}, {‘col’: ‘image_id’, ‘translator’: {‘extract-fn’: <function safe_id>, ‘translation-type’: ‘VALUE’}, ‘desc’: ‘Name or ID of image’, ‘fieldname’: ‘image’}, {‘col’: ‘flavor_id’, ‘translator’: {‘extract-fn’: <function safe_id>, ‘translation-type’: ‘VALUE’}, ‘desc’: ‘ID of the flavor’, ‘fieldname’: ‘flavor’}, {‘col’: ‘zone’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The availability zone of host’, ‘fieldname’: ‘OS-EXT-AZ:availability_zone’}, {‘col’: ‘host_name’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘The hostname of hypervisor where the server is running’, ‘fieldname’: ‘OS-EXT-SRV-ATTR:hypervisor_hostname’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘servers’}
services_translator = {‘field-translators’: ({‘col’: ‘service_id’, ‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Service ID’, ‘fieldname’: ‘id’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Service binary’, ‘fieldname’: ‘binary’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Host Name’, ‘fieldname’: ‘host’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Availability Zone’, ‘fieldname’: ‘zone’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Status of service’, ‘fieldname’: ‘status’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘State of service’, ‘fieldname’: ‘state’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Last updated time’, ‘fieldname’: ‘updated_at’}, {‘translator’: {‘translation-type’: ‘VALUE’}, ‘desc’: ‘Disabled reason’, ‘fieldname’: ‘disabled_reason’}), ‘translation-type’: ‘HDICT’, ‘selector-type’: ‘DOT_SELECTOR’, ‘table-name’: ‘services’}
value_trans = {‘translation-type’: ‘VALUE’}