Revision f965260c
b/lib/client/gnt_instance.py | ||
---|---|---|
985 | 985 |
return data |
986 | 986 |
|
987 | 987 |
|
988 |
def _FormatBlockDevInfo(idx, top_level, dev, static, roman):
|
|
988 |
def _FormatBlockDevInfo(idx, top_level, dev, roman): |
|
989 | 989 |
"""Show block device information. |
990 | 990 |
|
991 | 991 |
This is only used by L{ShowInstanceConfig}, but it's too big to be |
... | ... | |
997 | 997 |
@param top_level: if this a top-level disk? |
998 | 998 |
@type dev: dict |
999 | 999 |
@param dev: dictionary with disk information |
1000 |
@type static: boolean |
|
1001 |
@param static: wheter the device information doesn't contain |
|
1002 |
runtime information but only static data |
|
1003 | 1000 |
@type roman: boolean |
1004 | 1001 |
@param roman: whether to try to use roman integers |
1005 | 1002 |
@return: a list of either strings, tuples or lists |
... | ... | |
1087 | 1084 |
elif dev["physical_id"] is not None: |
1088 | 1085 |
data.append("physical_id:") |
1089 | 1086 |
data.append([dev["physical_id"]]) |
1090 |
if not static: |
|
1087 |
|
|
1088 |
if dev["pstatus"]: |
|
1091 | 1089 |
data.append(("on primary", helper(dev["dev_type"], dev["pstatus"]))) |
1092 |
if dev["sstatus"] and not static: |
|
1090 |
|
|
1091 |
if dev["sstatus"]: |
|
1093 | 1092 |
data.append(("on secondary", helper(dev["dev_type"], dev["sstatus"]))) |
1094 | 1093 |
|
1095 | 1094 |
if dev["children"]: |
1096 | 1095 |
data.append("child devices:") |
1097 | 1096 |
for c_idx, child in enumerate(dev["children"]): |
1098 |
data.append(_FormatBlockDevInfo(c_idx, False, child, static, roman))
|
|
1097 |
data.append(_FormatBlockDevInfo(c_idx, False, child, roman)) |
|
1099 | 1098 |
d1.append(data) |
1100 | 1099 |
return d1 |
1101 | 1100 |
|
... | ... | |
1169 | 1168 |
buf.write("Creation time: %s\n" % utils.FormatTime(instance["ctime"])) |
1170 | 1169 |
buf.write("Modification time: %s\n" % utils.FormatTime(instance["mtime"])) |
1171 | 1170 |
buf.write("State: configured to be %s" % instance["config_state"]) |
1172 |
if not opts.static:
|
|
1171 |
if instance["run_state"]:
|
|
1173 | 1172 |
buf.write(", actual state is %s" % instance["run_state"]) |
1174 | 1173 |
buf.write("\n") |
1175 | 1174 |
##buf.write("Considered for memory checks in cluster verify: %s\n" % |
... | ... | |
1223 | 1222 |
buf.write(" Disks:\n") |
1224 | 1223 |
|
1225 | 1224 |
for idx, device in enumerate(instance["disks"]): |
1226 |
_FormatList(buf, _FormatBlockDevInfo(idx, True, device, opts.static,
|
|
1225 |
_FormatList(buf, _FormatBlockDevInfo(idx, True, device, |
|
1227 | 1226 |
opts.roman_integers), 2) |
1228 | 1227 |
|
1229 | 1228 |
ToStdout(buf.getvalue().rstrip('\n')) |
b/lib/cmdlib.py | ||
---|---|---|
10199 | 10199 |
dev_sstatus = self._ComputeBlockdevStatus(snode, instance.name, dev) |
10200 | 10200 |
|
10201 | 10201 |
if dev.children: |
10202 |
dev_children = [self._ComputeDiskStatus(instance, snode, child) |
|
10203 |
for child in dev.children] |
|
10202 |
dev_children = map(compat.partial(self._ComputeDiskStatus, |
|
10203 |
instance, snode), |
|
10204 |
dev.children) |
|
10204 | 10205 |
else: |
10205 | 10206 |
dev_children = [] |
10206 | 10207 |
|
... | ... | |
10223 | 10224 |
cluster = self.cfg.GetClusterInfo() |
10224 | 10225 |
|
10225 | 10226 |
for instance in self.wanted_instances: |
10226 |
if not self.op.static: |
|
10227 |
pnode = self.cfg.GetNodeInfo(instance.primary_node) |
|
10228 |
|
|
10229 |
if self.op.static or pnode.offline: |
|
10230 |
remote_state = None |
|
10231 |
if pnode.offline: |
|
10232 |
self.LogWarning("Primary node %s is marked offline, returning static" |
|
10233 |
" information only for instance %s" % |
|
10234 |
(pnode.name, instance.name)) |
|
10235 |
else: |
|
10227 | 10236 |
remote_info = self.rpc.call_instance_info(instance.primary_node, |
10228 | 10237 |
instance.name, |
10229 | 10238 |
instance.hypervisor) |
... | ... | |
10233 | 10242 |
remote_state = "up" |
10234 | 10243 |
else: |
10235 | 10244 |
remote_state = "down" |
10236 |
else: |
|
10237 |
remote_state = None |
|
10245 |
|
|
10238 | 10246 |
if instance.admin_up: |
10239 | 10247 |
config_state = "up" |
10240 | 10248 |
else: |
10241 | 10249 |
config_state = "down" |
10242 | 10250 |
|
10243 |
disks = [self._ComputeDiskStatus(instance, None, device)
|
|
10244 |
for device in instance.disks]
|
|
10251 |
disks = map(compat.partial(self._ComputeDiskStatus, instance, None),
|
|
10252 |
instance.disks)
|
|
10245 | 10253 |
|
10246 | 10254 |
result[instance.name] = { |
10247 | 10255 |
"name": instance.name, |
Also available in: Unified diff