maintain_node_health=False, drbd_helper=None, uid_pool=None,
default_iallocator=None, primary_ip_version=None, ipolicy=None,
prealloc_wipe_disks=False, use_external_mip_script=False,
- hv_state=None, disk_state=None, enabled_storage_types=None):
+ hv_state=None, disk_state=None, enabled_disk_templates=None):
"""Initialise the cluster.
@type candidate_pool_size: int
@param candidate_pool_size: master candidate pool size
- @type enabled_storage_types: list of string
- @param enabled_storage_types: list of storage types to be used in this
+ @type enabled_disk_templates: list of string
+ @param enabled_disk_templates: list of disk_templates to be used in this
cluster
"""
" entries: %s" % invalid_hvs,
errors.ECODE_INVAL)
- if not enabled_storage_types:
- raise errors.OpPrereqError("Enabled storage types list must contain at"
+ if not enabled_disk_templates:
+ raise errors.OpPrereqError("Enabled disk templates list must contain at"
" least one member", errors.ECODE_INVAL)
- invalid_storage_types = \
- set(enabled_storage_types) - constants.VALID_STORAGE_TYPES
- if invalid_storage_types:
- raise errors.OpPrereqError("Enabled storage_types contains invalid"
- " entries: %s" % invalid_storage_types,
+ invalid_disk_templates = \
+ set(enabled_disk_templates) - constants.DISK_TEMPLATES
+ if invalid_disk_templates:
+ raise errors.OpPrereqError("Enabled disk templates list contains invalid"
+ " entries: %s" % invalid_disk_templates,
errors.ECODE_INVAL)
try:
utils.CommaJoin(unknown_params)),
errors.ECODE_INVAL)
utils.ForceDictType(dt_params, constants.DISK_DT_TYPES)
+ if template == constants.DT_DRBD8 and vg_name is not None:
+ # The default METAVG value is equal to the VG name set at init time,
+ # if provided
+ dt_params[constants.DRBD_DEFAULT_METAVG] = vg_name
+
try:
utils.VerifyDictOptions(diskparams, constants.DISK_DT_DEFAULTS)
except errors.OpPrereqError, err:
errors.ECODE_INVAL)
# set up ssh config and /etc/hosts
- sshline = utils.ReadFile(pathutils.SSH_HOST_RSA_PUB)
- sshkey = sshline.split(" ")[1]
+ rsa_sshkey = ""
+ dsa_sshkey = ""
+ if os.path.isfile(pathutils.SSH_HOST_RSA_PUB):
+ sshline = utils.ReadFile(pathutils.SSH_HOST_RSA_PUB)
+ rsa_sshkey = sshline.split(" ")[1]
+ if os.path.isfile(pathutils.SSH_HOST_DSA_PUB):
+ sshline = utils.ReadFile(pathutils.SSH_HOST_DSA_PUB)
+ dsa_sshkey = sshline.split(" ")[1]
+ if not rsa_sshkey and not dsa_sshkey:
+ raise errors.OpPrereqError("Failed to find SSH public keys",
+ errors.ECODE_ENVIRON)
if modify_etc_hosts:
utils.AddHostToEtcHosts(hostname.name, hostname.ip)
# init of cluster config file
cluster_config = objects.Cluster(
serial_no=1,
- rsahostkeypub=sshkey,
+ rsahostkeypub=rsa_sshkey,
+ dsahostkeypub=dsa_sshkey,
highest_used_port=(constants.FIRST_DRBD_PORT - 1),
mac_prefix=mac_prefix,
volume_group_name=vg_name,
ipolicy=full_ipolicy,
hv_state_static=hv_state,
disk_state_static=disk_state,
- enabled_storage_types=enabled_storage_types,
+ enabled_disk_templates=enabled_disk_templates,
)
master_node_config = objects.Node(name=hostname.name,
primary_ip=hostname.ip,