for k, v in finalize_credentials(config).items():
cmdline += [f"--set-credential={k}:{v}"]
+ cmdline += ["--register", yes_no(config.register)]
+
with contextlib.ExitStack() as stack:
# Make sure the latest nspawn settings are always used.
if config.nspawn_settings:
ephemeral: bool
credentials: dict[str, str]
kernel_command_line_extra: list[str]
+ register: bool
runtime_trees: list[ConfigTree]
runtime_size: Optional[int]
runtime_scratch: ConfigFeature
# arguments.
help=argparse.SUPPRESS,
),
+ ConfigSetting(
+ dest="register",
+ metavar="BOOL",
+ section="Runtime",
+ parse=config_parse_boolean,
+ default=True,
+ help="Register booted vm/container with systemd-machined",
+ ),
]
SETTINGS_LOOKUP_BY_NAME = {name: s for s in SETTINGS for name in [s.name, *s.compat_names]}
SETTINGS_LOOKUP_BY_DEST = {s.dest: s for s in SETTINGS}
SSH Certificate: {none_to_none(config.ssh_certificate)}
Machine: {config.machine_or_name()}
Forward Journal: {none_to_none(config.forward_journal)}
+ Register guest with machined: {yes_no(config.register)}
Virtual Machine Monitor: {config.vmm}
QEMU GUI: {yes_no(config.qemu_gui)}
def register_machine(config: Config, pid: int, fname: Path) -> None:
- if os.getuid() != 0 or (
- "DBUS_SYSTEM_ADDRESS" not in os.environ and not Path("/run/dbus/system_bus_socket").exists()
+ if (
+ not config.register
+ or os.getuid() != 0
+ or ("DBUS_SYSTEM_ADDRESS" not in os.environ and not Path("/run/dbus/system_bus_socket").exists())
):
return
Note that `Ephemeral=` has to be enabled to start multiple instances
of the same image.
+`Register=`, `--register=`
+: Takes a boolean value. Enabled by default. Specifies whether to register
+ the vm/container with systemd-machined.
+
`ForwardJournal=`, `--forward-journal=`
: Specify the path to which journal logs from containers and virtual
machines should be forwarded. If the path has the `.journal`
"--vsock", config.qemu_vsock.to_tristate(),
"--tpm", config.qemu_swtpm.to_tristate(),
"--secure-boot", yes_no(config.secure_boot),
+ "--register", yes_no(config.register),
] # fmt: skip
if config.runtime_network == Network.user:
"QemuSwtpm": "auto",
"QemuVsock": "enabled",
"QemuVsockConnectionId": -2,
+ "Register": true,
"Release": "53",
"RemoveFiles": [],
"RemovePackages": [
qemu_swtpm=ConfigFeature.auto,
qemu_vsock=ConfigFeature.enabled,
qemu_vsock_cid=QemuVsockCID.hash,
+ register=True,
release="53",
remove_files=[],
remove_packages=["all"],