Revision af95196c lib/bootstrap.py

b/lib/bootstrap.py
472 472
  ipolicy[constants.IPOLICY_DTS] = restricted_disk_templates
473 473

  
474 474

  
475
def _InitCheckDrbdHelper(drbd_helper):
476
  """Checks the DRBD usermode helper.
477

  
478
  @type drbd_helper: string
479
  @param drbd_helper: name of the DRBD usermode helper that the system should
480
    use
481

  
482
  """
483
  if drbd_helper is not None:
484
    try:
485
      curr_helper = drbd.DRBD8.GetUsermodeHelper()
486
    except errors.BlockDeviceError, err:
487
      raise errors.OpPrereqError("Error while checking drbd helper"
488
                                 " (specify --no-drbd-storage if you are not"
489
                                 " using drbd): %s" % str(err),
490
                                 errors.ECODE_ENVIRON)
491
    if drbd_helper != curr_helper:
492
      raise errors.OpPrereqError("Error: requiring %s as drbd helper but %s"
493
                                 " is the current helper" % (drbd_helper,
494
                                                             curr_helper),
495
                                 errors.ECODE_INVAL)
496

  
497

  
475 498
def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
476 499
                master_netmask, master_netdev, file_storage_dir,
477 500
                shared_file_storage_dir, candidate_pool_size, secondary_ip=None,
......
569 592
    if vgstatus:
570 593
      raise errors.OpPrereqError("Error: %s" % vgstatus, errors.ECODE_INVAL)
571 594

  
572
  if drbd_helper is not None:
573
    try:
574
      curr_helper = drbd.DRBD8.GetUsermodeHelper()
575
    except errors.BlockDeviceError, err:
576
      raise errors.OpPrereqError("Error while checking drbd helper"
577
                                 " (specify --no-drbd-storage if you are not"
578
                                 " using drbd): %s" % str(err),
579
                                 errors.ECODE_ENVIRON)
580
    if drbd_helper != curr_helper:
581
      raise errors.OpPrereqError("Error: requiring %s as drbd helper but %s"
582
                                 " is the current helper" % (drbd_helper,
583
                                                             curr_helper),
584
                                 errors.ECODE_INVAL)
595
  _InitCheckDrbdHelper(drbd_helper)
585 596

  
586 597
  logging.debug("Stopping daemons (if any are running)")
587 598
  result = utils.RunCmd([pathutils.DAEMON_UTIL, "stop-all"])

Also available in: Unified diff