Revision 5b0dfcef
b/lib/backend.py | ||
---|---|---|
733 | 733 |
@type what: C{dict} |
734 | 734 |
@param what: a dictionary of things to check |
735 | 735 |
@type vm_capable: boolean |
736 |
@param vm_capable: whether or not this not is vm capable
|
|
736 |
@param vm_capable: whether or not this node is vm capable
|
|
737 | 737 |
@type result: dict |
738 | 738 |
@param result: dictionary of verification results; results of the |
739 | 739 |
verifications in this function will be added here |
... | ... | |
764 | 764 |
@type what: C{dict} |
765 | 765 |
@param what: a dictionary of things to check |
766 | 766 |
@type vm_capable: boolean |
767 |
@param vm_capable: whether or not this not is vm capable
|
|
767 |
@param vm_capable: whether or not this node is vm capable
|
|
768 | 768 |
@type result: dict |
769 | 769 |
@param result: dictionary of verification results; results of the |
770 | 770 |
verifications in this function will be added here |
... | ... | |
785 | 785 |
result[constants.NV_HVPARAMS].append((source, hv_name, str(err))) |
786 | 786 |
|
787 | 787 |
|
788 |
def VerifyNode(what, cluster_name): |
|
788 |
def _VerifyInstanceList(what, vm_capable, result, all_hvparams): |
|
789 |
"""Verifies the instance list. |
|
790 |
|
|
791 |
@type what: C{dict} |
|
792 |
@param what: a dictionary of things to check |
|
793 |
@type vm_capable: boolean |
|
794 |
@param vm_capable: whether or not this node is vm capable |
|
795 |
@type result: dict |
|
796 |
@param result: dictionary of verification results; results of the |
|
797 |
verifications in this function will be added here |
|
798 |
@type all_hvparams: dict of dict of string |
|
799 |
@param all_hvparams: dictionary mapping hypervisor names to hvparams |
|
800 |
|
|
801 |
""" |
|
802 |
if constants.NV_INSTANCELIST in what and vm_capable: |
|
803 |
# GetInstanceList can fail |
|
804 |
try: |
|
805 |
val = GetInstanceList(what[constants.NV_INSTANCELIST], |
|
806 |
all_hvparams=all_hvparams) |
|
807 |
except RPCFail, err: |
|
808 |
val = str(err) |
|
809 |
result[constants.NV_INSTANCELIST] = val |
|
810 |
|
|
811 |
|
|
812 |
def _VerifyNodeInfo(what, vm_capable, result, all_hvparams): |
|
813 |
"""Verifies the node info. |
|
814 |
|
|
815 |
@type what: C{dict} |
|
816 |
@param what: a dictionary of things to check |
|
817 |
@type vm_capable: boolean |
|
818 |
@param vm_capable: whether or not this node is vm capable |
|
819 |
@type result: dict |
|
820 |
@param result: dictionary of verification results; results of the |
|
821 |
verifications in this function will be added here |
|
822 |
@type all_hvparams: dict of dict of string |
|
823 |
@param all_hvparams: dictionary mapping hypervisor names to hvparams |
|
824 |
|
|
825 |
""" |
|
826 |
if constants.NV_HVINFO in what and vm_capable: |
|
827 |
hvname = what[constants.NV_HVINFO] |
|
828 |
hyper = hypervisor.GetHypervisor(hvname) |
|
829 |
hvparams = all_hvparams[hvname] |
|
830 |
result[constants.NV_HVINFO] = hyper.GetNodeInfo(hvparams=hvparams) |
|
831 |
|
|
832 |
|
|
833 |
def VerifyNode(what, cluster_name, all_hvparams): |
|
789 | 834 |
"""Verify the status of the local node. |
790 | 835 |
|
791 | 836 |
Based on the input L{what} parameter, various checks are done on the |
... | ... | |
809 | 854 |
- node-net-test: list of nodes we should check node daemon port |
810 | 855 |
connectivity with |
811 | 856 |
- hypervisor: list with hypervisors to run the verify for |
812 |
|
|
857 |
@type cluster_name: string |
|
858 |
@param cluster_name: the cluster's name |
|
859 |
@type all_hvparams: dict of dict of strings |
|
860 |
@param all_hvparams: a dictionary mapping hypervisor names to hvparams |
|
813 | 861 |
@rtype: dict |
814 | 862 |
@return: a dictionary with the same keys as the input dict, and |
815 | 863 |
values representing the result of the checks |
... | ... | |
913 | 961 |
val = str(err) |
914 | 962 |
result[constants.NV_LVLIST] = val |
915 | 963 |
|
916 |
if constants.NV_INSTANCELIST in what and vm_capable: |
|
917 |
# GetInstanceList can fail |
|
918 |
try: |
|
919 |
val = GetInstanceList(what[constants.NV_INSTANCELIST]) |
|
920 |
except RPCFail, err: |
|
921 |
val = str(err) |
|
922 |
result[constants.NV_INSTANCELIST] = val |
|
964 |
_VerifyInstanceList(what, vm_capable, result, all_hvparams) |
|
923 | 965 |
|
924 | 966 |
if constants.NV_VGLIST in what and vm_capable: |
925 | 967 |
result[constants.NV_VGLIST] = utils.ListVolumeGroups() |
... | ... | |
940 | 982 |
result[constants.NV_VERSION] = (constants.PROTOCOL_VERSION, |
941 | 983 |
constants.RELEASE_VERSION) |
942 | 984 |
|
943 |
if constants.NV_HVINFO in what and vm_capable: |
|
944 |
hyper = hypervisor.GetHypervisor(what[constants.NV_HVINFO]) |
|
945 |
result[constants.NV_HVINFO] = hyper.GetNodeInfo() |
|
985 |
_VerifyNodeInfo(what, vm_capable, result, all_hvparams) |
|
946 | 986 |
|
947 | 987 |
if constants.NV_DRBDVERSION in what and vm_capable: |
948 | 988 |
try: |
... | ... | |
1178 | 1218 |
results = [] |
1179 | 1219 |
try: |
1180 | 1220 |
hv = get_hv_fn(hname) |
1181 |
names = hv.ListInstances(hvparams) |
|
1221 |
names = hv.ListInstances(hvparams=hvparams)
|
|
1182 | 1222 |
results.extend(names) |
1183 | 1223 |
except errors.HypervisorError, err: |
1184 | 1224 |
_Fail("Error enumerating instances (hypervisor %s): %s", |
... | ... | |
1207 | 1247 |
""" |
1208 | 1248 |
results = [] |
1209 | 1249 |
for hname in hypervisor_list: |
1210 |
hvparams = None |
|
1211 |
if all_hvparams is not None: |
|
1212 |
hvparams = all_hvparams[hname] |
|
1213 |
results.extend(GetInstanceListForHypervisor(hname, hvparams, |
|
1250 |
hvparams = all_hvparams[hname] |
|
1251 |
results.extend(GetInstanceListForHypervisor(hname, hvparams=hvparams, |
|
1214 | 1252 |
get_hv_fn=get_hv_fn)) |
1215 | 1253 |
return results |
1216 | 1254 |
|
b/lib/cmdlib/cluster.py | ||
---|---|---|
2726 | 2726 |
nvinfo_starttime = time.time() |
2727 | 2727 |
all_nvinfo = self.rpc.call_node_verify(self.my_node_names, |
2728 | 2728 |
node_verify_param, |
2729 |
self.cfg.GetClusterName()) |
|
2729 |
self.cfg.GetClusterName(), |
|
2730 |
self.cfg.GetClusterInfo().hvparams) |
|
2730 | 2731 |
nvinfo_endtime = time.time() |
2731 | 2732 |
|
2732 | 2733 |
if self.extra_lv_nodes and vg_name is not None: |
2733 | 2734 |
extra_lv_nvinfo = \ |
2734 | 2735 |
self.rpc.call_node_verify(self.extra_lv_nodes, |
2735 | 2736 |
{constants.NV_LVLIST: vg_name}, |
2736 |
self.cfg.GetClusterName()) |
|
2737 |
self.cfg.GetClusterName(), |
|
2738 |
self.cfg.GetClusterInfo().hvparams) |
|
2737 | 2739 |
else: |
2738 | 2740 |
extra_lv_nvinfo = {} |
2739 | 2741 |
|
... | ... | |
2766 | 2768 |
vf_node_info.append(self.all_node_info[node]) |
2767 | 2769 |
break |
2768 | 2770 |
key = constants.NV_FILELIST |
2769 |
vf_nvinfo.update(self.rpc.call_node_verify(additional_nodes,
|
|
2770 |
{key: node_verify_param[key]},
|
|
2771 |
self.cfg.GetClusterName()))
|
|
2771 |
vf_nvinfo.update(self.rpc.call_node_verify( |
|
2772 |
additional_nodes, {key: node_verify_param[key]},
|
|
2773 |
self.cfg.GetClusterName(), self.cfg.GetClusterInfo().hvparams))
|
|
2772 | 2774 |
else: |
2773 | 2775 |
vf_nvinfo = all_nvinfo |
2774 | 2776 |
vf_node_info = self.my_node_info.values() |
b/lib/cmdlib/node.py | ||
---|---|---|
290 | 290 |
vparams = {constants.NV_PVLIST: [vg_name]} |
291 | 291 |
excl_stor = IsExclusiveStorageEnabledNode(cfg, self.new_node) |
292 | 292 |
cname = self.cfg.GetClusterName() |
293 |
result = rpcrunner.call_node_verify_light([node], vparams, cname)[node] |
|
293 |
result = rpcrunner.call_node_verify_light( |
|
294 |
[node], vparams, cname, cfg.GetClusterInfo().hvparams)[node] |
|
294 | 295 |
(errmsgs, _) = CheckNodePVs(result.payload, excl_stor) |
295 | 296 |
if errmsgs: |
296 | 297 |
raise errors.OpPrereqError("Checks on node PVs failed: %s" % |
... | ... | |
360 | 361 |
} |
361 | 362 |
|
362 | 363 |
result = self.rpc.call_node_verify(node_verify_list, node_verify_param, |
363 |
self.cfg.GetClusterName()) |
|
364 |
self.cfg.GetClusterName(), |
|
365 |
self.cfg.GetClusterInfo().hvparams) |
|
364 | 366 |
for verifier in node_verify_list: |
365 | 367 |
result[verifier].Raise("Cannot communicate with node %s" % verifier) |
366 | 368 |
nl_payload = result[verifier].payload[constants.NV_NODELIST] |
b/lib/rpc_defs.py | ||
---|---|---|
474 | 474 |
"Whether exclusive storage is enabled"), |
475 | 475 |
], _NodeInfoPreProc, None, "Return node information"), |
476 | 476 |
("node_verify", MULTI, None, constants.RPC_TMO_NORMAL, [ |
477 |
("checkdict", None, None), |
|
478 |
("cluster_name", None, None), |
|
477 |
("checkdict", None, "What to verify"), |
|
478 |
("cluster_name", None, "Cluster name"), |
|
479 |
("all_hvparams", None, "Dictionary mapping hypervisor names to hvparams"), |
|
479 | 480 |
], None, None, "Request verification of given parameters"), |
480 | 481 |
("node_volumes", MULTI, None, constants.RPC_TMO_FAST, [], None, None, |
481 | 482 |
"Gets all volumes on node(s)"), |
... | ... | |
590 | 591 |
("version", MULTI, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_URGENT, [], None, |
591 | 592 |
None, "Query node version"), |
592 | 593 |
("node_verify_light", MULTI, None, constants.RPC_TMO_NORMAL, [ |
593 |
("checkdict", None, None), |
|
594 |
("cluster_name", None, None), |
|
594 |
("checkdict", None, "What to verify"), |
|
595 |
("cluster_name", None, "Cluster name"), |
|
596 |
("hvparams", None, "Dictionary mapping hypervisor names to hvparams"), |
|
595 | 597 |
], None, None, "Request verification of given parameters"), |
596 | 598 |
]), |
597 | 599 |
"RpcClientConfig": _Prepare([ |
b/lib/server/noded.py | ||
---|---|---|
738 | 738 |
"""Run a verify sequence on this node. |
739 | 739 |
|
740 | 740 |
""" |
741 |
(what, cluster_name) = params |
|
742 |
return backend.VerifyNode(what, cluster_name) |
|
741 |
(what, cluster_name, hvparams) = params
|
|
742 |
return backend.VerifyNode(what, cluster_name, hvparams)
|
|
743 | 743 |
|
744 | 744 |
@classmethod |
745 | 745 |
def perspective_node_verify_light(cls, params): |
Also available in: Unified diff