]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vmspawn: move image related knobs close to --image=
authorLennart Poettering <lennart@amutable.com>
Wed, 20 May 2026 13:45:57 +0000 (15:45 +0200)
committerLennart Poettering <lennart@amutable.com>
Wed, 20 May 2026 21:37:31 +0000 (23:37 +0200)
(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
src/vmspawn/vmspawn.c

index 20be0c099b16d69aae7c7bc23278e8d097c79d61..2c07bad93c2dcd1841bfde173fb8b210160d1926 100644 (file)
           </listitem>
         </varlistentry>
 
+        <varlistentry>
+          <term><option>-x</option></term>
+          <term><option>--ephemeral</option></term>
+
+          <listitem><para>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 <option>--image=</option> currently.
+
+          Note that <option>--ephemeral</option> will not work with <option>--extra-drive=</option>.</para>
+
+          <xi:include href="version-info.xml" xpointer="v260"/></listitem>
+        </varlistentry>
+
         <varlistentry>
           <term><option>-i</option></term>
           <term><option>--image=</option></term>
         </varlistentry>
 
         <varlistentry>
-          <term><option>-x</option></term>
-          <term><option>--ephemeral</option></term>
+          <term><option>--discard-disk=<replaceable>BOOL</replaceable></option></term>
 
-          <listitem><para>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 <option>--image=</option> currently.
+          <listitem><para>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.</para>
 
-          Note that <option>--ephemeral</option> will not work with <option>--extra-drive=</option>.</para>
+          <xi:include href="version-info.xml" xpointer="v256"/></listitem>
+        </varlistentry>
 
-          <xi:include href="version-info.xml" xpointer="v260"/></listitem>
+        <varlistentry>
+          <term><option>--grow-image=<replaceable>BYTES</replaceable></option></term>
+          <term><option>-G <replaceable>BYTES</replaceable></option></term>
+
+          <listitem><para>Grows the image file specified by <option>--image=</option> 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.</para>
+
+          <xi:include href="version-info.xml" xpointer="v258"/></listitem>
         </varlistentry>
       </variablelist>
     </refsect2>
           <xi:include href="version-info.xml" xpointer="v261"/></listitem>
         </varlistentry>
 
-        <varlistentry>
-          <term><option>--discard-disk=<replaceable>BOOL</replaceable></option></term>
-
-          <listitem><para>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.</para>
-
-          <xi:include href="version-info.xml" xpointer="v256"/></listitem>
-        </varlistentry>
-
         <varlistentry>
           <term><option>--secure-boot=<replaceable>BOOL</replaceable></option></term>
 
           <xi:include href="version-info.xml" xpointer="v261"/></listitem>
         </varlistentry>
 
-        <varlistentry>
-          <term><option>--grow-image=<replaceable>BYTES</replaceable></option></term>
-          <term><option>-G <replaceable>BYTES</replaceable></option></term>
-
-          <listitem><para>Grows the image file specified by <option>--image=</option> 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.</para>
-
-          <xi:include href="version-info.xml" xpointer="v258"/></listitem>
-        </varlistentry>
-
         <varlistentry>
           <term><option>--smbios11=<replaceable>STRING</replaceable></option></term>
           <term><option>-s <replaceable>STRING</replaceable></option></term>
index 6cb77dfadd920a00f4e54697e844425ae2659ad8..4ced5d6896a76c352d188894867f8f83c363fc75 100644 (file)
@@ -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"):