From f2777f1670c3e549171bceac08b0a81d5776e739 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Tue, 22 Nov 2011 13:47:33 -0500 Subject: Change compute API.update() to take object+params Update the nova.compute:API.update() takes an object id. Now it takes an instance object to help increase flexibility in the future. blueprint internal-uuids Change-Id: Icc37720af1656d03ea5265544815c340f4e6aff9 --- nova/api/ec2/cloud.py | 4 ++-- nova/api/openstack/v2/servers.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 4019d0089..eb4945412 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1354,8 +1354,8 @@ class CloudController(object): changes[field] = kwargs[field] if changes: instance_id = ec2utils.ec2_id_to_id(instance_id) - self.compute_api.update(context, instance_id=instance_id, - **changes) + instance = self.compute_api.get(context, instance_id) + self.compute_api.update(context, instance, **changes) return True def _get_image(self, context, ec2_id): diff --git a/nova/api/openstack/v2/servers.py b/nova/api/openstack/v2/servers.py index 1ae7f80bf..144566d33 100644 --- a/nova/api/openstack/v2/servers.py +++ b/nova/api/openstack/v2/servers.py @@ -491,12 +491,15 @@ class Controller(wsgi.Controller): body['server']['auto_disk_config']) update_dict['auto_disk_config'] = auto_disk_config + instance = self.compute_api.routing_get(ctxt, id) + try: - self.compute_api.update(ctxt, id, **update_dict) + self.compute_api.update(ctxt, instance, **update_dict) except exception.NotFound: raise exc.HTTPNotFound() - instance = self.compute_api.routing_get(ctxt, id) + instance.update(update_dict) + return self._view_builder.show(req, instance) @exception.novaclient_converter -- cgit