Revision 98bdd169 qa/ganeti-qa.py

b/qa/ganeti-qa.py
635 635
    node.Release()
636 636

  
637 637

  
638
def IsExclusiveStorageInstanceTestEnabled():
639
  test_name = "exclusive-storage-instance-tests"
640
  if qa_config.TestEnabled(test_name):
641
    vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
642
    vgscmd = utils.ShellQuoteArgs([
643
      "vgs", "--noheadings", "-o", "pv_count", vgname,
644
      ])
645
    nodes = qa_config.GetConfig()["nodes"]
646
    for node in nodes:
647
      try:
648
        pvnum = int(qa_utils.GetCommandOutput(node.primary, vgscmd))
649
      except Exception, e:
650
        msg = ("Cannot get the number of PVs on %s, needed by '%s': %s" %
651
               (node.primary, test_name, e))
652
        raise qa_error.Error(msg)
653
      if pvnum < 2:
654
        raise qa_error.Error("Node %s has not enough PVs (%s) to run '%s'" %
655
                             (node.primary, pvnum, test_name))
656
    res = True
657
  else:
658
    res = False
659
  return res
660

  
661

  
638 662
def RunInstanceTests():
639 663
  """Create and exercise instances."""
640 664
  instance_tests = [
......
748 772

  
749 773
  config_list = [
750 774
    ("default-instance-tests", lambda: None, lambda _: None),
751
    ("exclusive-storage-instance-tests",
775
    (IsExclusiveStorageInstanceTestEnabled,
752 776
     lambda: qa_cluster.TestSetExclStorCluster(True),
753 777
     qa_cluster.TestSetExclStorCluster),
754 778
  ]

Also available in: Unified diff