Commit Graph
54 Commits
Author SHA1 Message Date
Lennart Poettering f820b27565 vmspawn: introduce --notify-ready= switch
This mimics the switch of the same name from nspawn: it controls whether
we expect a READY=1 message from the payload or not. Previously we'd
always expect that. This makes it configurable, just like it is in
nspawn.

There's one fundamental difference in behaviour though: in nspawn it
defaults to off, in vmspawn it defaults to on. (for historical reasons,
ideally we'd default to on in both cases, but changing is quite a compat
break both directly and indirectly: since timeouts might get triggered).
2025-07-11 18:17:04 +02:00
Lennart Poettering 0fc45c8d20 vmspawn: substantially beef up cgroup logic, to match more closely what nspawn does
This beefs up the cgroup logic, adding --slice=, --property= to vmspawn
the same way it already exists in nspawn.

There are a bunch of differences though: we don't delegate the cgroup
access in the allocated unit (since qemu wouldn't need that), and we do
registration via varlink not dbus. Hence, while this follows a similar
logic now, it differs in a lot of details.

This makes in particular one change: when invoked on the command line
we'll only add the qemu instance to the allocated scope, not the vmspawn
process itself (this follows more closely how nspawn does this where
only the container payload has its scope, not nspawn itself). This is
quite tricky to implement: unlike in nspawn we have auxiliary services
to start, with depencies to the scope. This means we need to start the
scope early, so that we know the scope's name. But the command line to
invoke is only assembled from the data we learn about the auxiliary
services, hence much later. To addres we'll now fork off the child that
eventually will become early, then move it to a scope, prepare the
cmdline and then very late send the cmdline (and the fds we want to
pass) to the prepared child, which then execs it.
2025-07-11 18:17:04 +02:00
Yu Watanabe 786f60eb5d man: fix typo
Follow-up for 6fd253753c.
2025-03-21 08:35:36 +09:00
Lennart Poettering 6fd253753c vmspawn: allow TPM state to be persistent + rework runtime dir logic
When using vmspawn on particleos image we really want that the TPM state
is retained between invocation, since the encryption key is locked to
the TPM after all. Hence let's support that.

This adds --tpm-state= which can be used to configure a path to store
the TPM state in. It can also be used to force tpm state to be transient
or to let vmpsawn pick the path automatically.

While we are at it, let's also revamp the runtime dir handling in
vmspawn: let's no longer place the sockets the auxiliary services listen
on within their own runtime directories. Instead, just drop the runtime
directories for them entirely (since neither virtiofsd, nor swtpm
actually use them). Also, let systemd clean up the sockets
automatically.
2025-03-20 14:30:00 +01:00
Lennart Poettering ef430b84e9 vmspawn: optionally grow image 2025-03-10 03:57:46 +09:00
Lennart Poettering 89cecfb100 vmspawn: add --smbios11= switch for passing arbitrary smbios type #11 strings to vm 2025-02-21 10:04:15 +01:00
Jan Engelhardt c592ebdf4f man: grammar fixes for introductory adverbs/phrases 2024-12-25 17:24:38 +01:00
Jan Engelhardt 44855c77a1 man: expand word contractions
For written text, contractions are not normally used.
2024-12-25 17:00:31 +01:00
Yu Watanabe 4ebbb5bfe8 man: asorted fixes
Closes #35307.
2024-11-24 01:11:42 +09:00
Zbigniew Jędrzejewski-Szmek fe45f8dc9b man: drop whitespace from final <programlisting> lines
In the troff output, this doesn't seem to make any difference. But in the
html output, the whitespace is sometimes preserved, creating an additional
gap before the following content. Drop it everywhere to avoid this.
2024-11-08 14:14:36 +01:00
Zbigniew Jędrzejewski-Szmek 56f9a56a6f man: update Fedora links to F41 2024-11-07 16:55:53 +01:00
Sam Leonard 5cd6605737 vmspawn,man: move the varlistentry for -D into a variablelist
This is so that systemd.directives picks up the -D argument as being
supported by vmspawn.
2024-05-02 19:31:42 +02:00
Sam Leonard 2068ef6804 man: vmspawn - clarify behaviour of omitting --linux=/--initrd= 2024-04-19 16:58:37 +01:00
Sam Leonard 9c50fd64b5 man: vmspawn - clarify behaviour of omitting --vsock-cid= 2024-04-19 16:56:13 +01:00
Sam Leonard dae32b1a2a man: removely overly verbose wording from the vmspawn man page 2024-04-19 16:42:13 +01:00
Sam Leonard 900d283ae0 man: vmspawn - reference later example to show use of --private-users 2024-04-19 16:42:13 +01:00
Sam Leonard 45ec09ba4b man: clarify behaviour when omitting both -i/-D in vmspawn 2024-04-19 16:42:13 +01:00
Sam Leonard e82d12a52f man: fix entry for vmspawn's --ssh-key-type 2024-04-19 16:38:49 +01:00
Sam Leonard 1490debd62 man: add ssh example for vmspawn 2024-04-19 16:38:49 +01:00
Sam Leonard b8db8e557b man: add example --forward-journal= example for vmspawn 2024-04-19 16:38:49 +01:00
Sam Leonard 0f37ff38a8 man: add machinectl import-raw example for vmspawn 2024-04-19 16:38:48 +01:00
Sam Leonard 9bfabe14e5 man: fix incorrect XML in man page 2024-04-15 10:40:11 +02:00
Kristian Klausen 254e1aa707 vmspawn: Fix incorrect/broken links in the man page 2024-04-15 14:33:33 +09:00
Sam Leonard edd85c8414 vmspawn: add --discard-disk= to control handling of disk discard requests
Fixes issue #32024, using --discard-disk=yes will enable handling of disk
discarding requests, saving space for long running VMs as desired.
2024-04-12 20:32:38 +02:00
Luca Boccassi 1b5f3f5662 Merge pull request #31670 from CodethinkLabs/vmspawn/generate_ssh_keys
vmspawn: generate ssh keys
2024-03-22 16:28:03 +00:00
cunshunxia cc59d1014f man: fix a few issues in manpage
fix: #31482

Signed-off-by: cunshunxia <cunshunxia@tencent.com>
2024-03-20 15:24:11 +01:00
Sam Leonard 2042aebb55 vmspawn: generate ephemeral SSH keys for the VM 2024-03-14 11:55:54 +00:00
Lennart Poettering fd571c9df0 man: document new importctl/importd functionality
This also replaces the Fedora download example with another one from
Ubuntu, since Fedora's images these days no longer qualify as DDIs, they
have no distinctive partition type UUIDs set for multiple of their
partitions, hence the images cannot be booted. A bit sad. Let's provide
a command that just works in its place.
2024-03-01 22:29:07 +01:00
Sam Leonard b0dc766852 vmspawn: support machined registration 2024-02-28 17:49:00 +00:00
Lennart Poettering 795ec90cda vmspawn: use our own ptyfwd code for the console of a VM
Let's make systemd-nspawn use our own ptyfwd logic to handle the TTY by
default.

This adds a new setting --console=, inspired by nspawn's setting of the
same name. If --console=interactive= is used, then we'll do the TTY
dance on our own via ptyfwd, and thus get tinting, our usual hotkey
handling and similar.

Since qemu's own console is useful too, let's keep it around via
--console=native.

FInally, replace the --qemu-gui switch by --console=gui.
2024-02-26 11:54:37 +01:00
Lennart Poettering 2c0061c784 vmspawn: rename "qemu" specific switches to not carry the "qemu" prefix
This renames a few of the switches vmspawn takes, such as --qemu-mem=
and --qemu-smp= to names without the "qemu" moniker and uses less
cryptic names (i.e. --ram= and --cpus=).

I think it's a bit unsystematic that so far we use the "qemu" prefix for
some options but not for others. At least I could not figure out a
system when we use it and when we don't. Hence let's clean it up and
just use simpler names without suffix.

After all we might want to plug other hypervisors behind vmspawn one
day, hence I think there's value in sticking to generic names for these
switches that allow us to switch out backends easily. In particular for
--ram= and --cpus= which are probably the most fundamental of VM settings
there are.

The old switches are support for compat, but not advertised in man page
or --help text anymore.

I left "--qemu-gui" under its current name, since it fundamentally is a
a qemu concept, exposing a qemu specific graphical UI.
2024-02-21 16:35:53 +01:00
Lennart Poettering cf9de8ef21 vspawn: prefer "VSOCK" spelling over "vsock" and "VSock"
The vsock(7) man page appears to prefer "VSOCK" spelling for the
concept, let's also use it as much as we can.
2024-02-21 16:18:24 +01:00
Sam Leonard 1ec3218e82 vmspawn: add --extra-drive= 2024-02-21 10:22:40 +00:00
Zbigniew Jędrzejewski-Szmek 9eb195701e man: reword paragraph about --forward-journal= and adjust spacing
The previous text did not look right when rendered.

The text is much easier to read when paragraphs are separated by an empty
line, latex-style.
2024-02-19 11:56:28 +01:00
Sam Leonard 258d26940f vmspawn: add --forward-journal= 2024-02-15 14:08:21 +00:00
Sam Leonard 811ad9e6b2 vmspawn: support multiple initrds via merging 2024-02-13 12:26:33 +00:00
Sam Leonard a8f940c4b5 vmspawn: add support for --bind(-ro)= 2024-02-12 09:46:02 +00:00
Sam Leonard 7fe9c9909d vmspawn: document --directory and --private-users 2024-02-12 09:46:01 +00:00
Sam Leonard 51747b3444 vmspawn: accept kvm/vhost-vsock device fds through sd_listen 2024-02-09 12:46:44 +00:00
Sam Leonard 75331bedeb vmspawn: add nic configuration 2024-02-09 12:46:43 +00:00
Sam Leonard 88af28d170 vmspawn: add initrd configuration option 2024-02-09 12:46:43 +00:00
Sam Leonard 0f25e3e443 vmspawn: add kernel configuration options 2024-02-09 11:43:19 +00:00
Sam Leonard cf3beb273b vmspawn: add swtpm feature 2024-02-09 11:43:18 +00:00
Sam Leonard a759d3239d vmspawn: fix incorrect mention of container 2024-02-08 16:04:42 +01:00
Sam Leonard 22ce047394 vmspawn: document -q/--quiet 2024-01-22 22:01:01 +00:00
Lennart Poettering e8ce204d86 vmspawn: rework firmware selection logic
Let's make the firmware file to choose configurable, and enumeratable.

This adds --firmware= to select the formare, and in particular
--firmware=list to show available options.
2024-01-22 16:24:00 +01:00
David Tardon eea10b26f7 man: use same version in public and system ident. 2023-12-25 15:51:47 +01:00
David Tardon 13a69c120b man: use <simplelist> for 'See also' sections
This is just a slight markup improvement; there should be no difference
in rendering.
2023-12-23 08:28:57 +01:00
Luca Boccassi b595fd62e4 man: correct version tags in systemd-vmspawn
We ended up merging some changes earlier

Fixes https://github.com/systemd/systemd/issues/30091
2023-11-21 09:01:40 +09:00
Sam Leonard 6b30cad5e9 vmspawn: update man page to include vsock options 2023-11-09 10:36:26 +00:00