diff options
| author | Dan Smith <danms@us.ibm.com> | 2012-11-08 15:19:40 -0800 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-12 18:31:59 +0000 |
| commit | e77136dcd1c6d91e0f819b0c294470c6d516f893 (patch) | |
| tree | 6f02f4e50b058f83310faeb9a457512737da8ce4 | |
| parent | 6a63baadae2cb1c99b0e6e107dab9a0f454621fc (diff) | |
Move agent_build_get_by_triple to VirtAPI
This adds a method to the VirtAPI for fetching information about
the guest agents. It would be nice to avoid having to have this be
passed into the virt driver on spawn (and migrate, and resize),
but I think that asking the compute manager to guess what the virt
driver wants for each of the parameters (or grab them all) is
probably no better.
Related to bp:no-db-virt
Change-Id: I27fb4bd85e6c6bb11e01fb652b199956df88804d
| -rw-r--r-- | nova/compute/manager.py | 6 | ||||
| -rw-r--r-- | nova/virt/fake.py | 4 | ||||
| -rw-r--r-- | nova/virt/virtapi.py | 10 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 3 |
4 files changed, 21 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 1a2bf06e9..fed8b32d3 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -255,6 +255,12 @@ class ComputeVirtAPI(virtapi.VirtAPI): def provider_fw_rule_get_all(self, context): return self._compute.db.provider_fw_rule_get_all(context) + def agent_build_get_by_triple(self, context, hypervisor, os, architecture): + return self._compute.db.agent_build_get_by_triple(context, + hypervisor, + os, + architecture) + class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 3aaa24e88..49f7b548b 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -421,3 +421,7 @@ class FakeVirtAPI(virtapi.VirtAPI): def provider_fw_rule_get_all(self, context): return db.provider_fw_rule_get_all(context) + + def agent_build_get_by_triple(self, context, hypervisor, os, architecture): + return db.agent_build_get_by_triple(context, + hypervisor, os, architecture) diff --git a/nova/virt/virtapi.py b/nova/virt/virtapi.py index e00c88e61..4cf769be1 100644 --- a/nova/virt/virtapi.py +++ b/nova/virt/virtapi.py @@ -98,3 +98,13 @@ class VirtAPI(object): :param context: security context """ raise NotImplementedError() + + def agent_build_get_by_triple(self, context, hypervisor, os, architecture): + """Get information about the available agent builds for a given + hypervisor, os, and architecture + :param context: security context + :param hypervisor: agent hypervisor type + :param os: agent operating system type + :param architecture: agent architecture + """ + raise NotImplementedError() diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 232d201fc..cc0d48d22 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -32,7 +32,6 @@ from nova.compute import vm_mode from nova.compute import vm_states from nova import config from nova import context as nova_context -from nova import db from nova import exception from nova import flags from nova.openstack.common import cfg @@ -537,7 +536,7 @@ class VMOps(object): greenthread.sleep(0.5) if self.agent_enabled: - agent_build = db.agent_build_get_by_triple( + agent_build = self._virtapi.agent_build_get_by_triple( ctx, 'xen', instance['os_type'], instance['architecture']) if agent_build: LOG.info(_('Latest agent build for %(hypervisor)s/%(os)s' |
