diff options
| author | Ed Leafe <ed@leafe.com> | 2011-01-05 16:41:50 -0600 |
|---|---|---|
| committer | Ed Leafe <ed@leafe.com> | 2011-01-05 16:41:50 -0600 |
| commit | f67802d62ee530b4e81aaf108dfd3813c84550b2 (patch) | |
| tree | a549aff26986d2004acc7d410d01ed605912e911 | |
| parent | 69ca1170952826ca40c447df0417eff3be730c3d (diff) | |
| download | nova-f67802d62ee530b4e81aaf108dfd3813c84550b2.tar.gz nova-f67802d62ee530b4e81aaf108dfd3813c84550b2.tar.xz nova-f67802d62ee530b4e81aaf108dfd3813c84550b2.zip | |
intermediate work
| -rw-r--r-- | nova/api/__init__.py | 14 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 7 | ||||
| -rw-r--r-- | nova/compute/api.py | 2 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 19 |
4 files changed, 31 insertions, 11 deletions
diff --git a/nova/api/__init__.py b/nova/api/__init__.py index 26fed847b..ff936bed2 100644 --- a/nova/api/__init__.py +++ b/nova/api/__init__.py @@ -59,13 +59,23 @@ class API(wsgi.Router): mapper.connect("/", controller=self.osapi_versions, conditions=osapi_subdomain) - mapper.connect("/v1.0/{path_info:.*}", controller=openstack.API(), - conditions=osapi_subdomain) + mapper.connect("/v1.0/{path_info:.*}", controller=openstack.API()) mapper.connect("/", controller=self.ec2api_versions, conditions=ec2api_subdomain) mapper.connect("/services/{path_info:.*}", controller=ec2.API(), conditions=ec2api_subdomain) + +# mapper.connect("/", controller=self.osapi_versions, +# conditions=osapi_subdomain) +# mapper.connect("/v1.0/{path_info:.*}", controller=openstack.API(), +# conditions=osapi_subdomain) +# +# mapper.connect("/", controller=self.ec2api_versions, +# conditions=ec2api_subdomain) +# mapper.connect("/services/{path_info:.*}", controller=ec2.API(), +# conditions=ec2api_subdomain) + mrh = metadatarequesthandler.MetadataRequestHandler() for s in ['/latest', '/2009-04-04', diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index c5cbe21ef..4bdb14d04 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -152,9 +152,10 @@ class Controller(wsgi.Controller): try: ctxt = req.environ['nova.context'] - self.compute_api.update_instance(ctxt, - id, - **update_dict) + # The ID passed in is actually the internal_id of the + # instance, not the value of the id column in the DB. + instance = self.compute_api.get_instance(ctxt, id) + self.compute_api.update_instance(ctxt, instance.id, **update_dict) except exception.NotFound: return faults.Fault(exc.HTTPNotFound()) return exc.HTTPNoContent() diff --git a/nova/compute/api.py b/nova/compute/api.py index 76a571d61..1d21a4668 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -257,7 +257,7 @@ class ComputeAPI(base.Base): def get_instance(self, context, instance_id): return self.db.instance_get_by_internal_id(context, instance_id) - def _cast_compute_message(method, context, instance_id): + def _cast_compute_message(self, method, context, instance_id): """Generic handler for RPC calls.""" instance = self.get_instance(context, instance_id) host = instance['host'] diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 78f2d4704..eaf8c7dff 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -130,12 +130,18 @@ class VMOps(object): """Refactored out the common code of many methods that receive either a vm name or a vm instance, and want a vm instance in return. """ + vm = None try: - instance_name = instance_or_vm.name - vm = VMHelper.lookup(self._session, instance_name) + if instance_or_vm.startswith("OpaqueRef:"): + # Got passed an opaque ref; return it + return instance_or_vm + else: + # Must be the instance name + instance_name = instance_or_vm except AttributeError: - # A vm opaque ref was passed - vm = instance_or_vm + # Not a string; must be a vm instance + instance_name = instance_or_vm.name + vm = VMHelper.lookup(self._session, instance_name) if vm is None: raise Exception(_('Instance not present %s') % instance_name) return vm @@ -201,6 +207,9 @@ class VMOps(object): instead of the more advanced one in M2Crypto for compatibility with the agent code. """ + + logging.error("ZZZZ RESET PASS CALLED") + # Need to uniquely identify this request. transaction_id = str(uuid.uuid4()) # The simple Diffie-Hellman class is used to manage key exchange. @@ -291,7 +300,7 @@ class VMOps(object): task = self._session.call_xenapi('Async.VM.resume', vm, False, True) self._wait_with_callback(task, callback) - def get_info(self, instance_id): + def get_info(self, instance): """Return data about VM instance""" vm = self._get_vm_opaque_ref(instance) rec = self._session.get_xenapi().VM.get_record(vm) |
