diff --git a/lib/backend.py b/lib/backend.py index 44a0b42428ea5d6ef4fe05f4aecef2a9f389e5b3..75a698da3f417782019c796ba40b429b61a5d25e 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -509,6 +509,11 @@ def VerifyNode(what, cluster_name): if constants.NV_VGLIST in what: result[constants.NV_VGLIST] = utils.ListVolumeGroups() + if constants.NV_PVLIST in what: + result[constants.NV_PVLIST] = \ + bdev.LogicalVolume.GetPVInfo(what[constants.NV_PVLIST], + filter_allocatable=False) + if constants.NV_VERSION in what: result[constants.NV_VERSION] = (constants.PROTOCOL_VERSION, constants.RELEASE_VERSION) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 7e6d879d4d05ba1c7ea35a216388cee623c0e82c..eef478206780bbf71e53f0247e38603a9cb2866f 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1127,6 +1127,20 @@ class LUVerifyCluster(LogicalUnit): _ErrorIf(test, self.ENODESETUP, node, "node setup error: %s", "; ".join(test)) + # check pv names + if vg_name is not None: + pvlist = node_result.get(constants.NV_PVLIST, None) + test = pvlist is None + _ErrorIf(test, self.ENODELVM, node, "Can't get PV list from node") + if not test: + # check that ':' is not present in PV names, since it's a + # special character for lvcreate (denotes the range of PEs to + # use on the PV) + for size, pvname, owner_vg in pvlist: + test = ":" in pvname + _ErrorIf(test, self.ENODELVM, node, "Invalid character ':' in PV" + " '%s' of VG '%s'", pvname, owner_vg) + def _VerifyInstance(self, instance, instanceconfig, node_vol_is, node_instance, n_offline): """Verify an instance. @@ -1301,6 +1315,7 @@ class LUVerifyCluster(LogicalUnit): if vg_name is not None: node_verify_param[constants.NV_VGLIST] = None node_verify_param[constants.NV_LVLIST] = vg_name + node_verify_param[constants.NV_PVLIST] = [vg_name] node_verify_param[constants.NV_DRBDLIST] = None all_nvinfo = self.rpc.call_node_verify(nodelist, node_verify_param, self.cfg.GetClusterName()) diff --git a/lib/constants.py b/lib/constants.py index 815e666a0d2d01f57ae6e7b70da134ff7dcf12c8..eeba79b550e10e8b335b05c9e7c6de7d2a43f0e3 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -515,11 +515,12 @@ NV_FILELIST = "filelist" NV_HVINFO = "hvinfo" NV_HYPERVISOR = "hypervisor" NV_INSTANCELIST = "instancelist" -NV_LVLIST = "lvlist" NV_NODELIST = "nodelist" NV_NODENETTEST = "node-net-test" NV_VERSION = "version" NV_VGLIST = "vglist" +NV_LVLIST = "lvlist" +NV_PVLIST = "pvlist" NV_DRBDLIST = "drbd-list" NV_NODESETUP = "nodesetup"