Commit 363f43eb authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Add the zero-free-space option



Although unused for now, add the zero-free-space option to the backup
export opcode, and add a rudimentary check for whether it should be
used.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent 24d3d8da
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -113,6 +113,14 @@ class LUBackupExport(LogicalUnit):
raise errors.OpPrereqError("Missing destination X509 CA",
errors.ECODE_INVAL)
if self.op.zero_free_space and not self.op.compress:
raise errors.OpPrereqError("Zeroing free space does not make sense "
"unless compression is used")
if self.op.zero_free_space and not self.op.shutdown:
raise errors.OpPrereqError("Unless the instance is shut down, zeroing "
"cannot be used.")
def ExpandNames(self):
self._ExpandAndLockInstance()
......
......@@ -776,6 +776,7 @@ $(genOpCode "OpCode"
, defaultField [| ExportModeLocal |] pExportMode
, pX509KeyName
, pX509DestCA
, pZeroFreeSpace
],
"instance_name")
, ("OpBackupRemove",
......
......@@ -218,6 +218,7 @@ module Ganeti.OpParams
, pIgnoreRemoveFailures
, pX509KeyName
, pX509DestCA
, pZeroFreeSpace
, pTagSearchPattern
, pRestrictedCommand
, pReplaceDisksMode
......@@ -1479,6 +1480,11 @@ pX509DestCA =
withDoc "Destination X509 CA (remote export only)" $
optionalNEStringField "destination_x509_ca"
pZeroFreeSpace :: Field
pZeroFreeSpace =
withDoc "Whether to zero the free space on the disks of the instance" $
defaultFalse "zero_free_space"
pTagsObject :: Field
pTagsObject =
withDoc "Tag kind" $
......
......@@ -400,7 +400,7 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpBackupExport <$> genFQDN <*> return Nothing <*>
arbitrary <*> arbitrary <*> arbitrary <*> return Nothing <*>
arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*>
genMaybe (pure []) <*> genMaybe genNameNE
genMaybe (pure []) <*> genMaybe genNameNE <*> arbitrary
"OP_BACKUP_REMOVE" ->
OpCodes.OpBackupRemove <$> genFQDN <*> return Nothing
"OP_TEST_ALLOCATOR" ->
......
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