Commit c9c41373 authored by Iustin Pop's avatar Iustin Pop
Browse files

Deactivate disks: allow skipping hypervisor checks

In some cases (e.g. the hypervisor not running at all), we might want
to force disk deactivation, skipping the hypervisor checks. I believe
this is not a good thing to do all the time, so this patch adds the
force option to allow manual selection of this operation mode.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent afc3c260
......@@ -611,7 +611,8 @@ def DeactivateDisks(opts, args):
instance_name = args[0]
op = opcodes.OpInstanceDeactivateDisks(instance_name=instance_name)
op = opcodes.OpInstanceDeactivateDisks(instance_name=instance_name,
SubmitOrSend(op, opts)
return 0
......@@ -1465,8 +1466,8 @@ commands = {
"<instance>", "Activate an instance's disks"),
'deactivate-disks': (
DeactivateDisks, ARGS_ONE_INSTANCE,
"<instance>", "Deactivate an instance's disks"),
"[-f] <instance>", "Deactivate an instance's disks"),
'recreate-disks': (
......@@ -4822,7 +4822,10 @@ class LUInstanceDeactivateDisks(NoHooksLU):
instance = self.instance
_SafeShutdownInstanceDisks(self, instance)
if self.op.force:
_ShutdownInstanceDisks(self, instance)
_SafeShutdownInstanceDisks(self, instance)
def _SafeShutdownInstanceDisks(lu, instance, disks=None):
......@@ -941,7 +941,8 @@ class OpInstanceDeactivateDisks(OpCode):
"""Deactivate an instance's disks."""
OP_DSC_FIELD = "instance_name"
......@@ -1242,7 +1242,7 @@ already running.
**deactivate-disks** [--submit] {*instance*}
**deactivate-disks** [-f] [--submit] {*instance*}
De-activates the block devices of the given instance. Note that if
you run this command for an instance with a drbd disk template,
......@@ -1250,6 +1250,13 @@ while it is running, it will not be able to shutdown the block
devices on the primary node, but it will shutdown the block devices
on the secondary nodes, thus breaking the replication.
The ``-f``/``--force`` option will skip checks that the instance is
down; in case the hypervisor is confused and we can't talk to it,
normally Ganeti will refuse to deactivate the disks, but with this
option passed it will skip this check and directly try to deactivate
the disks. This can still fail due to the instance actually running or
other issues.
The ``--submit`` option is used to send the job to the master
daemon but not wait for its completion. The job ID will be shown so
that it can be examined via **gnt-job info**.
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