Commit c6b71b75 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Allow replace-disks to work on offline instances

The only problem was that at the end of the operation, the check for
deactivating the disks was too strict, requiring that the instance is
DOWN. This relaxes the check to allow OFFLINE as well.
Signed-off-by: default avatarPetr Pudlak <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 3a805689
......@@ -1335,14 +1335,16 @@ def ShutdownInstanceDisks(lu, instance, disks=None, ignore_primary=False):
return all_result
def _SafeShutdownInstanceDisks(lu, instance, disks=None):
def _SafeShutdownInstanceDisks(lu, instance, disks=None, req_states=None):
"""Shutdown block devices of an instance.
This function checks if an instance is running, before calling
CheckInstanceState(lu, instance, INSTANCE_DOWN, msg="cannot shutdown disks")
if req_states is None:
req_states = INSTANCE_DOWN
CheckInstanceState(lu, instance, req_states, msg="cannot shutdown disks")
ShutdownInstanceDisks(lu, instance, disks=disks)
......@@ -2250,7 +2252,8 @@ class TLReplaceDisks(Tasklet):
# Deactivate the instance disks if we're replacing them on a
# down instance
if activate_disks:
_SafeShutdownInstanceDisks(, self.instance)
_SafeShutdownInstanceDisks(, self.instance,
assert not
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment