diff options
| author | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-11-28 16:26:36 -0500 |
|---|---|---|
| committer | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-11-29 10:14:19 -0500 |
| commit | a57bc7e99499f39e4eb31265983d75a9b09e1932 (patch) | |
| tree | d5836f361a64126d1525ef3cb42346401ffc7855 /nova/compute | |
| parent | db903a682012a9570ddbfe4ee453bbe582090b6e (diff) | |
Use uuids for file injection.
Related to blueprint internal-uuids.
Change-Id: I35f2a4c5cafde7ed8831a01cb7a2816ccbc39808
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 3 | ||||
| -rw-r--r-- | nova/compute/manager.py | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 32f329a04..a55cc142a 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1448,10 +1448,9 @@ class API(base.Base): @scheduler_api.reroute_compute("inject_file") def inject_file(self, context, instance, path, file_contents): """Write a file to the given instance.""" - instance_id = instance['id'] params = {'path': path, 'file_contents': file_contents} self._cast_compute_message('inject_file', context, - instance_id, params=params) + instance['uuid'], params=params) def get_ajax_console(self, context, instance): """Get a url to an AJAX Console.""" diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 2eed738c1..905d43968 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -903,17 +903,16 @@ class ComputeManager(manager.SchedulerDependentManager): continue @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - @checks_instance_lock - def inject_file(self, context, instance_id, path, file_contents): + @checks_instance_lock_uuid + def inject_file(self, context, instance_uuid, path, file_contents): """Write a file to the specified path in an instance on this host.""" context = context.elevated() - instance_ref = self.db.instance_get(context, instance_id) - instance_id = instance_ref['id'] + instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) instance_state = instance_ref['power_state'] expected_state = power_state.RUNNING if instance_state != expected_state: LOG.warn(_('trying to inject a file into a non-running ' - 'instance: %(instance_id)s (state: %(instance_state)s ' + 'instance: %(instance_uuid)s (state: %(instance_state)s ' 'expected: %(expected_state)s)') % locals()) nm = instance_ref['name'] msg = _('instance %(nm)s: injecting file to %(path)s') % locals() |
