Commit a721e23a authored by Luca Bigliardi's avatar Luca Bigliardi

Check and set drbd helper during bootstrap

Signed-off-by: default avatarLuca Bigliardi <shammash@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent c46b9782
......@@ -39,6 +39,7 @@ from ganeti import objects
from ganeti import ssconf
from ganeti import serializer
from ganeti import hypervisor
from ganeti import bdev
def _InitSSHSetup():
......@@ -210,12 +211,13 @@ def _InitFileStorage(file_storage_dir):
return file_storage_dir
#pylint: disable-msg=R0913
def InitCluster(cluster_name, mac_prefix,
master_netdev, file_storage_dir, candidate_pool_size,
secondary_ip=None, vg_name=None, beparams=None,
nicparams=None, hvparams=None, enabled_hypervisors=None,
modify_etc_hosts=True, modify_ssh_setup=True,
maintain_node_health=False,
maintain_node_health=False, drbd_helper=None,
uid_pool=None):
"""Initialise the cluster.
......@@ -279,6 +281,20 @@ def InitCluster(cluster_name, mac_prefix,
" you are not using lvm" % vgstatus,
errors.ECODE_INVAL)
if drbd_helper is not None:
try:
curr_helper = bdev.BaseDRBD.GetUsermodeHelper()
except errors.BlockDeviceError, err:
raise errors.OpPrereqError("Error while checking drbd helper"
" (specify --no-drbd-storage if you are not"
" using drbd): %s" % str(err),
errors.ECODE_ENVIRON)
if drbd_helper != curr_helper:
raise errors.OpPrereqError("Error: requiring %s as drbd helper but %s"
" is the current helper" % (drbd_helper,
curr_helper),
errors.ECODE_INVAL)
file_storage_dir = _InitFileStorage(file_storage_dir)
if not re.match("^[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}$", mac_prefix):
......@@ -344,6 +360,7 @@ def InitCluster(cluster_name, mac_prefix,
mtime=now,
uuid=utils.NewUUID(),
maintain_node_health=maintain_node_health,
drbd_usermode_helper=drbd_helper,
)
master_node_config = objects.Node(name=hostname.name,
primary_ip=hostname.ip,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment