summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorAlex Meade <alex.meade@rackspace.com>2011-11-23 15:56:46 -0500
committerAlex Meade <alex.meade@rackspace.com>2011-11-23 15:56:46 -0500
commitee3a4dfd50dc5a69e5d23387fd57dbddfb21173b (patch)
treeaa2b77113c739d268449cecf8441a2099dff28bb /nova/compute
parent1670bccfa42c48e964c691e94c76359d56a73e59 (diff)
reset/inject network info in compute to use uuid
Related to blueprint internal-uuids. Change-Id: I88a3eadf0fb07b0a827039db757d00498dd1cd9c
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py7
-rw-r--r--nova/compute/manager.py28
2 files changed, 17 insertions, 18 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 60a54ae91..e7064e276 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1514,13 +1514,12 @@ class API(base.Base):
def reset_network(self, context, instance):
"""Reset networking on the instance."""
- instance_id = instance['id']
- self._cast_compute_message('reset_network', context, instance_id)
+ self._cast_compute_message('reset_network', context, instance['uuid'])
def inject_network_info(self, context, instance):
"""Inject network info for the instance."""
- instance_id = instance['id']
- self._cast_compute_message('inject_network_info', context, instance_id)
+ self._cast_compute_message('inject_network_info', context,
+ instance['uuid'])
def attach_volume(self, context, instance, volume_id, device):
"""Attach an existing volume to an existing instance."""
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 2f0b0c71c..73089e97b 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -1196,8 +1196,8 @@ class ComputeManager(manager.SchedulerDependentManager):
'compute.instance.create_ip',
notifier.INFO, usage)
- self.inject_network_info(context, instance_id)
- self.reset_network(context, instance_id)
+ self.inject_network_info(context, instance_ref['uuid'])
+ self.reset_network(context, instance_ref['uuid'])
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@@ -1214,11 +1214,11 @@ class ComputeManager(manager.SchedulerDependentManager):
'compute.instance.delete_ip',
notifier.INFO, usage)
- self.inject_network_info(context, instance_id)
- self.reset_network(context, instance_id)
+ self.inject_network_info(context, instance_ref['uuid'])
+ self.reset_network(context, instance_ref['uuid'])
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
- @checks_instance_lock
+ @checks_instance_lock_uuid
def pause_instance(self, context, instance_uuid):
"""Pause an instance on this host."""
LOG.audit(_('instance %s: pausing'), instance_uuid, context=context)
@@ -1235,7 +1235,7 @@ class ComputeManager(manager.SchedulerDependentManager):
task_state=None)
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
- @checks_instance_lock
+ @checks_instance_lock_uuid
def unpause_instance(self, context, instance_uuid):
"""Unpause a paused instance on this host."""
LOG.audit(_('instance %s: unpausing'), instance_uuid, context=context)
@@ -1333,20 +1333,20 @@ class ComputeManager(manager.SchedulerDependentManager):
instance_ref = self.db.instance_get(context, instance_id)
return instance_ref['locked']
- @checks_instance_lock
- def reset_network(self, context, instance_id):
+ @checks_instance_lock_uuid
+ def reset_network(self, context, instance_uuid):
"""Reset networking on the given instance."""
- instance = self.db.instance_get(context, instance_id)
- LOG.debug(_('instance %s: reset network'), instance_id,
+ instance = self.db.instance_get_by_uuid(context, instance_uuid)
+ LOG.debug(_('instance %s: reset network'), instance_uuid,
context=context)
self.driver.reset_network(instance)
- @checks_instance_lock
- def inject_network_info(self, context, instance_id):
+ @checks_instance_lock_uuid
+ def inject_network_info(self, context, instance_uuid):
"""Inject network info for the given instance."""
- LOG.debug(_('instance %s: inject network info'), instance_id,
+ LOG.debug(_('instance %s: inject network info'), instance_uuid,
context=context)
- instance = self.db.instance_get(context, instance_id)
+ instance = self.db.instance_get_by_uuid(context, instance_uuid)
network_info = self._get_instance_nw_info(context, instance)
LOG.debug(_("network_info to inject: |%s|"), network_info)