diff --git a/lib/cli.py b/lib/cli.py index 12f10b8b4d5c53f18f8c7eb1634d5d292a51a025..f98d54bcaaa4a7d57820b1d385af8b193149b58d 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 f5886a2d04077c0d88063f7e9a976edf60a265c7..8fad4a1869807185e3121d9bb3ff6d9eac519a24 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 05c0ef4232f7bdcb656f9972b75860e19f6f3c59..d99d7bd981f40b62330cf09a931121676d4ecf0b 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 c7d2764d1c58341c9a38f48bcfba1e7c79d347d3..02abe2d886b469be45850aaeb1a68fcfa2769a9c 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 6817842a016cd73de141a7f568dbfef33ba07c04..d5c2c191cc7a7f6c437878db605e65191fae0b47 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": (