Commit 099ed3b2 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Gracefully handle degraded instances in verification



The current code assumes that every instance either is of type
diskless or has at least one disk. However, with the option to
remove individual disk degraded 0-disk non-diskless instances
can occur. While such instances usually are not useful, Ganeti
still should be operational in their presence.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 7e219d1b
......@@ -2618,6 +2618,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
node_disks = {}
node_disks_devonly = {}
diskless_instances = set()
nodisk_instances = set()
diskless = constants.DT_DISKLESS
for nuuid in node_uuids:
......@@ -2630,6 +2631,8 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
for disk in instanceinfo[inst_uuid].disks]
if not disks:
nodisk_instances.update(uuid for uuid in node_inst_uuids
if instanceinfo[uuid].disk_template != diskless)
# No need to collect data
continue
......@@ -2687,6 +2690,10 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
for inst_uuid in diskless_instances:
assert inst_uuid not in instdisk
instdisk[inst_uuid] = {}
# ...and disk-full instances that happen to have no disks
for inst_uuid in nodisk_instances:
assert inst_uuid not in instdisk
instdisk[inst_uuid] = {}
assert compat.all(len(statuses) == len(instanceinfo[inst].disks) and
len(nuuids) <= len(instanceinfo[inst].all_nodes) and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment