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'¶
-
FLOATING_IPS
= 'floating_IPs'¶
-
HOSTS
= 'hosts'¶
-
SERVERS
= 'servers'¶
-
SERVICES
= 'services'¶
-
TRANSLATORS
= [{'selector-type': 'DOT_SELECTOR', 'table-name': 'servers', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'The UUID for the server', 'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name of the server', 'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'The UUID for the host', 'fieldname': 'hostId', 'translator': {'translation-type': 'VALUE'}, 'col': 'host_id'}, {'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', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name or ID of image', 'fieldname': 'image', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function safe_id at 0x7fdb9837ede8>}, 'col': 'image_id'}, {'desc': 'Name of the flavor', 'fieldname': 'flavor', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function safe_id at 0x7fdb9837ede8>}, 'col': 'flavor_id'}, {'desc': 'The availability zone of host', 'fieldname': 'OS-EXT-AZ:availability_zone', 'translator': {'translation-type': 'VALUE'}, 'col': 'zone'}, {'desc': 'The hostname of hypervisor where the server isrunning', 'fieldname': 'OS-EXT-SRV-ATTR:hypervisor_hostname', 'translator': {'translation-type': 'VALUE'}, 'col': 'host_name'})}, {'selector-type': 'DOT_SELECTOR', 'table-name': 'flavors', 'translation-type': 'HDICT', 'field-translators': ({'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', 'translator': {'translation-type': 'VALUE'}})}, {'selector-type': 'DOT_SELECTOR', 'table-name': 'hosts', 'translation-type': 'HDICT', 'field-translators': ({'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', 'translator': {'translation-type': 'VALUE'}})}, {'selector-type': 'DOT_SELECTOR', 'table-name': 'floating_IPs', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'Fixed IP Address', 'fieldname': 'fixed_ip', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Unique ID', 'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'IP Address', 'fieldname': 'ip', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name or ID of host', 'fieldname': 'instance_id', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name of Floating IP Pool', 'fieldname': 'pool', 'translator': {'translation-type': 'VALUE'}})}, {'selector-type': 'DOT_SELECTOR', 'table-name': 'services', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'Service ID', 'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}, 'col': 'service_id'}, {'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', 'translator': {'translation-type': 'VALUE'}})}, {'selector-type': 'DOT_SELECTOR', 'table-name': 'availability_zones', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'Availability zone name', 'fieldname': 'zoneName', 'translator': {'translation-type': 'VALUE'}, 'col': 'zone'}, {'desc': 'Availability zone state', 'fieldname': 'zoneState', 'translator': {'translation-type': 'VALUE'}, 'col': 'state'})}]¶
-
availability_zones_translator
= {'selector-type': 'DOT_SELECTOR', 'table-name': 'availability_zones', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'Availability zone name', 'fieldname': 'zoneName', 'translator': {'translation-type': 'VALUE'}, 'col': 'zone'}, {'desc': 'Availability zone state', 'fieldname': 'zoneState', 'translator': {'translation-type': 'VALUE'}, 'col': 'state'})}¶
-
execute
(action, action_args)¶ Overwrite ExecutionDriver.execute().
-
flavors_translator
= {'selector-type': 'DOT_SELECTOR', 'table-name': 'flavors', 'translation-type': 'HDICT', 'field-translators': ({'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', 'translator': {'translation-type': 'VALUE'}})}¶
-
floating_ips_translator
= {'selector-type': 'DOT_SELECTOR', 'table-name': 'floating_IPs', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'Fixed IP Address', 'fieldname': 'fixed_ip', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Unique ID', 'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'IP Address', 'fieldname': 'ip', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name or ID of host', 'fieldname': 'instance_id', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name of Floating IP Pool', 'fieldname': 'pool', 'translator': {'translation-type': 'VALUE'}})}¶
-
static
get_datasource_info
()¶
-
hosts_translator
= {'selector-type': 'DOT_SELECTOR', 'table-name': 'hosts', 'translation-type': 'HDICT', 'field-translators': ({'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', 'translator': {'translation-type': 'VALUE'}})}¶
-
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
= {'selector-type': 'DOT_SELECTOR', 'table-name': 'servers', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'The UUID for the server', 'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name of the server', 'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'The UUID for the host', 'fieldname': 'hostId', 'translator': {'translation-type': 'VALUE'}, 'col': 'host_id'}, {'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', 'translator': {'translation-type': 'VALUE'}}, {'desc': 'Name or ID of image', 'fieldname': 'image', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function safe_id at 0x7fdb9837ede8>}, 'col': 'image_id'}, {'desc': 'Name of the flavor', 'fieldname': 'flavor', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function safe_id at 0x7fdb9837ede8>}, 'col': 'flavor_id'}, {'desc': 'The availability zone of host', 'fieldname': 'OS-EXT-AZ:availability_zone', 'translator': {'translation-type': 'VALUE'}, 'col': 'zone'}, {'desc': 'The hostname of hypervisor where the server isrunning', 'fieldname': 'OS-EXT-SRV-ATTR:hypervisor_hostname', 'translator': {'translation-type': 'VALUE'}, 'col': 'host_name'})}¶
-
services_translator
= {'selector-type': 'DOT_SELECTOR', 'table-name': 'services', 'translation-type': 'HDICT', 'field-translators': ({'desc': 'Service ID', 'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}, 'col': 'service_id'}, {'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', 'translator': {'translation-type': 'VALUE'}})}¶
-
value_trans
= {'translation-type': 'VALUE'}¶
-