727 |
727 |
return bad
|
728 |
728 |
|
729 |
729 |
def _VerifyInstance(self, instance, instanceconfig, node_vol_is,
|
730 |
|
node_instance, feedback_fn):
|
|
730 |
node_instance, feedback_fn, n_offline):
|
731 |
731 |
"""Verify an instance.
|
732 |
732 |
|
733 |
733 |
This function checks to see if the required block devices are
|
... | ... | |
742 |
742 |
instanceconfig.MapLVsByNode(node_vol_should)
|
743 |
743 |
|
744 |
744 |
for node in node_vol_should:
|
|
745 |
if node in n_offline:
|
|
746 |
# ignore missing volumes on offline nodes
|
|
747 |
continue
|
745 |
748 |
for volume in node_vol_should[node]:
|
746 |
749 |
if node not in node_vol_is or volume not in node_vol_is[node]:
|
747 |
750 |
feedback_fn(" - ERROR: volume %s missing on node %s" %
|
... | ... | |
749 |
752 |
bad = True
|
750 |
753 |
|
751 |
754 |
if not instanceconfig.status == 'down':
|
752 |
|
if (node_current not in node_instance or
|
753 |
|
not instance in node_instance[node_current]):
|
|
755 |
if ((node_current not in node_instance or
|
|
756 |
not instance in node_instance[node_current]) and
|
|
757 |
node_current not in n_offline):
|
754 |
758 |
feedback_fn(" - ERROR: instance %s not running on node %s" %
|
755 |
759 |
(instance, node_current))
|
756 |
760 |
bad = True
|
... | ... | |
865 |
869 |
instancelist = utils.NiceSort(self.cfg.GetInstanceList())
|
866 |
870 |
i_non_redundant = [] # Non redundant instances
|
867 |
871 |
i_non_a_balanced = [] # Non auto-balanced instances
|
|
872 |
n_offline = [] # List of offline nodes
|
868 |
873 |
node_volume = {}
|
869 |
874 |
node_instance = {}
|
870 |
875 |
node_info = {}
|
... | ... | |
902 |
907 |
node = node_i.name
|
903 |
908 |
nresult = all_nvinfo[node].data
|
904 |
909 |
|
|
910 |
if node_i.offline:
|
|
911 |
feedback_fn("* Skipping offline node %s" % (node,))
|
|
912 |
n_offline.append(node)
|
|
913 |
continue
|
|
914 |
|
905 |
915 |
if node == master_node:
|
906 |
916 |
ntype = "master"
|
907 |
917 |
elif node_i.master_candidate:
|
... | ... | |
974 |
984 |
feedback_fn("* Verifying instance %s" % instance)
|
975 |
985 |
inst_config = self.cfg.GetInstanceInfo(instance)
|
976 |
986 |
result = self._VerifyInstance(instance, inst_config, node_volume,
|
977 |
|
node_instance, feedback_fn)
|
|
987 |
node_instance, feedback_fn, n_offline)
|
978 |
988 |
bad = bad or result
|
979 |
989 |
|
980 |
990 |
inst_config.MapLVsByNode(node_vol_should)
|
... | ... | |
984 |
994 |
pnode = inst_config.primary_node
|
985 |
995 |
if pnode in node_info:
|
986 |
996 |
node_info[pnode]['pinst'].append(instance)
|
987 |
|
else:
|
|
997 |
elif pnode not in n_offline:
|
988 |
998 |
feedback_fn(" - ERROR: instance %s, connection to primary node"
|
989 |
999 |
" %s failed" % (instance, pnode))
|
990 |
1000 |
bad = True
|
... | ... | |
1009 |
1019 |
if pnode not in node_info[snode]['sinst-by-pnode']:
|
1010 |
1020 |
node_info[snode]['sinst-by-pnode'][pnode] = []
|
1011 |
1021 |
node_info[snode]['sinst-by-pnode'][pnode].append(instance)
|
1012 |
|
else:
|
|
1022 |
elif snode not in n_offline:
|
1013 |
1023 |
feedback_fn(" - ERROR: instance %s, connection to secondary node"
|
1014 |
1024 |
" %s failed" % (instance, snode))
|
1015 |
1025 |
|
... | ... | |
1037 |
1047 |
feedback_fn(" - NOTICE: %d non-auto-balanced instance(s) found."
|
1038 |
1048 |
% len(i_non_a_balanced))
|
1039 |
1049 |
|
|
1050 |
if n_offline:
|
|
1051 |
feedback_fn(" - NOTICE: %d offline node(s) found." % len(n_offline))
|
|
1052 |
|
1040 |
1053 |
return not bad
|
1041 |
1054 |
|
1042 |
1055 |
def HooksCallBack(self, phase, hooks_results, feedback_fn, lu_result):
|
... | ... | |
1068 |
1081 |
show_node_header = True
|
1069 |
1082 |
res = hooks_results[node_name]
|
1070 |
1083 |
if res.failed or res.data is False or not isinstance(res.data, list):
|
|
1084 |
if res.offline:
|
|
1085 |
# no need to warn or set fail return value
|
|
1086 |
continue
|
1071 |
1087 |
feedback_fn(" Communication failure in hooks execution")
|
1072 |
1088 |
lu_result = 1
|
1073 |
1089 |
continue
|
... | ... | |
1141 |
1157 |
# node_volume
|
1142 |
1158 |
lvs = node_lvs[node]
|
1143 |
1159 |
if lvs.failed:
|
1144 |
|
self.LogWarning("Connection to node %s failed: %s" %
|
1145 |
|
(node, lvs.data))
|
|
1160 |
if not lvs.offline:
|
|
1161 |
self.LogWarning("Connection to node %s failed: %s" %
|
|
1162 |
(node, lvs.data))
|
1146 |
1163 |
continue
|
1147 |
1164 |
lvs = lvs.data
|
1148 |
1165 |
if isinstance(lvs, basestring):
|