Revision 38969795

b/lib/client/gnt_cluster.py
114 114
  """
115 115
  drbd_enabled = constants.DT_DRBD8 in enabled_disk_templates
116 116

  
117
  # This raises an exception due to historical reasons, one might consider
118
  # letting the user set a helper without having DRBD enabled.
119
  if not drbd_enabled and opts.drbd_helper:
120
    raise errors.OpPrereqError(
121
        "Enabling the DRBD disk template and setting a drbd usermode helper"
122
        " with --drbd-usermode-helper conflict.")
117
  if not drbd_enabled and opts.drbd_helper is not None:
118
    ToStdout("Note: You specified a DRBD usermode helper, while DRBD storage"
119
             " is not enabled.")
123 120

  
124 121
  if drbd_enabled:
125 122
    if opts.drbd_helper is None:
......
1044 1041
  drbd_helper = opts.drbd_helper
1045 1042
  if enabled_disk_templates:
1046 1043
    drbd_enabled = constants.DT_DRBD8 in enabled_disk_templates
1047
    # This raises an exception for historic reasons. It might be a good idea
1048
    # to allow users to set a DRBD helper when DRBD storage is not enabled.
1049 1044
    if not drbd_enabled and opts.drbd_helper:
1050
      raise errors.OpPrereqError(
1051
          "Setting a DRBD usermode helper when DRBD is not enabled is"
1052
          " not allowed.")
1045
      ToStdout("You specified a DRBD usermode helper with "
1046
               " --drbd-usermode-helper while DRBD is not enabled.")
1053 1047
  return drbd_helper
1054 1048

  
1055 1049

  
b/qa/qa_cluster.py
621 621
         "--enabled-disk-templates=%s" % constants.DT_PLAIN,
622 622
         "--ipolicy-disk-templates=%s" % constants.DT_PLAIN], False),
623 623
       (["gnt-cluster", "modify",
624
         "--drbd-usermode-helper="], True),
624
         "--drbd-usermode-helper="], False),
625 625
       (["gnt-cluster", "modify",
626 626
         "--drbd-usermode-helper=%s" % drbd_usermode_helper], False),
627 627
       (["gnt-cluster", "modify",
b/test/py/ganeti.client.gnt_cluster_unittest.py
286 286
    opts = mock.Mock()
287 287
    self.disableDrbd()
288 288
    opts.drbd_helper = "/bin/true"
289
    self.assertRaises(errors.OpPrereqError, gnt_cluster._InitDrbdHelper, opts,
290
        self.enabled_disk_templates)
289
    helper = gnt_cluster._InitDrbdHelper(opts, self.enabled_disk_templates)
290
    self.assertEquals(opts.drbd_helper, helper)
291 291

  
292 292
  def testDrbdHelperNone(self):
293 293
    opts = mock.Mock()
......
336 336
    opts = mock.Mock()
337 337
    self.disableDrbd()
338 338
    opts.drbd_helper = "/bin/true"
339
    self.assertRaises(errors.OpPrereqError, gnt_cluster._GetDrbdHelper, opts,
340
        self.enabled_disk_templates)
339
    helper = gnt_cluster._GetDrbdHelper(opts, None)
340
    self.assertEquals(opts.drbd_helper, helper)
341 341

  
342 342
  def testDrbdNoHelper(self):
343 343
    opts = mock.Mock()

Also available in: Unified diff