Commit b883637f authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Support modify of prealloc_wipe_disks config value


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 1116c3b2
......@@ -125,6 +125,7 @@ __all__ = [
"OSPARAMS_OPT",
"OS_OPT",
"OS_SIZE_OPT",
"PREALLOC_WIPE_DISKS_OPT",
"PRIMARY_IP_VERSION_OPT",
"PRIORITY_OPT",
"RAPI_CERT_OPT",
......@@ -1082,6 +1083,12 @@ BLK_OS_OPT = cli_option("--blacklisted", dest="blacklisted",
type="bool", default=None, metavar=_YORNO,
help="Sets the blacklisted flag on the OS")
PREALLOC_WIPE_DISKS_OPT = cli_option("--prealloc-wipe-disks", default=None,
type="bool", metavar=_YORNO,
dest="prealloc_wipe_disks",
help=("Wipe disks prior to instance"
" creation"))
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT]
......
......@@ -2454,6 +2454,7 @@ class LUSetClusterParams(LogicalUnit):
("add_uids", None, ht.NoType),
("remove_uids", None, ht.NoType),
("maintain_node_health", None, ht.TMaybeBool),
("prealloc_wipe_disks", None, ht.TMaybeBool),
("nicparams", None, ht.TOr(ht.TDict, ht.TNone)),
("drbd_helper", None, ht.TOr(ht.TString, ht.TNone)),
("default_iallocator", None, ht.TOr(ht.TString, ht.TNone)),
......@@ -2726,6 +2727,9 @@ class LUSetClusterParams(LogicalUnit):
if self.op.maintain_node_health is not None:
self.cluster.maintain_node_health = self.op.maintain_node_health
if self.op.prealloc_wipe_disks is not None:
self.cluster.prealloc_wipe_disks = self.op.prealloc_wipe_disks
if self.op.add_uids is not None:
uidpool.AddToUidPool(self.cluster.uid_pool, self.op.add_uids)
......
......@@ -318,6 +318,7 @@ class OpSetClusterParams(OpCode):
"reserved_lvs",
"hidden_os",
"blacklisted_os",
"prealloc_wipe_disks",
]
......
......@@ -258,7 +258,7 @@
<sbr>
<arg>--primary-ip-version <replaceable>version</replaceable></arg>
<sbr>
<arg>--prealloc-wipe-disks</arg>
<arg>--prealloc-wipe-disks <group choice="req"><arg>yes</arg><arg>no</arg></group></arg>
<sbr>
<arg choice="req"><replaceable>clustername</replaceable></arg>
</cmdsynopsis>
......@@ -658,6 +658,8 @@
<sbr>
<arg>--maintain-node-health <group choice="req"><arg>yes</arg><arg>no</arg></group></arg>
<sbr>
<arg choice="opt">--prealloc-wipe-disks <group choice="req"><arg>yes</arg><arg>no</arg></group></arg>
<sbr>
<arg choice="opt">-I <replaceable>default instance allocator</replaceable></arg>
<sbr>
......@@ -676,6 +678,7 @@
<option>--backend-parameters</option>,
<option>--nic-parameters</option>,
<option>--maintain-node-health</option>,
<option>--prealloc-wipe-disks</option>,
<option>--uid-pool</option> options are described in
the <command>init</command> command.
</para>
......
......@@ -42,11 +42,6 @@ from ganeti import objects
from ganeti import uidpool
from ganeti import compat
PREALLOC_WIPE_DISKS_OPT = cli_option("--prealloc-wipe-disks", default=False,
action="store_true",
dest="prealloc_wipe_disks",
help=("Wipe disks prior to instance"
" creation"))
@UsesRPC
def InitCluster(opts, args):
......@@ -110,6 +105,9 @@ def InitCluster(opts, args):
if uid_pool is not None:
uid_pool = uidpool.ParseUidPool(uid_pool)
if opts.prealloc_wipe_disks is None:
opts.prealloc_wipe_disks = False
try:
primary_ip_version = int(opts.primary_ip_version)
except (ValueError, TypeError), err:
......@@ -716,7 +714,8 @@ def SetClusterParams(opts, args):
opts.add_uids is not None or
opts.remove_uids is not None or
opts.default_iallocator is not None or
opts.reserved_lvs is not None):
opts.reserved_lvs is not None or
opts.prealloc_wipe_disks is not None):
ToStderr("Please give at least one of the parameters.")
return 1
......@@ -785,6 +784,7 @@ def SetClusterParams(opts, args):
add_uids=add_uids,
remove_uids=remove_uids,
default_iallocator=opts.default_iallocator,
prealloc_wipe_disks=opts.prealloc_wipe_disks,
reserved_lvs=opts.reserved_lvs)
SubmitOpCode(op, opts=opts)
return 0
......@@ -945,7 +945,7 @@ commands = {
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT, DRBD_HELPER_OPT,
NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT, RESERVED_LVS_OPT,
DRY_RUN_OPT, PRIORITY_OPT],
DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT],
"[opts...]",
"Alters the parameters of the cluster"),
"renew-crypto": (
......
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