In issue 353 Sascha Lucas reported that disks are not wiped when added through “gnt-instance modify”. This patch adds this functionality.
Signed-off-by: Michael Hanselmann <[email protected]> --- lib/cmdlib.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 133a043..b8c2318 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -9559,7 +9559,9 @@ def _WipeDisks(lu, instance, disks=None): @param lu: the logical unit on whose behalf we execute @type instance: L{objects.Instance} @param instance: the instance whose disks we should create - @return: the success of the wipe + @type disks: None or list of tuple of (number, L{objects.Disk}, number) + @param disks: Disk details; tuple contains disk index, disk object and the + start offset """ node = instance.primary_node @@ -14074,6 +14076,11 @@ class LUInstanceSetParams(LogicalUnit): self.LogWarning("Failed to create volume %s (%s) on node '%s': %s", disk.iv_name, disk, node, err) + if self.cluster.prealloc_wipe_disks: + # Wipe new disk + _WipeDisks(self, instance, + disks=[(idx, disk, 0)]) + return (disk, [ ("disk/%d" % idx, "add:size=%s,mode=%s" % (disk.size, disk.mode)), ]) -- 1.8.1.3
