Revision c4929a8b lib/bootstrap.py
b/lib/bootstrap.py | ||
---|---|---|
290 | 290 |
modify_etc_hosts=True, modify_ssh_setup=True, |
291 | 291 |
maintain_node_health=False, drbd_helper=None, uid_pool=None, |
292 | 292 |
default_iallocator=None, primary_ip_version=None, ipolicy=None, |
293 |
prealloc_wipe_disks=False, use_external_mip_script=False): |
|
293 |
prealloc_wipe_disks=False, use_external_mip_script=False, |
|
294 |
hv_state=None, disk_state=None): |
|
294 | 295 |
"""Initialise the cluster. |
295 | 296 |
|
296 | 297 |
@type candidate_pool_size: int |
... | ... | |
429 | 430 |
else: |
430 | 431 |
ndparams = dict(constants.NDC_DEFAULTS) |
431 | 432 |
|
433 |
# This is ugly, as we modify the dict itself |
|
434 |
# FIXME: Make utils.ForceDictType pure functional or write a wrapper around it |
|
435 |
if hv_state: |
|
436 |
for hvname, hvs_data in hv_state.items(): |
|
437 |
utils.ForceDictType(hvs_data, constants.HVSTS_PARAMETER_TYPES) |
|
438 |
hv_state[hvname] = objects.Cluster.SimpleFillHvState(hvs_data) |
|
439 |
else: |
|
440 |
hv_state = dict((hvname, constants.HVST_DEFAULTS) |
|
441 |
for hvname in enabled_hypervisors) |
|
442 |
|
|
443 |
# FIXME: disk_state has no default values yet |
|
444 |
if disk_state: |
|
445 |
for storage, ds_data in disk_state.items(): |
|
446 |
if storage not in constants.DS_VALID_TYPES: |
|
447 |
raise errors.OpPrereqError("Invalid storage type in disk state: %s" % |
|
448 |
storage, errors.ECODE_INVAL) |
|
449 |
for ds_name, state in ds_data.items(): |
|
450 |
utils.ForceDictType(state, constants.DSS_PARAMETER_TYPES) |
|
451 |
ds_data[ds_name] = objects.Cluster.SimpleFillDiskState(state) |
|
452 |
|
|
432 | 453 |
# hvparams is a mapping of hypervisor->hvparams dict |
433 | 454 |
for hv_name, hv_params in hvparams.iteritems(): |
434 | 455 |
utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES) |
... | ... | |
506 | 527 |
primary_ip_family=ipcls.family, |
507 | 528 |
prealloc_wipe_disks=prealloc_wipe_disks, |
508 | 529 |
use_external_mip_script=use_external_mip_script, |
509 |
ipolicy=ipolicy |
|
530 |
ipolicy=ipolicy, |
|
531 |
hv_state_static=hv_state, |
|
532 |
disk_state_static=disk_state, |
|
510 | 533 |
) |
511 | 534 |
master_node_config = objects.Node(name=hostname.name, |
512 | 535 |
primary_ip=hostname.ip, |
Also available in: Unified diff