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): ...@@ -421,7 +421,8 @@ class LUBackupExport(LogicalUnit):
raise errors.OpExecError("Could not start instance: %s" % msg) raise errors.OpExecError("Could not start instance: %s" % msg)
if self.op.mode == constants.EXPORT_MODE_LOCAL: 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: elif self.op.mode == constants.EXPORT_MODE_REMOTE:
connect_timeout = constants.RIE_CONNECT_TIMEOUT connect_timeout = constants.RIE_CONNECT_TIMEOUT
timeouts = masterd.instance.ImportExportTimeouts(connect_timeout) timeouts = masterd.instance.ImportExportTimeouts(connect_timeout)
......
...@@ -1218,11 +1218,13 @@ class ExportInstanceHelper: ...@@ -1218,11 +1218,13 @@ class ExportInstanceHelper:
else: else:
self._removed_snaps[disk_index] = True self._removed_snaps[disk_index] = True
def LocalExport(self, dest_node): def LocalExport(self, dest_node, compress):
"""Intra-cluster instance export. """Intra-cluster instance export.
@type dest_node: L{objects.Node} @type dest_node: L{objects.Node}
@param dest_node: Destination node @param dest_node: Destination node
@type compress: string
@param compress: one of L{constants.IEC_ALL}
""" """
instance = self._instance instance = self._instance
...@@ -1253,7 +1255,7 @@ class ExportInstanceHelper: ...@@ -1253,7 +1255,7 @@ class ExportInstanceHelper:
dresults = TransferInstanceData(self._lu, self._feedback_fn, dresults = TransferInstanceData(self._lu, self._feedback_fn,
src_node_uuid, dest_node.uuid, src_node_uuid, dest_node.uuid,
dest_node.secondary_ip, dest_node.secondary_ip,
constants.IEC_NONE, compress,
instance, transfers) instance, transfers)
assert len(dresults) == len(instance.disks) assert len(dresults) == len(instance.disks)
......
...@@ -777,6 +777,7 @@ $(genOpCode "OpCode" ...@@ -777,6 +777,7 @@ $(genOpCode "OpCode"
OpDoc.opBackupExport, OpDoc.opBackupExport,
[ pInstanceName [ pInstanceName
, pInstanceUuid , pInstanceUuid
, pBackupCompress
, pShutdownTimeout , pShutdownTimeout
, pExportTargetNode , pExportTargetNode
, pExportTargetNodeUuid , pExportTargetNodeUuid
......
...@@ -84,6 +84,7 @@ module Ganeti.OpParams ...@@ -84,6 +84,7 @@ module Ganeti.OpParams
, pMoveTargetNode , pMoveTargetNode
, pMoveTargetNodeUuid , pMoveTargetNodeUuid
, pMoveCompress , pMoveCompress
, pBackupCompress
, pStartupPaused , pStartupPaused
, pVerbose , pVerbose
, pDebugSimulateErrors , pDebugSimulateErrors
...@@ -1248,6 +1249,12 @@ pMoveCompress = ...@@ -1248,6 +1249,12 @@ pMoveCompress =
defaultField [| None |] $ defaultField [| None |] $
simpleField "compress" [t| ImportExportCompression |] 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 :: Field
pIgnoreDiskSize = pIgnoreDiskSize =
withDoc "Whether to ignore recorded disk size" $ withDoc "Whether to ignore recorded disk size" $
......
...@@ -330,9 +330,9 @@ instance Arbitrary OpCodes.OpCode where ...@@ -330,9 +330,9 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpBackupPrepare <$> genFQDN <*> return Nothing <*> arbitrary OpCodes.OpBackupPrepare <$> genFQDN <*> return Nothing <*> arbitrary
"OP_BACKUP_EXPORT" -> "OP_BACKUP_EXPORT" ->
OpCodes.OpBackupExport <$> genFQDN <*> return Nothing <*> OpCodes.OpBackupExport <$> genFQDN <*> return Nothing <*>
arbitrary <*> arbitrary <*> return Nothing <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> return Nothing <*>
arbitrary <*> arbitrary <*> arbitrary <*> genMaybe (pure []) <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*>
genMaybe genNameNE genMaybe (pure []) <*> genMaybe genNameNE
"OP_BACKUP_REMOVE" -> "OP_BACKUP_REMOVE" ->
OpCodes.OpBackupRemove <$> genFQDN <*> return Nothing OpCodes.OpBackupRemove <$> genFQDN <*> return Nothing
"OP_TEST_ALLOCATOR" -> "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