Revision a25f44a4

b/qa/qa_cluster.py
553 553
  enabled_disk_templates = qa_config.GetEnabledDiskTemplates()
554 554
  default_disk_template = qa_config.GetDefaultDiskTemplate()
555 555

  
556
  _TestClusterModifyDiskTemplatesArguments(default_disk_template,
557
                                           enabled_disk_templates)
556
  _TestClusterModifyDiskTemplatesArguments(default_disk_template)
557
  _TestClusterModifyDiskTemplatesDrbdHelper(enabled_disk_templates)
558 558
  _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates)
559 559

  
560 560
  _RestoreEnabledDiskTemplates()
......
591 591
  AssertCommand(cmd, fail=False)
592 592

  
593 593

  
594
def _TestClusterModifyDiskTemplatesArguments(default_disk_template,
595
                                             enabled_disk_templates):
594
def _TestClusterModifyDiskTemplatesDrbdHelper(enabled_disk_templates):
595
  """Tests argument handling of 'gnt-cluster modify' with respect to
596
     the parameter '--drbd-usermode-helper'. This test is independent
597
     of instances.
598

  
599
  """
600
  _RestoreEnabledDiskTemplates()
601

  
602
  if constants.DT_DRBD8 not in enabled_disk_templates:
603
    return
604
  if constants.DT_PLAIN not in enabled_disk_templates:
605
    return
606

  
607
  drbd_usermode_helper = qa_config.get("drbd-usermode-helper", "/bin/true")
608
  bogus_usermode_helper = "/tmp/pinkbunny"
609
  for command, fail in \
610
      [(["gnt-cluster", "modify",
611
         "--enabled-disk-templates=%s" % constants.DT_DRBD8,
612
         "--ipolicy-disk-templates=%s" % constants.DT_DRBD8], False),
613
       (["gnt-cluster", "modify",
614
         "--drbd-usermode-helper=%s" % drbd_usermode_helper], False),
615
       (["gnt-cluster", "modify",
616
         "--drbd-usermode-helper=%s" % bogus_usermode_helper], True),
617
       # unsetting helper when DRBD is enabled should not work
618
       (["gnt-cluster", "modify",
619
         "--drbd-usermode-helper="], True),
620
       (["gnt-cluster", "modify",
621
         "--enabled-disk-templates=%s" % constants.DT_PLAIN,
622
         "--ipolicy-disk-templates=%s" % constants.DT_PLAIN], False),
623
       (["gnt-cluster", "modify",
624
         "--drbd-usermode-helper="], True),
625
       (["gnt-cluster", "modify",
626
         "--drbd-usermode-helper=%s" % drbd_usermode_helper], False),
627
       (["gnt-cluster", "modify",
628
         "--drbd-usermode-helper=%s" % drbd_usermode_helper,
629
         "--enabled-disk-templates=%s" % constants.DT_DRBD8,
630
         "--ipolicy-disk-templates=%s" % constants.DT_DRBD8], False),
631
       (["gnt-cluster", "modify",
632
         "--drbd-usermode-helper=",
633
         "--enabled-disk-templates=%s" % constants.DT_PLAIN,
634
         "--ipolicy-disk-templates=%s" % constants.DT_PLAIN], False),
635
       (["gnt-cluster", "modify",
636
         "--drbd-usermode-helper=%s" % drbd_usermode_helper,
637
         "--enabled-disk-templates=%s" % constants.DT_DRBD8,
638
         "--ipolicy-disk-templates=%s" % constants.DT_DRBD8], False),
639
      ]:
640
    AssertCommand(command, fail=fail)
641
  _RestoreEnabledDiskTemplates()
642

  
643

  
644
def _TestClusterModifyDiskTemplatesArguments(default_disk_template):
596 645
  """Tests argument handling of 'gnt-cluster modify' with respect to
597 646
     the parameter '--enabled-disk-templates'. This test is independent
598 647
     of instances.
......
613 662
     "--ipolicy-disk-templates=%s" % default_disk_template],
614 663
    fail=False)
615 664

  
616
  if constants.DT_DRBD8 in enabled_disk_templates:
617
    # interaction with --drbd-usermode-helper option
618
    drbd_usermode_helper = qa_config.get("drbd-usermode-helper", None)
619
    if not drbd_usermode_helper:
620
      drbd_usermode_helper = "/bin/true"
621
    # specifying a helper when drbd gets disabled is ok. Note that drbd still
622
    # has to be installed on the nodes in this case
623
    AssertCommand(["gnt-cluster", "modify",
624
                   "--drbd-usermode-helper=%s" % drbd_usermode_helper,
625
                   "--enabled-disk-templates=%s" % constants.DT_DISKLESS,
626
                   "--ipolicy-disk-templates=%s" % constants.DT_DISKLESS],
627
                   fail=False)
628
    # specifying a helper when drbd is re-enabled
629
    AssertCommand(["gnt-cluster", "modify",
630
                   "--drbd-usermode-helper=%s" % drbd_usermode_helper,
631
                   "--enabled-disk-templates=%s" %
632
                     ",".join(enabled_disk_templates),
633
                   "--ipolicy-disk-templates=%s" %
634
                     ",".join(enabled_disk_templates)],
635
                  fail=False)
636

  
637 665

  
638 666
def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates):
639 667
  """Tests argument handling of 'gnt-cluster modify' with respect to

Also available in: Unified diff