diff --git a/man/systemd-vmspawn.xml b/man/systemd-vmspawn.xml index 20be0c099b..3a84196b62 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. + + @@ -270,59 +292,13 @@ - + - - Set the linux kernel image to use for direct kernel boot. - If a directory type image is used and was omitted, vmspawn will search for boot loader entries - according to the - UAPI.1 Boot Loader Specification assuming - XBOOTLDR to be located at /boot and ESP to be /efi respectively. - If no kernel was installed into the image then the image will fail to boot. - - - - - - - - - - Set the initrd to use for direct kernel boot. - If the supplied is a - UAPI.1 Boot Loader Specification - Type #2 entry, then this argument is not required. - If no initrd was installed into the image then the image will fail to boot. - - can be specified multiple times and vmspawn will merge them together. - - - - - - - - - - - Create a TAP device to network with the virtual machine. - - Note: root privileges are required to use TAP networking. - Additionally, - systemd-networkd8 - must be running and correctly set up on the host to provision the host interface. The relevant - .network file can be found at - /usr/lib/systemd/network/80-vm-vt.network. - - - - - - - - - - Use user mode networking. + Configure whether to search for firmware which supports Secure Boot. Takes a + boolean or auto. Setting this to yes is equivalent to + and setting this to no is equivalent to + . Setting this to auto + removes secure-boot from both the included and excluded feature lists. @@ -363,28 +339,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. - - - - - - - - Configure whether to search for firmware which supports Secure Boot. Takes a - boolean or auto. Setting this to yes is equivalent to - and setting this to no is equivalent to - . Setting this to auto - removes secure-boot from both the included and excluded feature lists. - - - - @@ -408,17 +362,75 @@ + + + + + Networking Options + + + + + + + + Create a TAP device to network with the virtual machine. + + Note: root privileges are required to use TAP networking. + Additionally, + systemd-networkd8 + must be running and correctly set up on the host to provision the host interface. The relevant + .network file can be found at + /usr/lib/systemd/network/80-vm-vt.network. + + + + + - - + - 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. + Use user mode networking. - + + + + + + + Execution Options + + + + + + + Set the linux kernel image to use for direct kernel boot. + If a directory type image is used and was omitted, vmspawn will search for boot loader entries + according to the + UAPI.1 Boot Loader Specification assuming + XBOOTLDR to be located at /boot and ESP to be /efi respectively. + If no kernel was installed into the image then the image will fail to boot. + + + + + + + + + + Set the initrd to use for direct kernel boot. + If the supplied is a + UAPI.1 Boot Loader Specification + Type #2 entry, then this argument is not required. + If no initrd was installed into the image then the image will fail to boot. + + can be specified multiple times and vmspawn will merge them together. + + + @@ -708,7 +720,7 @@ - Integration Options + Logging Options @@ -740,6 +752,13 @@ + + + + + SSH Options + + diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c index 6cb77dfadd..0797676bf9 100644 --- a/src/vmspawn/vmspawn.c +++ b/src/vmspawn/vmspawn.c @@ -232,12 +232,14 @@ static int help(void) { NULL, "Image", "Host Configuration", + "Networking", "Execution", "System Identity", "Properties", "User Namespacing", "Mounts", - "Integration", + "Logging", + "SSH", "Input/Output", "Credentials", }; @@ -251,8 +253,10 @@ static int help(void) { return r; } - (void) table_sync_column_widths(0, tables[0], tables[1], tables[2], tables[3], tables[4], - tables[5], tables[6], tables[7], tables[8], tables[9], tables[10]); + (void) table_sync_column_widths( + 0, tables[0], tables[1], tables[2], tables[3], tables[4], + tables[5], tables[6], tables[7], tables[8], tables[9], tables[10], + tables[11], tables[12]); help_cmdline("[OPTIONS...] [ARGUMENTS...]"); help_abstract("Spawn a command or OS in a virtual machine."); @@ -394,6 +398,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"): {} @@ -502,32 +523,6 @@ static int parse_argv(int argc, char *argv[]) { arg_efi_nvram_state_mode = STATE_PATH; break; - OPTION_LONG("linux", "PATH", "Specify the linux kernel for direct kernel boot"): - r = parse_path_argument(opts.arg, /* suppress_root= */ false, &arg_linux); - if (r < 0) - return r; - break; - - OPTION_LONG("initrd", "PATH", "Specify the initrd for direct kernel boot"): { - _cleanup_free_ char *initrd_path = NULL; - r = parse_path_argument(opts.arg, /* suppress_root= */ false, &initrd_path); - if (r < 0) - return r; - - r = strv_consume(&arg_initrds, TAKE_PTR(initrd_path)); - if (r < 0) - return log_oom(); - break; - } - - OPTION('n', "network-tap", NULL, "Create a TAP device for networking"): - arg_network_stack = NETWORK_STACK_TAP; - break; - - OPTION_LONG("network-user-mode", NULL, "Use user mode networking"): - arg_network_stack = NETWORK_STACK_USER; - break; - OPTION_LONG("secure-boot", "BOOL|auto", "Enable searching for firmware supporting SecureBoot"): { int b; @@ -646,24 +641,35 @@ 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); + OPTION_GROUP("Networking"): {} + + OPTION('n', "network-tap", NULL, "Create a TAP device for networking"): + arg_network_stack = NETWORK_STACK_TAP; + break; + + OPTION_LONG("network-user-mode", NULL, "Use user mode networking"): + arg_network_stack = NETWORK_STACK_USER; + break; + + OPTION_GROUP("Execution"): {} + + OPTION_LONG("linux", "PATH", "Specify the linux kernel for direct kernel boot"): + r = parse_path_argument(opts.arg, /* suppress_root= */ false, &arg_linux); 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); + OPTION_LONG("initrd", "PATH", "Specify the initrd for direct kernel boot"): { + _cleanup_free_ char *initrd_path = NULL; + r = parse_path_argument(opts.arg, /* suppress_root= */ false, &initrd_path); if (r < 0) - return log_error_errno(r, "Failed to parse --grow-image= parameter: %s", opts.arg); - break; + return r; - OPTION_GROUP("Execution"): {} + r = strv_consume(&arg_initrds, TAKE_PTR(initrd_path)); + if (r < 0) + return log_oom(); + break; + } OPTION('s', "smbios11", "STRING", "Pass an arbitrary SMBIOS Type #11 string to the VM"): if (isempty(opts.arg)) { @@ -839,7 +845,7 @@ static int parse_argv(int argc, char *argv[]) { return log_oom(); break; - OPTION_GROUP("Integration"): {} + OPTION_GROUP("Logging"): {} OPTION_LONG("forward-journal", "FILE|DIR", "Forward the VM's journal to the host"): r = parse_path_argument(opts.arg, /* suppress_root= */ false, &arg_forward_journal); @@ -871,6 +877,8 @@ static int parse_argv(int argc, char *argv[]) { return log_error_errno(r, "Failed to parse --forward-journal-max-files= value: %s", opts.arg); break; + OPTION_GROUP("SSH"): {} + OPTION_LONG("pass-ssh-key", "BOOL", "Create an SSH key to access the VM"): r = parse_boolean_argument("--pass-ssh-key=", opts.arg, &arg_pass_ssh_key); if (r < 0)