Revision 3697def0

b/lib/cmdlib.py
3498 3498
        nimg.sbp[pnode].append(instance)
3499 3499

  
3500 3500
    es_flags = rpc.GetExclusiveStorageForNodeNames(self.cfg, self.my_node_names)
3501
    es_unset_nodes = []
3502 3501
    # The value of exclusive_storage should be the same across the group, so if
3503 3502
    # it's True for at least a node, we act as if it were set for all the nodes
3504 3503
    self._exclusive_storage = compat.any(es_flags.values())
3505 3504
    if self._exclusive_storage:
3506 3505
      node_verify_param[constants.NV_EXCLUSIVEPVS] = True
3507
      es_unset_nodes = [n for (n, es) in es_flags.items()
3508
                        if not es]
3509

  
3510
    if es_unset_nodes:
3511
      self._Error(constants.CV_EGROUPMIXEDESFLAG, self.group_info.name,
3512
                  "The exclusive_storage flag should be uniform in a group,"
3513
                  " but these nodes have it unset: %s",
3514
                  utils.CommaJoin(utils.NiceSort(es_unset_nodes)))
3515
      self.LogWarning("Some checks required by exclusive storage will be"
3516
                      " performed also on nodes with the flag unset")
3517 3506

  
3518 3507
    # At this point, we have the in-memory data structures complete,
3519 3508
    # except for the runtime information, which we'll gather next
b/lib/config.py
745 745
        _helper("node %s" % node.name, "ndparams",
746 746
                cluster.FillND(node, data.nodegroups[node.group]),
747 747
                constants.NDS_PARAMETER_TYPES)
748
      used_globals = constants.NDC_GLOBALS.intersection(node.ndparams)
749
      if used_globals:
750
        result.append("Node '%s' has some global parameters set: %s" %
751
                      (node.name, utils.CommaJoin(used_globals)))
748 752

  
749 753
    # nodegroups checks
750 754
    nodegroups_names = set()
b/lib/constants.py
1455 1455
CV_ECLUSTERDANGLINGINST = \
1456 1456
  (CV_TNODE, "ECLUSTERDANGLINGINST",
1457 1457
   "Some instances have a non-existing primary node")
1458
CV_EGROUPMIXEDESFLAG = \
1459
  (CV_TGROUP, "EGROUPMIXEDESFLAG",
1460
   "exclusive_storage flag is not uniform within the group")
1461 1458
CV_EGROUPDIFFERENTPVSIZE = \
1462 1459
  (CV_TGROUP, "EGROUPDIFFERENTPVSIZE", "PVs in the group have different sizes")
1463 1460
CV_EINSTANCEBADNODE = \
b/test/py/ganeti.config_unittest.py
74 74
    """Initializes the cfg object"""
75 75
    me = netutils.Hostname()
76 76
    ip = constants.IP4_ADDRESS_LOCALHOST
77
    # master_ip must not conflict with the node ip address
78
    master_ip = "127.0.0.2"
77 79

  
78 80
    cluster_config = objects.Cluster(
79 81
      serial_no=1,
......
87 89
      tcpudp_port_pool=set(),
88 90
      enabled_hypervisors=[constants.HT_FAKE],
89 91
      master_node=me.name,
90
      master_ip="127.0.0.1",
92
      master_ip=master_ip,
91 93
      master_netdev=constants.DEFAULT_BRIDGE,
92 94
      cluster_name="cluster.local",
93 95
      file_storage_dir="/tmp",
......
426 428
    finally:
427 429
      node2.group = orig_group
428 430

  
431
  def testVerifyConfig(self):
432
    cfg = self._get_object()
433

  
434
    errs = cfg.VerifyConfig()
435
    self.assertFalse(errs)
436

  
437
    node = cfg.GetNodeInfo(cfg.GetNodeList()[0])
438
    key = list(constants.NDC_GLOBALS)[0]
439
    node.ndparams[key] = constants.NDC_DEFAULTS[key]
440
    errs = cfg.VerifyConfig()
441
    self.assertTrue(len(errs) >= 1)
442
    self.assertTrue(_IsErrorInList("has some global parameters set", errs))
443

  
444
    del node.ndparams[key]
445
    errs = cfg.VerifyConfig()
446
    self.assertFalse(errs)
447

  
448

  
449
def _IsErrorInList(err_str, err_list):
450
  return any(map(lambda e: err_str in e, err_list))
451

  
429 452

  
430 453
class TestTRM(unittest.TestCase):
431 454
  EC_ID = 1

Also available in: Unified diff