diff options
| author | Brian Elliott <brian.elliott@rackspace.com> | 2013-01-18 21:11:00 +0000 |
|---|---|---|
| committer | Brian Elliott <brian.elliott@rackspace.com> | 2013-01-19 14:36:27 +0000 |
| commit | 6e3fcd5e3f166a9d0e61dcb2549ea1f331aec956 (patch) | |
| tree | 505647016526514f7458c3d60d1d4e263d40aae0 /nova/compute | |
| parent | 7d20f1fe553b0db5883e787992413e7a0ca4f099 (diff) | |
Prevent metadata updates until instance is active.
This avoids a race condition where setting metadata too early in the
build process can cause a build failure due to the VM not existing
in Xen.
bug 1100866
Change-Id: I702128799997d91d5f0c0ac189f619bfdf011988
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 22ee82bbf..a08a01242 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -2160,6 +2160,9 @@ class API(base.Base): @wrap_check_policy @check_instance_lock + @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED, + vm_states.SUSPENDED, vm_states.STOPPED], + task_state=None) def delete_instance_metadata(self, context, instance, key): """Delete the given metadata item from an instance.""" self.db.instance_metadata_delete(context, instance['uuid'], key) @@ -2171,6 +2174,9 @@ class API(base.Base): @wrap_check_policy @check_instance_lock + @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED, + vm_states.SUSPENDED, vm_states.STOPPED], + task_state=None) def update_instance_metadata(self, context, instance, metadata, delete=False): """Updates or creates instance metadata. |
