Commit 03d56d40 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Add zeroing function shell

This patch moves towards the actual zeroing by providing a function
that determines the necessary size and creates and destroys a temporary
Signed-off-by: default avatarHrvoje Ribicic <>
Reviewed-by: default avatarJose A. Lopes <>
parent 69683c7d
......@@ -36,7 +36,7 @@ from ganeti import utils
from ganeti.cmdlib.base import NoHooksLU, LogicalUnit
from ganeti.cmdlib.common import CheckNodeOnline, ExpandNodeUuidAndName
from ganeti.cmdlib.instance_storage import StartInstanceDisks, \
ShutdownInstanceDisks, TemporaryDisk
from ganeti.cmdlib.instance_utils import GetClusterDomainSecret, \
BuildInstanceHookEnvByObject, CheckNodeNotDrained, RemoveInstance
......@@ -375,6 +375,20 @@ class LUBackupExport(LogicalUnit):
# Finally, the conversion
return math.ceil(byte_size / 1024. / 1024.)
def ZeroFreeSpace(self, feedback_fn):
"""Zeroes the free space on a shutdown instance.
@type feedback_fn: function
@param feedback_fn: Function used to log progress
zeroing_image = self.cfg.GetZeroingImage()
src_node_uuid = self.instance.primary_node
disk_size = self._DetermineImageSize(zeroing_image, src_node_uuid)
with TemporaryDisk(self, self.instance, disk_size, feedback_fn) as _disk:
def Exec(self, feedback_fn):
"""Export an instance to an image in the cluster.
......@@ -394,6 +408,9 @@ class LUBackupExport(LogicalUnit):
" node %s" % (,
if self.op.zero_free_space:
activate_disks = not self.instance.disks_active
if activate_disks:
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