diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 622375fdde31eb0dd4917018c2f77917c13f2d4f..1bccf4a39ec9bfe88e8d751aeb8225fa7387b84d 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3498,22 +3498,11 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): nimg.sbp[pnode].append(instance) es_flags = rpc.GetExclusiveStorageForNodeNames(self.cfg, self.my_node_names) - es_unset_nodes = [] # The value of exclusive_storage should be the same across the group, so if # it's True for at least a node, we act as if it were set for all the nodes self._exclusive_storage = compat.any(es_flags.values()) if self._exclusive_storage: node_verify_param[constants.NV_EXCLUSIVEPVS] = True - es_unset_nodes = [n for (n, es) in es_flags.items() - if not es] - - if es_unset_nodes: - self._Error(constants.CV_EGROUPMIXEDESFLAG, self.group_info.name, - "The exclusive_storage flag should be uniform in a group," - " but these nodes have it unset: %s", - utils.CommaJoin(utils.NiceSort(es_unset_nodes))) - self.LogWarning("Some checks required by exclusive storage will be" - " performed also on nodes with the flag unset") # At this point, we have the in-memory data structures complete, # except for the runtime information, which we'll gather next diff --git a/lib/config.py b/lib/config.py index eb37c710f6ca5c16834c6eacade4a7ae88f7e7b1..5a882da5e120dbdf73496a749a7e94ee3b68fd0f 100644 --- a/lib/config.py +++ b/lib/config.py @@ -745,6 +745,10 @@ class ConfigWriter: _helper("node %s" % node.name, "ndparams", cluster.FillND(node, data.nodegroups[node.group]), constants.NDS_PARAMETER_TYPES) + used_globals = constants.NDC_GLOBALS.intersection(node.ndparams) + if used_globals: + result.append("Node '%s' has some global parameters set: %s" % + (node.name, utils.CommaJoin(used_globals))) # nodegroups checks nodegroups_names = set() diff --git a/lib/constants.py b/lib/constants.py index 94c5080250a79e5c5f8d22d37ed78ae1ba9bf585..3a5634f3223a20d40f12f56e7eb6d16380b3176c 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -1455,9 +1455,6 @@ CV_ECLUSTERDANGLINGNODES = \ CV_ECLUSTERDANGLINGINST = \ (CV_TNODE, "ECLUSTERDANGLINGINST", "Some instances have a non-existing primary node") -CV_EGROUPMIXEDESFLAG = \ - (CV_TGROUP, "EGROUPMIXEDESFLAG", - "exclusive_storage flag is not uniform within the group") CV_EGROUPDIFFERENTPVSIZE = \ (CV_TGROUP, "EGROUPDIFFERENTPVSIZE", "PVs in the group have different sizes") CV_EINSTANCEBADNODE = \ diff --git a/test/py/ganeti.config_unittest.py b/test/py/ganeti.config_unittest.py index 112cdf2488337f28706888613fcc9f00125b7c80..da82fc0bd93ab5db5e792751ebd4a27a9f5645a0 100755 --- a/test/py/ganeti.config_unittest.py +++ b/test/py/ganeti.config_unittest.py @@ -74,6 +74,8 @@ class TestConfigRunner(unittest.TestCase): """Initializes the cfg object""" me = netutils.Hostname() ip = constants.IP4_ADDRESS_LOCALHOST + # master_ip must not conflict with the node ip address + master_ip = "127.0.0.2" cluster_config = objects.Cluster( serial_no=1, @@ -87,7 +89,7 @@ class TestConfigRunner(unittest.TestCase): tcpudp_port_pool=set(), enabled_hypervisors=[constants.HT_FAKE], master_node=me.name, - master_ip="127.0.0.1", + master_ip=master_ip, master_netdev=constants.DEFAULT_BRIDGE, cluster_name="cluster.local", file_storage_dir="/tmp", @@ -426,6 +428,27 @@ class TestConfigRunner(unittest.TestCase): finally: node2.group = orig_group + def testVerifyConfig(self): + cfg = self._get_object() + + errs = cfg.VerifyConfig() + self.assertFalse(errs) + + node = cfg.GetNodeInfo(cfg.GetNodeList()[0]) + key = list(constants.NDC_GLOBALS)[0] + node.ndparams[key] = constants.NDC_DEFAULTS[key] + errs = cfg.VerifyConfig() + self.assertTrue(len(errs) >= 1) + self.assertTrue(_IsErrorInList("has some global parameters set", errs)) + + del node.ndparams[key] + errs = cfg.VerifyConfig() + self.assertFalse(errs) + + +def _IsErrorInList(err_str, err_list): + return any(map(lambda e: err_str in e, err_list)) + class TestTRM(unittest.TestCase): EC_ID = 1