diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index b311f02da6b2a5c8341b1216182572b9612df371..6821cc4a2922b643757dd7fb335c56656c1cdcfd 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -126,6 +126,8 @@ module Libvirtd_qemu = let swtpm_entry = str_entry "swtpm_user" | str_entry "swtpm_group" + let capability_filters_entry = str_array_entry "capability_filters" + (* Each entry in the config is one of the following ... *) let entry = default_tls_entry | vnc_entry @@ -147,6 +149,7 @@ module Libvirtd_qemu = | vxhs_entry | nbd_entry | swtpm_entry + | capability_filters_entry let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ] let empty = [ label "#empty" . eol ] diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 5a85789d8132415ae52c8bafee19237efce1a360..1969b3f0a1d4b675a484c60bc2c2dc41ec02ba9f 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -825,3 +825,10 @@ # #swtpm_user = "tss" #swtpm_group = "tss" + +# For debugging and testing purposes it's sometimes useful to be able to disable +# libvirt behaviour based on the capabilities of the qemu process. This option +# allows to do so. DO _NOT_ use in production and beaware that the behaviour +# may change across versions. +# +#capability_filters = [ "capname" ] diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 745e0f21bd97ab1b4c90e6c9fbe2b25e8f9dc4e0..8312f99f80166160e2edc51573b96e48e490aa90 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -381,6 +381,8 @@ static void virQEMUDriverConfigDispose(void *obj) VIR_FREE(cfg->memoryBackingDir); VIR_FREE(cfg->swtpmStorageDir); + + virStringListFree(cfg->capabilityfilters); } @@ -984,6 +986,18 @@ virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg, } +static int +virQEMUDriverConfigLoadCapsFiltersEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueStringList(conf, "capability_filters", false, + &cfg->capabilityfilters) < 0) + return -1; + + return 0; +} + + int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, const char *filename, bool privileged) @@ -1053,6 +1067,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, if (virQEMUDriverConfigLoadSWTPMEntry(cfg, conf) < 0) goto cleanup; + if (virQEMUDriverConfigLoadCapsFiltersEntry(cfg, conf) < 0) + goto cleanup; + ret = 0; cleanup: diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index d638f1012d7afa8a3e56aecea89504d2cc771820..e51514a3441fe794ac03e187f7a3b2c7a48268a5 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -209,6 +209,8 @@ struct _virQEMUDriverConfig { uid_t swtpm_user; gid_t swtpm_group; + + char **capabilityfilters; }; /* Main driver state */ diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in index fea1d308b71935546614b872cd988a52a36ba5bc..50b728ad2281f73fa89768ecb518df66d9e56156 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -104,3 +104,6 @@ module Test_libvirtd_qemu = { "pr_helper" = "/usr/bin/qemu-pr-helper" } { "swtpm_user" = "tss" } { "swtpm_group" = "tss" } +{ "capability_filters" + { "1" = "capname" } +}