diff options
| author | Jenkins <jenkins@review.openstack.org> | 2011-11-29 21:05:56 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2011-11-29 21:05:56 +0000 |
| commit | a668c6c7fdd50758a109d7eddeb24bf17575b010 (patch) | |
| tree | d518fdd27fb6c92a7ed67de1633c8f1fb7b448ca /nova/compute | |
| parent | 80d832b39b937e41685b6ae3f6c4e06238b80d6d (diff) | |
| parent | a57bc7e99499f39e4eb31265983d75a9b09e1932 (diff) | |
Merge "Use uuids for file injection."
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 09fcbc85a..d42857d36 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 90ff71ccb..d0793d020 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() |
