From 1a0b17df32c7f8de692f7d30a753b7753f8eb0f8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 20 May 2026 15:45:57 +0200 Subject: [PATCH] vmspawn: move image related knobs close to --image= (Also, arrange the order if the image options group in the man page to the same as in the --help text) --- man/systemd-vmspawn.xml | 56 ++++++++++++++++++++--------------------- src/vmspawn/vmspawn.c | 34 ++++++++++++------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/man/systemd-vmspawn.xml b/man/systemd-vmspawn.xml index 20be0c099b..2c07bad93c 100644 --- a/man/systemd-vmspawn.xml +++ b/man/systemd-vmspawn.xml @@ -104,6 +104,18 @@ + + + + + If specified, the VM is run with a temporary snapshot of its file system that is removed + immediately when the VM terminates. Only works with currently. + + Note that will not work with . + + + + @@ -139,15 +151,25 @@ - - + - If specified, the VM is run with a temporary snapshot of its file system that is removed - immediately when the VM terminates. Only works with currently. + Controls whether qemu processes discard requests from the VM. + This prevents long running VMs from using more disk space than required. + This is enabled by default. - Note that will not work with . + + - + + + + + Grows the image file specified by to the specified size + in bytes if it is smaller. Executes no operation if no image file is used or the image file is + already as large or larger than requested. The specified size accepts the usual K, M, G suffixes + (to the base of 1024). Specified values are rounded up to multiples of 4096. + + @@ -363,16 +385,6 @@ - - - - Controls whether qemu processes discard requests from the VM. - This prevents long running VMs from using more disk space than required. - This is enabled by default. - - - - @@ -409,18 +421,6 @@ - - - - - Grows the image file specified by to the specified size - in bytes if it is smaller. Executes no operation if no image file is used or the image file is - already as large or larger than requested. The specified size accepts the usual K, M, G suffixes - (to the base of 1024). Specified values are rounded up to multiples of 4096. - - - - diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c index 6cb77dfadd..4ced5d6896 100644 --- a/src/vmspawn/vmspawn.c +++ b/src/vmspawn/vmspawn.c @@ -394,6 +394,23 @@ static int parse_argv(int argc, char *argv[]) { "Invalid image disk type: %s", opts.arg); break; + OPTION_LONG("discard-disk", "BOOL", "Control processing of discard requests"): + r = parse_boolean_argument("--discard-disk=", opts.arg, &arg_discard_disk); + if (r < 0) + return r; + break; + + OPTION('G', "grow-image", "BYTES", "Grow image file to specified size in bytes"): + if (isempty(opts.arg)) { + arg_grow_image = 0; + break; + } + + r = parse_size(opts.arg, 1024, &arg_grow_image); + if (r < 0) + return log_error_errno(r, "Failed to parse --grow-image= parameter: %s", opts.arg); + break; + OPTION_GROUP("Host Configuration"): {} OPTION_LONG("cpus", "CPUS", "Configure number of CPUs in guest"): {} @@ -646,23 +663,6 @@ static int parse_argv(int argc, char *argv[]) { break; } - OPTION_LONG("discard-disk", "BOOL", "Control processing of discard requests"): - r = parse_boolean_argument("--discard-disk=", opts.arg, &arg_discard_disk); - if (r < 0) - return r; - break; - - OPTION('G', "grow-image", "BYTES", "Grow image file to specified size in bytes"): - if (isempty(opts.arg)) { - arg_grow_image = 0; - break; - } - - r = parse_size(opts.arg, 1024, &arg_grow_image); - if (r < 0) - return log_error_errno(r, "Failed to parse --grow-image= parameter: %s", opts.arg); - break; - OPTION_GROUP("Execution"): {} OPTION('s', "smbios11", "STRING", "Pass an arbitrary SMBIOS Type #11 string to the VM"):