Commit 965e0e6a authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Wipe disks added through "gnt-instance modify"



In issue 353 Sascha Lucas reported that disks are not wiped when added
through “gnt-instance modify”. This patch adds this functionality and
updates the docstring for “_WipeDisks”.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 6bf7dad4
...@@ -9559,7 +9559,9 @@ def _WipeDisks(lu, instance, disks=None): ...@@ -9559,7 +9559,9 @@ def _WipeDisks(lu, instance, disks=None):
@param lu: the logical unit on whose behalf we execute @param lu: the logical unit on whose behalf we execute
@type instance: L{objects.Instance} @type instance: L{objects.Instance}
@param instance: the instance whose disks we should create @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 node = instance.primary_node
...@@ -14074,6 +14076,11 @@ class LUInstanceSetParams(LogicalUnit): ...@@ -14074,6 +14076,11 @@ class LUInstanceSetParams(LogicalUnit):
self.LogWarning("Failed to create volume %s (%s) on node '%s': %s", self.LogWarning("Failed to create volume %s (%s) on node '%s': %s",
disk.iv_name, disk, node, err) disk.iv_name, disk, node, err)
   
if self.cluster.prealloc_wipe_disks:
# Wipe new disk
_WipeDisks(self, instance,
disks=[(idx, disk, 0)])
return (disk, [ return (disk, [
("disk/%d" % idx, "add:size=%s,mode=%s" % (disk.size, disk.mode)), ("disk/%d" % idx, "add:size=%s,mode=%s" % (disk.size, disk.mode)),
]) ])
......
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