From a51d60f2ba557926f982d7f6c735ed12e5deb5e9 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 5 Nov 2012 11:01:14 -0800 Subject: Move host aggregate operations to VirtAPI This patch moves the following virt driver host aggregate operations to the VirtAPI: aggregate_get_by_host() aggregate_metadata_get() aggregate_metadata_add() aggregate_metadata_delete() In the process, a bug was found in the xenapi/host.py code that raises an AggregateHostNotFound error in such a way that a KeyError is generated. This changes that behavior to raise a NotFound instead, since the former expects you to already know the aggregate_id, which we do not. This patch extends the XenAPI host_maintenance_mode test to exercise this error path, as well as the one where a host is not found within the returned aggregate. Related to bp/no-db-compute Change-Id: I006665bfb27774d2eeb713b79c188ca53f6fb00b --- nova/compute/manager.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index c7b63df27..083c10835 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -226,6 +226,22 @@ class ComputeVirtAPI(virtapi.VirtAPI): def instance_get_all_by_host(self, context, host): return self._compute.db.instance_get_all_by_host(context, host) + def aggregate_get_by_host(self, context, host, key=None): + return self._compute.db.aggregate_get_by_host(context, host, key=key) + + def aggregate_metadata_get(self, context, aggregate_id): + return self._compute.db.aggregate_metadata_get(context, aggregate_id) + + def aggregate_metadata_add(self, context, aggregate_id, metadata, + set_delete=False): + return self._compute.db.aggregate_metadata_add(context, aggregate_id, + metadata, + set_delete=set_delete) + + def aggregate_metadata_delete(self, context, aggregate_id, key): + return self._compute.db.aggregate_metadata_delete(context, + aggregate_id, key) + class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" -- cgit