LGTM, thanks
On Tue, Apr 30, 2013 at 11:38 AM, Thomas Thrainer <[email protected]>wrote: > This check is performed during gnt-cluster verify and outputs warnings > if at least two different DRBD versions are found within a node group. > In such a case, all nodes with their installed DRBD version are > displayed. > > Signed-off-by: Thomas Thrainer <[email protected]> > --- > lib/cmdlib.py | 22 ++++++++++++++++++++++ > lib/constants.py | 2 ++ > 2 files changed, 24 insertions(+) > > diff --git a/lib/cmdlib.py b/lib/cmdlib.py > index 5750b50..fd6eaaf 100644 > --- a/lib/cmdlib.py > +++ b/lib/cmdlib.py > @@ -2530,6 +2530,26 @@ class LUClusterVerifyGroup(LogicalUnit, > _VerifyErrors): > if pvminmax is not None: > (nimg.pv_min, nimg.pv_max) = pvminmax > > + def _VerifyGroupDRBDVersion(self, node_verify_infos): > + """Check cross-node DRBD version consistency. > + > + @type node_verify_infos: dict > + @param node_verify_infos: infos about nodes as returned from the > + node_verify call. > + > + """ > + node_versions = {} > + for node, ndata in node_verify_infos.items(): > + nresult = ndata.payload > + version = nresult.get(constants.NV_DRBDVERSION, "Missing DRBD > version") > + node_versions[node] = version > + > + if len(set(node_versions.values())) > 1: > + for node, version in sorted(node_versions.items()): > + msg = "DRBD version mismatch: %s" % version > + self._Error(constants.CV_ENODEDRBDHELPER, node, msg, > + code=self.ETYPE_WARNING) > + > def _VerifyGroupLVM(self, node_image, vg_name): > """Check cross-node consistency in LVM. > > @@ -3466,6 +3486,7 @@ class LUClusterVerifyGroup(LogicalUnit, > _VerifyErrors): > node_verify_param[constants.NV_PVLIST] = [vg_name] > > if drbd_helper: > + node_verify_param[constants.NV_DRBDVERSION] = None > node_verify_param[constants.NV_DRBDLIST] = None > node_verify_param[constants.NV_DRBDHELPER] = drbd_helper > > @@ -3664,6 +3685,7 @@ class LUClusterVerifyGroup(LogicalUnit, > _VerifyErrors): > _ErrorIf(not test, constants.CV_ENODEORPHANINSTANCE, > node_i.name, > "node is running unknown instance %s", inst) > > + self._VerifyGroupDRBDVersion(all_nvinfo) > self._VerifyGroupLVM(node_image, vg_name) > > for node, result in extra_lv_nvinfo.items(): > diff --git a/lib/constants.py b/lib/constants.py > index 7054615..22cfc4e 100644 > --- a/lib/constants.py > +++ b/lib/constants.py > @@ -1577,6 +1577,8 @@ CV_EINSTANCEUNSUITABLENODE = \ > "Instance running on nodes that are not suitable for it") > CV_ENODEDRBD = \ > (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file") > +CV_ENODEDRBDVERSION = \ > + (CV_TNODE, "ENODEDRBDVERSION", "DRBD version mismatch within a node > group") > CV_ENODEDRBDHELPER = \ > (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper") > CV_ENODEFILECHECK = \ > -- > 1.8.2.1 > >
