Commit 8cd365d9 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Add HV parameter checks



The first version of zeroing requires two things: that the
self-initiated shutdown of the instance can be detected, and that the
instance boots from the first disk supplied to it. This patch checks
for these by examining the hypervisor parameters.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent 363f43eb
......@@ -32,8 +32,7 @@ from ganeti import masterd
from ganeti import utils
from ganeti.cmdlib.base import NoHooksLU, LogicalUnit
from ganeti.cmdlib.common import CheckNodeOnline, \
ExpandNodeUuidAndName
from ganeti.cmdlib.common import CheckNodeOnline, ExpandNodeUuidAndName
from ganeti.cmdlib.instance_storage import StartInstanceDisks, \
ShutdownInstanceDisks
from ganeti.cmdlib.instance_utils import GetClusterDomainSecret, \
......@@ -270,6 +269,21 @@ class LUBackupExport(LogicalUnit):
raise errors.OpPrereqError("Export not supported for instances with"
" file-based disks", errors.ECODE_INVAL)
# Check prerequisites for zeroing
if self.op.zero_free_space:
# Check that user shutdown detection has been enabled
hvparams = self.cfg.GetClusterInfo().FillHV(self.instance)
if self.instance.hypervisor == constants.HT_KVM and \
not hvparams.get(constants.HV_KVM_USER_SHUTDOWN, False):
raise errors.OpPrereqError("Instance shutdown detection must be "
"enabled for zeroing to work")
# Check that the instance is set to boot from the disk
if constants.HV_BOOT_ORDER in hvparams and \
hvparams[constants.HV_BOOT_ORDER] != constants.HT_BO_DISK:
raise errors.OpPrereqError("Booting from disk must be set for zeroing "
"to work")
def _CleanupExports(self, feedback_fn):
"""Removes exports of current instance from all other nodes.
......
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