Commit cfa8cbe5 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic

Add --zero-free-space option to gnt-backup export

This patch adds the option, allowing the CLI client to use the zeroing
option to save space when compressing images.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent e2cdecef
......@@ -229,6 +229,7 @@ __all__ = [
"WFSYNC_OPT",
"YES_DOIT_OPT",
"ZEROING_IMAGE_OPT",
"ZERO_FREE_SPACE_OPT",
"DISK_STATE_OPT",
"HV_STATE_OPT",
"IGNORE_IPOLICY_OPT",
......@@ -1741,6 +1742,12 @@ ZEROING_IMAGE_OPT = \
dest="zeroing_image", action="store", default=None,
help="The OS image to use to zero instance disks")
ZERO_FREE_SPACE_OPT = \
cli_option("--zero-free-space",
dest="zero_free_space", action="store_true", default=False,
help="Whether to zero the free space on the disks of the "
"instance prior to the export")
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
......
......@@ -96,7 +96,8 @@ def ExportInstance(opts, args):
shutdown=opts.shutdown,
shutdown_timeout=opts.shutdown_timeout,
remove_instance=opts.remove_instance,
ignore_remove_failures=ignore_remove_failures)
ignore_remove_failures=ignore_remove_failures,
zero_free_space=opts.zero_free_space)
SubmitOrSend(op, opts)
return 0
......@@ -152,7 +153,7 @@ commands = {
ExportInstance, ARGS_ONE_INSTANCE,
[FORCE_OPT, SINGLE_NODE_OPT, TRANSPORT_COMPRESSION_OPT, NOSHUTDOWN_OPT,
SHUTDOWN_TIMEOUT_OPT, REMOVE_INSTANCE_OPT, IGNORE_REMOVE_FAILURES_OPT,
DRY_RUN_OPT, PRIORITY_OPT] + SUBMIT_OPTS,
DRY_RUN_OPT, PRIORITY_OPT, ZERO_FREE_SPACE_OPT] + SUBMIT_OPTS,
"-n <target_node> [opts...] <name>",
"Exports an instance to an image"),
"import": (
......
......@@ -28,6 +28,7 @@ EXPORT
| [\--shutdown-timeout=*N*] [\--noshutdown] [\--remove-instance]
| [\--ignore-remove-failures] [\--submit] [\--print-job-id]
| [\--transport-compression=*compression-mode*]
| [\--zero-free-space]
| {*instance*}
Exports an instance to the target node. All the instance data and
......@@ -52,6 +53,10 @@ The ``--remove`` option can be used to remove the instance after it
was exported. This is useful to make one last backup before
removing the instance.
The ``--zero-free-space`` option can be used to zero the free space
of the instance prior to exporting it, saving space if compression
is used.
The exit code of the command is 0 if all disks were backed up
successfully, 1 if no data was backed up or if the configuration
export failed, and 2 if just some of the disks failed to backup.
......
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