Revision 2c95a8d4
b/lib/cmdlib.py | ||
---|---|---|
875 | 875 |
return int(bad) |
876 | 876 |
|
877 | 877 |
|
878 |
class LUVerifyDisks(NoHooksLU): |
|
879 |
"""Verifies the cluster disks status. |
|
880 |
|
|
881 |
""" |
|
882 |
_OP_REQP = [] |
|
883 |
|
|
884 |
def CheckPrereq(self): |
|
885 |
"""Check prerequisites. |
|
886 |
|
|
887 |
This has no prerequisites. |
|
888 |
|
|
889 |
""" |
|
890 |
pass |
|
891 |
|
|
892 |
def Exec(self, feedback_fn): |
|
893 |
"""Verify integrity of cluster disks. |
|
894 |
|
|
895 |
""" |
|
896 |
result = res_nodes, res_instances = [], [] |
|
897 |
|
|
898 |
vg_name = self.cfg.GetVGName() |
|
899 |
nodes = utils.NiceSort(self.cfg.GetNodeList()) |
|
900 |
instances = [self.cfg.GetInstanceInfo(name) |
|
901 |
for name in self.cfg.GetInstanceList()] |
|
902 |
|
|
903 |
nv_dict = {} |
|
904 |
for inst in instances: |
|
905 |
inst_lvs = {} |
|
906 |
if (inst.status != "up" or |
|
907 |
inst.disk_template not in constants.DTS_NET_MIRROR): |
|
908 |
continue |
|
909 |
inst.MapLVsByNode(inst_lvs) |
|
910 |
# transform { iname: {node: [vol,],},} to {(node, vol): iname} |
|
911 |
for node, vol_list in inst_lvs.iteritems(): |
|
912 |
for vol in vol_list: |
|
913 |
nv_dict[(node, vol)] = inst |
|
914 |
|
|
915 |
if not nv_dict: |
|
916 |
return result |
|
917 |
|
|
918 |
node_lvs = rpc.call_volume_list(nodes, vg_name) |
|
919 |
|
|
920 |
to_act = set() |
|
921 |
for node in nodes: |
|
922 |
# node_volume |
|
923 |
lvs = node_lvs[node] |
|
924 |
|
|
925 |
if not isinstance(lvs, dict): |
|
926 |
logger.Info("connection to node %s failed or invalid data returned" % |
|
927 |
(node,)) |
|
928 |
res_nodes.append(node) |
|
929 |
continue |
|
930 |
|
|
931 |
for lv_name, (_, lv_inactive, lv_online) in lvs.iteritems(): |
|
932 |
if not lv_online: |
|
933 |
inst = nv_dict.get((node, lv_name), None) |
|
934 |
if inst is not None and inst.name not in res_instances: |
|
935 |
res_instances.append(inst.name) |
|
936 |
|
|
937 |
return result |
|
938 |
|
|
939 |
|
|
878 | 940 |
class LURenameCluster(LogicalUnit): |
879 | 941 |
"""Rename the cluster. |
880 | 942 |
|
Also available in: Unified diff