summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-02 16:13:15 +0000
committerGerrit Code Review <review@openstack.org>2013-05-02 16:13:15 +0000
commit8bb1cc2f82b0d1dcfb08777537584e5f574ae439 (patch)
tree432f05723868e95a3db0e6cf02cd6d7ac42006b9 /nova/compute
parent6e3997322d306bda31e02b03bfbd8c73b3367b39 (diff)
parent5ada427935a0664f6c2534163f9988fb85d7b6ca (diff)
Merge "Prevent rescuing a VM with a partially mounted volume."
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index ac52b805d..f4560bd0f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -2148,6 +2148,12 @@ class API(base.Base):
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
def rescue(self, context, instance, rescue_password=None):
"""Rescue the given instance."""
+
+ bdms = self.get_instance_bdms(context, instance)
+ for bdm in bdms:
+ if bdm['volume_id']:
+ volume = self.volume_api.get(context, bdm['volume_id'])
+ self.volume_api.check_attached(context, volume)
# TODO(ndipanov): This check can be generalized as a decorator to
# check for valid combinations of src and dests - for now check
# if it's booted from volume only