Revision 58a59652 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
1397 | 1397 |
_ErrorIf(test, self.ENODEHV, node, |
1398 | 1398 |
"hypervisor %s verify failure: '%s'", hv_name, hv_result) |
1399 | 1399 |
|
1400 |
hvp_result = nresult.get(constants.NV_HVPARAMS, None) |
|
1401 |
if ninfo.vm_capable and isinstance(hvp_result, list): |
|
1402 |
for item, hv_name, hv_result in hvp_result: |
|
1403 |
_ErrorIf(True, self.ENODEHV, node, |
|
1404 |
"hypervisor %s parameter verify failure (source %s): %s", |
|
1405 |
hv_name, item, hv_result) |
|
1406 |
|
|
1400 | 1407 |
test = nresult.get(constants.NV_NODESETUP, |
1401 | 1408 |
["Missing NODESETUP results"]) |
1402 | 1409 |
_ErrorIf(test, self.ENODESETUP, node, "node setup error: %s", |
... | ... | |
2029 | 2036 |
|
2030 | 2037 |
return instdisk |
2031 | 2038 |
|
2039 |
def _VerifyHVP(self, hvp_data): |
|
2040 |
"""Verifies locally the syntax of the hypervisor parameters. |
|
2041 |
|
|
2042 |
""" |
|
2043 |
for item, hv_name, hv_params in hvp_data: |
|
2044 |
msg = ("hypervisor %s parameters syntax check (source %s): %%s" % |
|
2045 |
(item, hv_name)) |
|
2046 |
try: |
|
2047 |
hv_class = hypervisor.GetHypervisor(hv_name) |
|
2048 |
utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES) |
|
2049 |
hv_class.CheckParameterSyntax(hv_params) |
|
2050 |
except errors.GenericError, err: |
|
2051 |
self._ErrorIf(True, self.ECLUSTERCFG, None, msg % str(err)) |
|
2052 |
|
|
2053 |
|
|
2032 | 2054 |
def BuildHooksEnv(self): |
2033 | 2055 |
"""Build hooks env. |
2034 | 2056 |
|
... | ... | |
2094 | 2116 |
|
2095 | 2117 |
local_checksums = utils.FingerprintFiles(file_names) |
2096 | 2118 |
|
2119 |
# Compute the set of hypervisor parameters |
|
2120 |
hvp_data = [] |
|
2121 |
for hv_name in hypervisors: |
|
2122 |
hvp_data.append(("cluster", hv_name, cluster.GetHVDefaults(hv_name))) |
|
2123 |
for os_name, os_hvp in cluster.os_hvp.items(): |
|
2124 |
for hv_name, hv_params in os_hvp.items(): |
|
2125 |
if not hv_params: |
|
2126 |
continue |
|
2127 |
full_params = cluster.GetHVDefaults(hv_name, os_name=os_name) |
|
2128 |
hvp_data.append(("os %s" % os_name, hv_name, full_params)) |
|
2129 |
# TODO: collapse identical parameter values in a single one |
|
2130 |
for instance in instanceinfo.values(): |
|
2131 |
if not instance.hvparams: |
|
2132 |
continue |
|
2133 |
hvp_data.append(("instance %s" % instance.name, instance.hypervisor, |
|
2134 |
cluster.FillHV(instance))) |
|
2135 |
# and verify them locally |
|
2136 |
self._VerifyHVP(hvp_data) |
|
2137 |
|
|
2097 | 2138 |
feedback_fn("* Gathering data (%d nodes)" % len(nodelist)) |
2098 | 2139 |
node_verify_param = { |
2099 | 2140 |
constants.NV_FILELIST: file_names, |
2100 | 2141 |
constants.NV_NODELIST: [node.name for node in nodeinfo |
2101 | 2142 |
if not node.offline], |
2102 | 2143 |
constants.NV_HYPERVISOR: hypervisors, |
2144 |
constants.NV_HVPARAMS: hvp_data, |
|
2103 | 2145 |
constants.NV_NODENETTEST: [(node.name, node.primary_ip, |
2104 | 2146 |
node.secondary_ip) for node in nodeinfo |
2105 | 2147 |
if not node.offline], |
Also available in: Unified diff