Revision 9f3ac970
b/lib/cmdlib.py | ||
---|---|---|
2369 | 2369 |
"\n".join(nic_errors)) |
2370 | 2370 |
|
2371 | 2371 |
# hypervisor list/parameters |
2372 |
self.new_hvparams = objects.FillDict(cluster.hvparams, {}) |
|
2372 |
self.new_hvparams = new_hvp = objects.FillDict(cluster.hvparams, {})
|
|
2373 | 2373 |
if self.op.hvparams: |
2374 | 2374 |
if not isinstance(self.op.hvparams, dict): |
2375 | 2375 |
raise errors.OpPrereqError("Invalid 'hvparams' parameter on input", |
... | ... | |
2399 | 2399 |
else: |
2400 | 2400 |
self.new_os_hvp[os_name][hv_name].update(hv_dict) |
2401 | 2401 |
|
2402 |
# changes to the hypervisor list |
|
2402 | 2403 |
if self.op.enabled_hypervisors is not None: |
2403 | 2404 |
self.hv_list = self.op.enabled_hypervisors |
2404 | 2405 |
if not self.hv_list: |
... | ... | |
2411 | 2412 |
" entries: %s" % |
2412 | 2413 |
utils.CommaJoin(invalid_hvs), |
2413 | 2414 |
errors.ECODE_INVAL) |
2415 |
for hv in self.hv_list: |
|
2416 |
# if the hypervisor doesn't already exist in the cluster |
|
2417 |
# hvparams, we initialize it to empty, and then (in both |
|
2418 |
# cases) we make sure to fill the defaults, as we might not |
|
2419 |
# have a complete defaults list if the hypervisor wasn't |
|
2420 |
# enabled before |
|
2421 |
if hv not in new_hvp: |
|
2422 |
new_hvp[hv] = {} |
|
2423 |
new_hvp[hv] = objects.FillDict(constants.HVC_DEFAULTS[hv], new_hvp[hv]) |
|
2424 |
utils.ForceDictType(new_hvp[hv], constants.HVS_PARAMETER_TYPES) |
|
2414 | 2425 |
else: |
2415 | 2426 |
self.hv_list = cluster.enabled_hypervisors |
2416 | 2427 |
|
... | ... | |
2458 | 2469 |
if self.op.os_hvp: |
2459 | 2470 |
self.cluster.os_hvp = self.new_os_hvp |
2460 | 2471 |
if self.op.enabled_hypervisors is not None: |
2472 |
self.cluster.hvparams = self.new_hvparams |
|
2461 | 2473 |
self.cluster.enabled_hypervisors = self.op.enabled_hypervisors |
2462 | 2474 |
if self.op.beparams: |
2463 | 2475 |
self.cluster.beparams[constants.PP_DEFAULT] = self.new_beparams |
b/lib/config.py | ||
---|---|---|
364 | 364 |
if invalid_hvs: |
365 | 365 |
result.append("enabled hypervisors contains invalid entries: %s" % |
366 | 366 |
invalid_hvs) |
367 |
missing_hvp = (set(data.cluster.enabled_hypervisors) - |
|
368 |
set(data.cluster.hvparams.keys())) |
|
369 |
if missing_hvp: |
|
370 |
result.append("hypervisor parameters missing for the enabled" |
|
371 |
" hypervisor(s) %s" % utils.CommaJoin(missing_hvp)) |
|
367 | 372 |
|
368 | 373 |
if data.cluster.master_node not in data.nodes: |
369 | 374 |
result.append("cluster has invalid primary node '%s'" % |
Also available in: Unified diff