Commit 896cc964 authored by Thomas Thrainer's avatar Thomas Thrainer
Browse files

Add local compression to OpBackupExport



OpBackupExport is extended by a compress parameter. This parameter
(either 'none' or 'gzip') controls if instance disks are compressed
before being sent over the network to the destination node.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 94ab995a
......@@ -421,7 +421,8 @@ class LUBackupExport(LogicalUnit):
raise errors.OpExecError("Could not start instance: %s" % msg)
if self.op.mode == constants.EXPORT_MODE_LOCAL:
(fin_resu, dresults) = helper.LocalExport(self.dst_node)
(fin_resu, dresults) = helper.LocalExport(self.dst_node,
self.op.compress)
elif self.op.mode == constants.EXPORT_MODE_REMOTE:
connect_timeout = constants.RIE_CONNECT_TIMEOUT
timeouts = masterd.instance.ImportExportTimeouts(connect_timeout)
......
......@@ -1218,11 +1218,13 @@ class ExportInstanceHelper:
else:
self._removed_snaps[disk_index] = True
def LocalExport(self, dest_node):
def LocalExport(self, dest_node, compress):
"""Intra-cluster instance export.
@type dest_node: L{objects.Node}
@param dest_node: Destination node
@type compress: string
@param compress: one of L{constants.IEC_ALL}
"""
instance = self._instance
......@@ -1253,7 +1255,7 @@ class ExportInstanceHelper:
dresults = TransferInstanceData(self._lu, self._feedback_fn,
src_node_uuid, dest_node.uuid,
dest_node.secondary_ip,
constants.IEC_NONE,
compress,
instance, transfers)
assert len(dresults) == len(instance.disks)
......
......@@ -777,6 +777,7 @@ $(genOpCode "OpCode"
OpDoc.opBackupExport,
[ pInstanceName
, pInstanceUuid
, pBackupCompress
, pShutdownTimeout
, pExportTargetNode
, pExportTargetNodeUuid
......
......@@ -84,6 +84,7 @@ module Ganeti.OpParams
, pMoveTargetNode
, pMoveTargetNodeUuid
, pMoveCompress
, pBackupCompress
, pStartupPaused
, pVerbose
, pDebugSimulateErrors
......@@ -1248,6 +1249,12 @@ pMoveCompress =
defaultField [| None |] $
simpleField "compress" [t| ImportExportCompression |]
pBackupCompress :: Field
pBackupCompress =
withDoc "Compression mode to use for moves during backups" .
defaultField [| None |] $
simpleField "compress" [t| ImportExportCompression |]
pIgnoreDiskSize :: Field
pIgnoreDiskSize =
withDoc "Whether to ignore recorded disk size" $
......
......@@ -330,9 +330,9 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpBackupPrepare <$> genFQDN <*> return Nothing <*> arbitrary
"OP_BACKUP_EXPORT" ->
OpCodes.OpBackupExport <$> genFQDN <*> return Nothing <*>
arbitrary <*> arbitrary <*> return Nothing <*> arbitrary <*>
arbitrary <*> arbitrary <*> arbitrary <*> genMaybe (pure []) <*>
genMaybe genNameNE
arbitrary <*> arbitrary <*> arbitrary <*> return Nothing <*>
arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*>
genMaybe (pure []) <*> genMaybe genNameNE
"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