summaryrefslogtreecommitdiffstats
path: root/nova/conductor
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-12-11 10:30:49 -0800
committerDan Smith <danms@us.ibm.com>2012-12-12 12:54:36 -0800
commita6051acc332333030271f2e696dae234bfccabaf (patch)
treea282909c1025b6d577b18c8812eb9ce1b3c7434c /nova/conductor
parent1b3a72492c1ff1d9e596831309137c88bd08706b (diff)
downloadnova-a6051acc332333030271f2e696dae234bfccabaf.tar.gz
nova-a6051acc332333030271f2e696dae234bfccabaf.tar.xz
nova-a6051acc332333030271f2e696dae234bfccabaf.zip
Move remaining aggregate operations to conductor
This patch moves the following aggregate operations from compute to conductor: aggregate_get_by_host() aggregate_metadata_add() aggregate_metadata_delete() In order to do that, it also changes the signature of the corresponding VirtAPI methods to take the aggregate object instead of just the id, so that we don't re-introduce any db messaging behavior. I debated about using the set_delete mechanism in the metadata_add API to avoid adding a separate conductor API for delete, but decided that it wasn't worth the extra round trips, no matter how much I may wish it were. Change-Id: Ic0117879c8ce576cdc8e6c5af018bb918a15d4c0
Diffstat (limited to 'nova/conductor')
-rw-r--r--nova/conductor/api.py28
-rw-r--r--nova/conductor/manager.py18
-rw-r--r--nova/conductor/rpcapi.py20
3 files changed, 65 insertions, 1 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index b9013c4c6..7a5e0fce9 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -66,6 +66,20 @@ class LocalAPI(object):
def aggregate_host_delete(self, context, aggregate, host):
return self._manager.aggregate_host_delete(context, aggregate, host)
+ def aggregate_get_by_host(self, context, host, key=None):
+ return self._manager.aggregate_get_by_host(context, host, key)
+
+ def aggregate_metadata_add(self, context, aggregate, metadata,
+ set_delete=False):
+ return self._manager.aggregate_metadata_add(context, aggregate,
+ metadata,
+ set_delete)
+
+ def aggregate_metadata_delete(self, context, aggregate, key):
+ return self._manager.aggregate_metadata_delete(context,
+ aggregate,
+ key)
+
def bw_usage_get(self, context, uuid, start_period, mac):
return self._manager.bw_usage_update(context, uuid, mac, start_period)
@@ -114,6 +128,20 @@ class API(object):
return self.conductor_rpcapi.aggregate_host_delete(context, aggregate,
host)
+ 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 bw_usage_get(self, context, uuid, start_period, mac):
return self.conductor_rpcapi.bw_usage_update(context, uuid, mac,
start_period)
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index 796b99360..84d148792 100644
--- a/nova/conductor/manager.py
+++ b/nova/conductor/manager.py
@@ -41,7 +41,7 @@ datetime_fields = ['launched_at', 'terminated_at']
class ConductorManager(manager.SchedulerDependentManager):
"""Mission: TBD"""
- RPC_API_VERSION = '1.6'
+ RPC_API_VERSION = '1.7'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -90,6 +90,22 @@ class ConductorManager(manager.SchedulerDependentManager):
self.db.aggregate_host_delete(context.elevated(),
aggregate['id'], host)
+ def aggregate_get_by_host(self, context, host, key=None):
+ aggregates = self.db.aggregate_get_by_host(context.elevated(),
+ host, key)
+ return jsonutils.to_primitive(aggregates)
+
+ def aggregate_metadata_add(self, context, aggregate, metadata,
+ set_delete=False):
+ new_metadata = self.db.aggregate_metadata_add(context.elevated(),
+ aggregate['id'],
+ metadata, set_delete)
+ return jsonutils.to_primitive(new_metadata)
+
+ def aggregate_metadata_delete(self, context, aggregate, key):
+ self.db.aggregate_metadata_delete(context.elevated(),
+ aggregate['id'], key)
+
def bw_usage_update(self, context, uuid, mac, start_period,
bw_in=None, bw_out=None,
last_ctr_in=None, last_ctr_out=None,
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index 1f38b0ea5..04bff83c7 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -33,6 +33,8 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.4 - Added migration_get
1.5 - Added bw_usage_update
1.6 - Added get_backdoor_port()
+ 1.7 - Added aggregate_get_by_host, aggregate_metadata_add,
+ and aggregate_metadata_delete
"""
BASE_RPC_API_VERSION = '1.0'
@@ -80,6 +82,24 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
host=host)
return self.call(context, msg, version='1.3')
+ def aggregate_get_by_host(self, context, host, key=None):
+ msg = self.make_msg('aggregate_get_by_host', host=host, key=key)
+ return self.call(context, msg, version='1.7')
+
+ def aggregate_metadata_add(self, context, aggregate, metadata,
+ set_delete=False):
+ aggregate_p = jsonutils.to_primitive(aggregate)
+ msg = self.make_msg('aggregate_metadata_add', aggregate=aggregate_p,
+ metadata=metadata,
+ set_delete=set_delete)
+ return self.call(context, msg, version='1.7')
+
+ def aggregate_metadata_delete(self, context, aggregate, key):
+ aggregate_p = jsonutils.to_primitive(aggregate)
+ msg = self.make_msg('aggregate_metadata_delete', aggregate=aggregate_p,
+ key=key)
+ return self.call(context, msg, version='1.7')
+
def bw_usage_update(self, context, uuid, mac, start_period,
bw_in=None, bw_out=None,
last_ctr_in=None, last_ctr_out=None,