Revision 17463d22 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
2064 | 2064 |
else: |
2065 | 2065 |
self.new_hvparams[hv_name].update(hv_dict) |
2066 | 2066 |
|
2067 |
# os hypervisor parameters |
|
2068 |
self.new_os_hvp = objects.FillDict(cluster.os_hvp, {}) |
|
2069 |
if self.op.os_hvp: |
|
2070 |
if not isinstance(self.op.os_hvp, dict): |
|
2071 |
raise errors.OpPrereqError("Invalid 'os_hvp' parameter on input", |
|
2072 |
errors.ECODE_INVAL) |
|
2073 |
for os_name, hvs in self.op.os_hvp.items(): |
|
2074 |
if not isinstance(hvs, dict): |
|
2075 |
raise errors.OpPrereqError(("Invalid 'os_hvp' parameter on" |
|
2076 |
" input"), errors.ECODE_INVAL) |
|
2077 |
if os_name not in self.new_os_hvp: |
|
2078 |
self.new_os_hvp[os_name] = hvs |
|
2079 |
else: |
|
2080 |
for hv_name, hv_dict in hvs.items(): |
|
2081 |
if hv_name not in self.new_os_hvp[os_name]: |
|
2082 |
self.new_os_hvp[os_name][hv_name] = hv_dict |
|
2083 |
else: |
|
2084 |
self.new_os_hvp[os_name][hv_name].update(hv_dict) |
|
2085 |
|
|
2067 | 2086 |
if self.op.enabled_hypervisors is not None: |
2068 | 2087 |
self.hv_list = self.op.enabled_hypervisors |
2069 | 2088 |
if not self.hv_list: |
... | ... | |
2106 | 2125 |
" state, not changing") |
2107 | 2126 |
if self.op.hvparams: |
2108 | 2127 |
self.cluster.hvparams = self.new_hvparams |
2128 |
if self.op.os_hvp: |
|
2129 |
self.cluster.os_hvp = self.new_os_hvp |
|
2109 | 2130 |
if self.op.enabled_hypervisors is not None: |
2110 | 2131 |
self.cluster.enabled_hypervisors = self.op.enabled_hypervisors |
2111 | 2132 |
if self.op.beparams: |
... | ... | |
3336 | 3357 |
|
3337 | 3358 |
""" |
3338 | 3359 |
cluster = self.cfg.GetClusterInfo() |
3360 |
os_hvp = {} |
|
3361 |
|
|
3362 |
# Filter just for enabled hypervisors |
|
3363 |
for os_name, hv_dict in cluster.os_hvp.items(): |
|
3364 |
os_hvp[os_name] = {} |
|
3365 |
for hv_name, hv_params in hv_dict.items(): |
|
3366 |
if hv_name in cluster.enabled_hypervisors: |
|
3367 |
os_hvp[os_name][hv_name] = hv_params |
|
3368 |
|
|
3339 | 3369 |
result = { |
3340 | 3370 |
"software_version": constants.RELEASE_VERSION, |
3341 | 3371 |
"protocol_version": constants.PROTOCOL_VERSION, |
... | ... | |
3349 | 3379 |
"enabled_hypervisors": cluster.enabled_hypervisors, |
3350 | 3380 |
"hvparams": dict([(hypervisor_name, cluster.hvparams[hypervisor_name]) |
3351 | 3381 |
for hypervisor_name in cluster.enabled_hypervisors]), |
3382 |
"os_hvp": os_hvp, |
|
3352 | 3383 |
"beparams": cluster.beparams, |
3353 | 3384 |
"nicparams": cluster.nicparams, |
3354 | 3385 |
"candidate_pool_size": cluster.candidate_pool_size, |
Also available in: Unified diff