From efa142621f35644de7ae1aa5dc9805cf300d044b Mon Sep 17 00:00:00 2001 From: Manuel Franceschini <manuel.franceschini@gmail.com> Date: Mon, 31 Mar 2008 10:59:54 +0000 Subject: [PATCH] Skip HasValidVG when --no-lvm-storage on cluster init This patch does two things: - Remove "vg_name" from _OP_REQP due to the introduction of --no-lvm-storage. Since vg_name option has as default now None and is only set to the DEFAULT_VG if lvm_storage is enabled, this is needed - It changes LUInitCluster.CheckPrereq() to skip _HasValidVG check initializing the cluster with --no-lvm-storage. Furthermore it adds to the help message the statement of the possibility to use --no-lvm-storage if no 'xenvg' volume group is found. Reviewed-by: iustinp --- lib/cmdlib.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index fe31745bb..0bbc11a5a 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -413,7 +413,7 @@ class LUInitCluster(LogicalUnit): """ HPATH = "cluster-init" HTYPE = constants.HTYPE_CLUSTER - _OP_REQP = ["cluster_name", "hypervisor_type", "vg_name", "mac_prefix", + _OP_REQP = ["cluster_name", "hypervisor_type", "mac_prefix", "def_bridge", "master_netdev", "file_storage_dir"] REQ_CLUSTER = False @@ -472,11 +472,14 @@ class LUInitCluster(LogicalUnit): secondary_ip) self.secondary_ip = secondary_ip - # checks presence of the volume group given - vgstatus = _HasValidVG(utils.ListVolumeGroups(), self.op.vg_name) - - if vgstatus: - raise errors.OpPrereqError("Error: %s" % vgstatus) + if not hasattr(self.op, "vg_name"): + self.op.vg_name = None + # if vg_name not None, checks if volume group is valid + if self.op.vg_name: + vgstatus = _HasValidVG(utils.ListVolumeGroups(), self.op.vg_name) + if vgstatus: + raise errors.OpPrereqError("Error: %s\nspecify --no-lvm-storage if" + " you are not using lvm" % vgstatus) self.op.file_storage_dir = os.path.normpath(self.op.file_storage_dir) -- GitLab