Commit 40d93e3b authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

gnt-cluster repair-disk-sizes repairs spindles too

When exclusive storage is active, any wrong or missing spindles information
in disks gets updated too.
Signed-off-by: default avatarBernardo Dal Seno <>
Reviewed-by: default avatarHelga Velroyen <>
parent 6ef8077e
......@@ -528,6 +528,9 @@ class LUClusterRepairDiskSizes(NoHooksLU):
"Not owning correct locks"
assert not self.owned_locks(locking.LEVEL_NODE)
es_flags = rpc.GetExclusiveStorageForNodeNames(self.cfg,
changed = []
for node, dskl in per_node_disks.items():
newl = [v[2].Copy() for v in dskl]
......@@ -554,7 +557,7 @@ class LUClusterRepairDiskSizes(NoHooksLU):
" dimension information, ignoring", idx,
(size, _) = dimensions
(size, spindles) = dimensions
if not isinstance(size, (int, long)):
self.LogWarning("Disk %d of instance %s did not return valid"
" size information, ignoring", idx,
......@@ -566,10 +569,22 @@ class LUClusterRepairDiskSizes(NoHooksLU):, disk.size, size)
disk.size = size
self.cfg.Update(instance, feedback_fn)
changed.append((, idx, size))
changed.append((, idx, "size", size))
if es_flags[node]:
if spindles is None:
self.LogWarning("Disk %d of instance %s did not return valid"
" spindles information, ignoring", idx,
elif disk.spindles is None or disk.spindles != spindles:
self.LogInfo("Disk %d of instance %s has mismatched spindles,"
" correcting: recorded %s, actual %s",
idx,, disk.spindles, spindles)
disk.spindles = spindles
self.cfg.Update(instance, feedback_fn)
changed.append((, idx, "spindles", disk.spindles))
if self._EnsureChildSizes(disk):
self.cfg.Update(instance, feedback_fn)
changed.append((, idx, disk.size))
changed.append((, idx, "size", disk.size))
return changed
......@@ -868,7 +868,7 @@ class OpClusterRepairDiskSizes(OpCode):
Parameters: optional instances list, in case we want to restrict the
checks to only a subset of the instances.
Result: a list of tuples, (instance, disk, new-size) for changed
Result: a list of tuples, (instance, disk, parameter, new-size) for changed
In normal operation, the list should be empty.
......@@ -880,9 +880,10 @@ class OpClusterRepairDiskSizes(OpCode):
("instances", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), None),
OP_RESULT = ht.TListOf(ht.TAnd(ht.TIsLength(3),
OP_RESULT = ht.TListOf(ht.TAnd(ht.TIsLength(4),
......@@ -758,14 +758,15 @@ This command checks that the recorded size of the given instance's
disks matches the actual size and updates any mismatches found.
This is needed if the Ganeti configuration is no longer consistent
with reality, as it will impact some disk operations. If no
arguments are given, all instances will be checked.
arguments are given, all instances will be checked. When exclusive
storage is active, also spindles are updated.
Note that only active disks can be checked by this command; in case
a disk cannot be activated it's advised to use
**gnt-instance activate-disks \--ignore-size ...** to force
activation without regard to the current size.
When the all disk sizes are consistent, the command will return no
When all the disk sizes are consistent, the command will return no
output. Otherwise it will log details about the inconsistencies in
the configuration.
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