From 5ada427935a0664f6c2534163f9988fb85d7b6ca Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Wed, 10 Apr 2013 01:05:42 +0000 Subject: Prevent rescuing a VM with a partially mounted volume. If a VM goes into rescue mode with a partially mounted volume, the volume won't re-appear after the VM is unrescued. Fix bug 1158942 Change-Id: I1e104236c41c59e67a0f0e9ef26143c57f6e0094 --- nova/compute/api.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 3f3078d5b..6a7ca79c7 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -2143,6 +2143,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 -- cgit