: When used with the `qemu` verb, this option specifies whether QEMU should use KVM acceleration. Takes a
boolean value or `auto`. Defaults to `auto`.
+`QemuVsock=`, `--qemu-vsock=`
+
+: When used with the `qemu` verb, this option specifies whether QEMU should be configured with a vsock. Takes
+ a boolean value or `auto`. Defaults to `auto`.
+
`QemuArgs=`
: Space-delimited list of additional arguments to pass when invoking
is_dnf_distribution,
prepend_to_environ_path,
qemu_check_kvm_support,
+ qemu_check_vsock_support,
)
__version__ = "14"
qemu_smp: str
qemu_mem: str
qemu_kvm: ConfigFeature
+ qemu_vsock: ConfigFeature
qemu_args: Sequence[str]
passphrase: Optional[Path]
section="Host",
parse=config_parse_feature,
),
+ MkosiConfigSetting(
+ dest="qemu_vsock",
+ section="Host",
+ parse=config_parse_feature,
+ ),
MkosiConfigSetting(
dest="qemu_args",
section="Host",
nargs="?",
action=action,
)
+ group.add_argument(
+ "--qemu-vsock",
+ metavar="FEATURE",
+ help="Configure whether to use qemu with a vsock or not",
+ nargs="?",
+ action=action,
+ )
group.add_argument(
"--qemu-args",
metavar="ARGS",
if args.qemu_kvm == ConfigFeature.enabled and not qemu_check_kvm_support():
die("Sorry, the host machine does not support KVM acceleration.")
+ if args.qemu_vsock == ConfigFeature.enabled and not qemu_check_vsock_support(log=False):
+ die("Sorry, the host machine does not support vsock")
+
if args.repositories and not (is_dnf_distribution(args.distribution) or is_apt_distribution(args.distribution)):
die("Sorry, the --repositories option is only supported on DNF/Debian based distributions")
"-nic", "user,model=virtio-net-pci",
]
- if qemu_check_vsock_support(log=True):
+ use_vsock = (config.qemu_vsock == ConfigFeature.enabled or
+ (config.qemu_vsock == ConfigFeature.auto and qemu_check_vsock_support(log=True)))
+ if use_vsock:
cmdline += ["-device", f"vhost-vsock-pci,guest-cid={machine_cid(config)}"]
cmdline += ["-cpu", "max"]
elif config.architecture == "aarch64":
cmdline += ["-device", "tpm-tis-device,tpmdev=tpm0"]
- addr, notifications = stack.enter_context(vsock_notify_handler())
- cmdline += ["-smbios", f"type=11,value=io.systemd.credential:vmm.notify_socket={addr}"]
+ if use_vsock:
+ addr, notifications = stack.enter_context(vsock_notify_handler())
+ cmdline += ["-smbios", f"type=11,value=io.systemd.credential:vmm.notify_socket={addr}"]
cmdline += config.qemu_args
cmdline += args.cmdline