From dfb0bc93cde1eae6cde54c4870a897bae9ea39e1 Mon Sep 17 00:00:00 2001 From: Bernardo Dal Seno <bdalseno@google.com> Date: Fri, 10 May 2013 15:05:56 +0200 Subject: [PATCH] recreate-disks honors the prealloc_wipe_disks flag Now even recreate-disks wipes the newly-created disks, if the flag is set. Signed-off-by: Bernardo Dal Seno <bdalseno@google.com> Reviewed-by: Helga Velroyen <helgav@google.com> --- lib/cmdlib.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index bcf948b4a..de8f40e5e 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -7905,7 +7905,14 @@ class LUInstanceRecreateDisks(LogicalUnit): # All touched nodes must be locked mylocks = self.owned_locks(locking.LEVEL_NODE) assert mylocks.issuperset(frozenset(instance.all_nodes)) - _CreateDisks(self, instance, to_skip=to_skip) + new_disks = _CreateDisks(self, instance, to_skip=to_skip) + + # TODO: Release node locks before wiping, or explain why it's not possible + if self.cfg.GetClusterInfo().prealloc_wipe_disks: + wipedisks = [(idx, disk, 0) + for (idx, disk) in enumerate(instance.disks) + if idx not in to_skip] + _WipeOrCleanupDisks(self, instance, disks=wipedisks, cleanup=new_disks) class LUInstanceRename(LogicalUnit): -- GitLab