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

Overwrite ExecutionDriver.execute().

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