summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-06-10 22:33:52 +0000
committerGerrit Code Review <review@openstack.org>2013-06-10 22:33:52 +0000
commitf85e4ec079283f4217415b4fd6a37ced189bc49a (patch)
tree927aece8bc1fa4d8b2a07986ee09553013e2bcaa
parent2d017a228812f6cbd1ae9bbbcc5d53f1f573ab94 (diff)
parent9ad727440208614f7c7e48128e75987fda273e64 (diff)
downloadnova-f85e4ec079283f4217415b4fd6a37ced189bc49a.tar.gz
nova-f85e4ec079283f4217415b4fd6a37ced189bc49a.tar.xz
nova-f85e4ec079283f4217415b4fd6a37ced189bc49a.zip
Merge "Removed code duplication in conductor.api"
-rw-r--r--nova/conductor/api.py296
1 files changed, 4 insertions, 292 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index 33415233e..b1243b70d 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -361,11 +361,11 @@ class LocalComputeTaskAPI(object):
block_device_mapping=block_device_mapping)
-class API(object):
+class API(LocalAPI):
"""Conductor API that does updates via RPC to the ConductorManager."""
def __init__(self):
- self.conductor_rpcapi = rpcapi.ConductorAPI()
+ self._manager = rpcapi.ConductorAPI()
self.base_rpcapi = baserpc.BaseAPI(topic=CONF.conductor.topic)
def wait_until_ready(self, context, early_timeout=10, early_attempts=10):
@@ -400,296 +400,8 @@ class API(object):
def instance_update(self, context, instance_uuid, **updates):
"""Perform an instance update in the database."""
- return self.conductor_rpcapi.instance_update(context, instance_uuid,
- updates, 'conductor')
-
- def instance_destroy(self, context, instance):
- return self.conductor_rpcapi.instance_destroy(context, instance)
-
- def instance_get(self, context, instance_id):
- return self.conductor_rpcapi.instance_get(context, instance_id)
-
- def instance_get_by_uuid(self, context, instance_uuid,
- columns_to_join=None):
- return self.conductor_rpcapi.instance_get_by_uuid(context,
- instance_uuid,
- columns_to_join)
-
- def instance_get_all_by_host(self, context, host, columns_to_join=None):
- return self.conductor_rpcapi.instance_get_all_by_host(
- context, host, columns_to_join=columns_to_join)
-
- def instance_get_all_by_host_and_node(self, context, host, node):
- return self.conductor_rpcapi.instance_get_all_by_host(context,
- host, node)
-
- def instance_get_all_by_filters(self, context, filters,
- sort_key='created_at',
- sort_dir='desc',
- columns_to_join=None):
- return self.conductor_rpcapi.instance_get_all_by_filters(
- context, filters, sort_key, sort_dir, columns_to_join)
-
- def instance_get_active_by_window_joined(self, context, begin, end=None,
- project_id=None, host=None):
- return self.conductor_rpcapi.instance_get_active_by_window_joined(
- context, begin, end, project_id, host)
-
- def instance_info_cache_update(self, context, instance, values):
- return self.conductor_rpcapi.instance_info_cache_update(context,
- instance, values)
-
- def instance_info_cache_delete(self, context, instance):
- return self.conductor_rpcapi.instance_info_cache_delete(context,
- instance)
-
- def instance_type_get(self, context, instance_type_id):
- return self.conductor_rpcapi.instance_type_get(context,
- instance_type_id)
-
- def instance_fault_create(self, context, values):
- return self.conductor_rpcapi.instance_fault_create(context, values)
-
- def migration_get(self, context, migration_id):
- return self.conductor_rpcapi.migration_get(context, migration_id)
-
- def migration_get_unconfirmed_by_dest_compute(self, context,
- confirm_window,
- dest_compute):
- crpcapi = self.conductor_rpcapi
- return crpcapi.migration_get_unconfirmed_by_dest_compute(
- context, confirm_window, dest_compute)
-
- def migration_get_in_progress_by_host_and_node(self, context, host, node):
- crpcapi = self.conductor_rpcapi
- return crpcapi.migration_get_in_progress_by_host_and_node(context,
- host, node)
-
- def migration_create(self, context, instance, values):
- return self.conductor_rpcapi.migration_create(context, instance,
- values)
-
- def migration_update(self, context, migration, status):
- return self.conductor_rpcapi.migration_update(context, migration,
- status)
-
- def aggregate_host_add(self, context, aggregate, host):
- return self.conductor_rpcapi.aggregate_host_add(context, aggregate,
- host)
-
- def aggregate_host_delete(self, context, aggregate, host):
- return self.conductor_rpcapi.aggregate_host_delete(context, aggregate,
- host)
-
- def aggregate_get(self, context, aggregate_id):
- return self.conductor_rpcapi.aggregate_get(context, aggregate_id)
-
- def aggregate_get_by_host(self, context, host, key=None):
- return self.conductor_rpcapi.aggregate_get_by_host(context, host, key)
-
- def aggregate_metadata_add(self, context, aggregate, metadata,
- set_delete=False):
- return self.conductor_rpcapi.aggregate_metadata_add(context, aggregate,
- metadata,
- set_delete)
-
- def aggregate_metadata_delete(self, context, aggregate, key):
- return self.conductor_rpcapi.aggregate_metadata_delete(context,
- aggregate,
- key)
-
- def aggregate_metadata_get_by_host(self, context, host,
- key='availability_zone'):
- return self.conductor_rpcapi.aggregate_metadata_get_by_host(context,
- host,
- key)
-
- def bw_usage_get(self, context, uuid, start_period, mac):
- return self.conductor_rpcapi.bw_usage_update(context, uuid, mac,
- start_period)
-
- def bw_usage_update(self, context, uuid, mac, start_period,
- bw_in, bw_out, last_ctr_in, last_ctr_out,
- last_refreshed=None):
- return self.conductor_rpcapi.bw_usage_update(
- context, uuid, mac, start_period,
- bw_in, bw_out, last_ctr_in, last_ctr_out,
- last_refreshed)
-
- def security_group_get_by_instance(self, context, instance):
- return self.conductor_rpcapi.security_group_get_by_instance(context,
- instance)
-
- def security_group_rule_get_by_security_group(self, context, secgroup):
- return self.conductor_rpcapi.security_group_rule_get_by_security_group(
- context, secgroup)
-
- def provider_fw_rule_get_all(self, context):
- return self.conductor_rpcapi.provider_fw_rule_get_all(context)
-
- def agent_build_get_by_triple(self, context, hypervisor, os, architecture):
- return self.conductor_rpcapi.agent_build_get_by_triple(context,
- hypervisor,
- os,
- architecture)
-
- def block_device_mapping_create(self, context, values):
- return self.conductor_rpcapi.block_device_mapping_update_or_create(
- context, values, create=True)
-
- def block_device_mapping_update(self, context, bdm_id, values):
- values = dict(values)
- values['id'] = bdm_id
- return self.conductor_rpcapi.block_device_mapping_update_or_create(
- context, values, create=False)
-
- def block_device_mapping_update_or_create(self, context, values):
- return self.conductor_rpcapi.block_device_mapping_update_or_create(
- context, values)
-
- def block_device_mapping_get_all_by_instance(self, context, instance):
- return self.conductor_rpcapi.block_device_mapping_get_all_by_instance(
- context, instance)
-
- def block_device_mapping_destroy(self, context, bdms):
- return self.conductor_rpcapi.block_device_mapping_destroy(context,
- bdms=bdms)
-
- def block_device_mapping_destroy_by_instance_and_device(self, context,
- instance,
- device_name):
- return self.conductor_rpcapi.block_device_mapping_destroy(
- context, instance=instance, device_name=device_name)
-
- def block_device_mapping_destroy_by_instance_and_volume(self, context,
- instance,
- volume_id):
- return self.conductor_rpcapi.block_device_mapping_destroy(
- context, instance=instance, volume_id=volume_id)
-
- def vol_get_usage_by_time(self, context, start_time):
- return self.conductor_rpcapi.vol_get_usage_by_time(context, start_time)
-
- def vol_usage_update(self, context, vol_id, rd_req, rd_bytes, wr_req,
- wr_bytes, instance, last_refreshed=None,
- update_totals=False):
- return self.conductor_rpcapi.vol_usage_update(context, vol_id,
- rd_req, rd_bytes,
- wr_req, wr_bytes,
- instance, last_refreshed,
- update_totals)
-
- def service_get_all(self, context):
- return self.conductor_rpcapi.service_get_all_by(context)
-
- def service_get_all_by_topic(self, context, topic):
- return self.conductor_rpcapi.service_get_all_by(context, topic=topic)
-
- def service_get_all_by_host(self, context, host):
- return self.conductor_rpcapi.service_get_all_by(context, host=host)
-
- def service_get_by_host_and_topic(self, context, host, topic):
- return self.conductor_rpcapi.service_get_all_by(context, topic, host)
-
- def service_get_by_compute_host(self, context, host):
- result = self.conductor_rpcapi.service_get_all_by(context, 'compute',
- host)
- # FIXME(comstud): A major revision bump to 2.0 should return a
- # single entry, so we should just return 'result' at that point.
- return result[0]
-
- def service_get_by_args(self, context, host, binary):
- return self.conductor_rpcapi.service_get_all_by(context, host=host,
- binary=binary)
-
- def action_event_start(self, context, values):
- return self.conductor_rpcapi.action_event_start(context, values)
-
- def action_event_finish(self, context, values):
- return self.conductor_rpcapi.action_event_finish(context, values)
-
- def service_create(self, context, values):
- return self.conductor_rpcapi.service_create(context, values)
-
- def service_destroy(self, context, service_id):
- return self.conductor_rpcapi.service_destroy(context, service_id)
-
- def compute_node_create(self, context, values):
- return self.conductor_rpcapi.compute_node_create(context, values)
-
- def compute_node_update(self, context, node, values, prune_stats=False):
- return self.conductor_rpcapi.compute_node_update(context, node,
- values, prune_stats)
-
- def compute_node_delete(self, context, node):
- return self.conductor_rpcapi.compute_node_delete(context, node)
-
- def service_update(self, context, service, values):
- return self.conductor_rpcapi.service_update(context, service, values)
-
- def task_log_get(self, context, task_name, begin, end, host, state=None):
- return self.conductor_rpcapi.task_log_get(context, task_name, begin,
- end, host, state)
-
- def task_log_begin_task(self, context, task_name, begin, end, host,
- task_items=None, message=None):
- return self.conductor_rpcapi.task_log_begin_task(context, task_name,
- begin, end, host,
- task_items, message)
-
- def task_log_end_task(self, context, task_name, begin, end, host,
- errors, message=None):
- return self.conductor_rpcapi.task_log_end_task(context, task_name,
- begin, end, host,
- errors, message)
-
- def notify_usage_exists(self, context, instance, current_period=False,
- ignore_missing_network_data=True,
- system_metadata=None, extra_usage_info=None):
- return self.conductor_rpcapi.notify_usage_exists(
- context, instance, current_period, ignore_missing_network_data,
- system_metadata, extra_usage_info)
-
- def security_groups_trigger_handler(self, context, event, *args):
- return self.conductor_rpcapi.security_groups_trigger_handler(context,
- event,
- args)
-
- def security_groups_trigger_members_refresh(self, context, group_ids):
- return self.conductor_rpcapi.security_groups_trigger_members_refresh(
- context, group_ids)
-
- def network_migrate_instance_start(self, context, instance, migration):
- return self.conductor_rpcapi.network_migrate_instance_start(context,
- instance,
- migration)
-
- def network_migrate_instance_finish(self, context, instance, migration):
- return self.conductor_rpcapi.network_migrate_instance_finish(context,
- instance,
- migration)
-
- def quota_commit(self, context, reservations, project_id=None):
- return self.conductor_rpcapi.quota_commit(context, reservations,
- project_id=project_id)
-
- def quota_rollback(self, context, reservations, project_id=None):
- return self.conductor_rpcapi.quota_rollback(context, reservations,
- project_id=project_id)
-
- def get_ec2_ids(self, context, instance):
- return self.conductor_rpcapi.get_ec2_ids(context, instance)
-
- def compute_stop(self, context, instance, do_cast=True):
- return self.conductor_rpcapi.compute_stop(context, instance, do_cast)
-
- def compute_confirm_resize(self, context, instance, migration_ref):
- return self.conductor_rpcapi.compute_confirm_resize(context,
- instance,
- migration_ref)
-
- def compute_unrescue(self, context, instance):
- return self.conductor_rpcapi.compute_unrescue(context, instance)
+ return self._manager.instance_update(context, instance_uuid,
+ updates, 'conductor')
class ComputeTaskAPI(object):