From f38ea60275b7c2dd99954fff8568145421aef288 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 23 Jul 2010 19:28:29 -0400 Subject: [PATCH] Add modification of the reserved logical volumes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/cli.py | 7 +++++++ lib/cmdlib.py | 4 ++++ lib/opcodes.py | 1 + man/gnt-cluster.sgml | 37 ++++++++++++++++++++++++++++++------- scripts/gnt-cluster | 14 +++++++++++--- 5 files changed, 53 insertions(+), 10 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index 12f10b8b4..f98d54bca 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -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", diff --git a/lib/cmdlib.py b/lib/cmdlib.py index f5886a2d0..8fad4a186 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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) diff --git a/lib/opcodes.py b/lib/opcodes.py index 05c0ef423..d99d7bd98 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -312,6 +312,7 @@ class OpSetClusterParams(OpCode): "add_uids", "remove_uids", "default_iallocator", + "reserved_lvs", ] diff --git a/man/gnt-cluster.sgml b/man/gnt-cluster.sgml index c7d2764d1..02abe2d88 100644 --- a/man/gnt-cluster.sgml +++ b/man/gnt-cluster.sgml @@ -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> diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 6817842a0..d5c2c191c 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -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": ( -- GitLab