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

Add modification of the reserved logical volumes



This doesn't allow addition/removal of individual volumes, only
wholesale replace of the entire list. It can be improved later, if we
ever get generic container parameters.

The man page changes replaces some tabs with spaces (hence the
whitespace changes).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 5a3ab484
......@@ -124,6 +124,7 @@ __all__ = [
"REBOOT_TYPE_OPT",
"REMOVE_INSTANCE_OPT",
"REMOVE_UIDS_OPT",
"RESERVED_LVS_OPT",
"ROMAN_OPT",
"SECONDARY_IP_OPT",
"SELECT_OS_OPT",
......@@ -1001,6 +1002,12 @@ REMOVE_UIDS_OPT = cli_option("--remove-uids", default=None,
" ranges separated by commas, to be"
" removed from the user-id pool"))
RESERVED_LVS_OPT = cli_option("--reserved-lvs", default=None,
action="store", dest="reserved_lvs",
help=("A comma-separated list of reserved"
" logical volumes names, that will be"
" ignored by cluster verify"))
ROMAN_OPT = cli_option("--roman",
dest="roman_integers", default=False,
action="store_true",
......
......@@ -2606,6 +2606,7 @@ class LUSetClusterParams(LogicalUnit):
("nicparams", None, _TOr(_TDict, _TNone)),
("drbd_helper", None, _TOr(_TString, _TNone)),
("default_iallocator", None, _TMaybeString),
("reserved_lvs", None, _TOr(_TListOf(_TNonEmptyString), _TNone)),
]
REQ_BGL = False
......@@ -2876,6 +2877,9 @@ class LUSetClusterParams(LogicalUnit):
if self.op.default_iallocator is not None:
self.cluster.default_iallocator = self.op.default_iallocator
if self.op.reserved_lvs is not None:
self.cluster.reserved_lvs = self.op.reserved_lvs
self.cfg.Update(self.cluster, feedback_fn)
......
......@@ -312,6 +312,7 @@ class OpSetClusterParams(OpCode):
"add_uids",
"remove_uids",
"default_iallocator",
"reserved_lvs",
]
......
......@@ -540,14 +540,14 @@
</para>
<para>
The <option>-I (--default-iallocator)</option> option specifies the
default instance allocator. The instance allocator will be used for
operations like instance creation, instance and node migration, etc.
when no manual override is specified. If this option is not specified,
the default instance allocator will be blank, which means that relevant
operations will require the administrator to manually specify either an
The <option>-I (--default-iallocator)</option> option specifies the
default instance allocator. The instance allocator will be used for
operations like instance creation, instance and node migration, etc.
when no manual override is specified. If this option is not specified,
the default instance allocator will be blank, which means that relevant
operations will require the administrator to manually specify either an
instance allocator, or a set of nodes.
The default iallocator can be changed later using the
The default iallocator can be changed later using the
<command>modify</command> command.
</para>
......@@ -621,6 +621,9 @@
<sbr>
<arg choice="opt">-I <replaceable>default instance allocator</replaceable></arg>
<sbr>
<arg>--reserved-lvs=<replaceable>NAMES</replaceable></arg>
</cmdsynopsis>
<para>
......@@ -655,6 +658,26 @@
The <option>--add-uids</option> and <option>--remove-uids</option>
options can be used to modify the user-id pool by adding/removing
a list of user-ids or user-id ranges.
</para>
<para>
The option <option>--reserved-lvs</option> specifies a list
(comma-separated) of logical volume group names (regular
expressions) that will be ignored by the cluster verify
operation. This is useful if the volume group used for Ganeti
is shared with the system for other uses. Note that it's not
recommended to create and mark as ignored logical volume names
which match Ganeti's own name format (starting with UUID and
then <literal>.diskN</literal>), as this option only skips the
verification, but not the actual use of the names given.
</para>
<para>
To remove all reserved logical volumes, pass in an empty
argument to the option, as in <option>--reserved-lvs=</option>
or <option>--reserved-lvs ''</option>.
</para>
</refsect2>
<refsect2>
......
......@@ -668,7 +668,8 @@ def SetClusterParams(opts, args):
opts.maintain_node_health is not None or
opts.add_uids is not None or
opts.remove_uids is not None or
opts.default_iallocator is not None):
opts.default_iallocator is not None or
opts.reserved_lvs is not None):
ToStderr("Please give at least one of the parameters.")
return 1
......@@ -718,6 +719,12 @@ def SetClusterParams(opts, args):
if remove_uids is not None:
remove_uids = uidpool.ParseUidPool(remove_uids)
if opts.reserved_lvs is not None:
if opts.reserved_lvs == "":
opts.reserved_lvs = []
else:
opts.reserved_lvs = utils.UnescapeAndSplit(opts.reserved_lvs, sep=",")
op = opcodes.OpSetClusterParams(vg_name=vg_name,
drbd_helper=drbd_helper,
enabled_hypervisors=hvlist,
......@@ -730,7 +737,8 @@ def SetClusterParams(opts, args):
uid_pool=uid_pool,
add_uids=add_uids,
remove_uids=remove_uids,
default_iallocator=opts.default_iallocator)
default_iallocator=opts.default_iallocator,
reserved_lvs=opts.reserved_lvs)
SubmitOpCode(op, opts=opts)
return 0
......@@ -885,7 +893,7 @@ commands = {
[BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT,
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],
NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT, RESERVED_LVS_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