[libvirt PATCH v2] schemas: move out of docs, fix no-docs build
by Claudio Fontana
schemas are used for more than just documentation,
virsh edit fails if schemas are not available.
Therefore, fix the no-docs build by moving schemas/
to the parsing code inside src/conf/.
Signed-off-by: Claudio Fontana <cfontana(a)suse.de>
---
changes v1 -> v2:
* move to src/conf/ instead of top_srcdir (Daniel)
* meson, rename docs_schema_files to just schema_files (Daniel)
* tests/virschematest.c: adapt (Andrea)
* src/util/virxml.c: adapt (Andrea)
* src/conf/cpu_conf.c: adapt (Andrea)
* docs/api_extension.rst: adapt one additional reference
docs/api_extension.rst | 2 +-
docs/meson.build | 2 --
src/conf/cpu_conf.c | 2 +-
src/conf/meson.build | 2 ++
{docs => src/conf}/schemas/basictypes.rng | 0
{docs => src/conf}/schemas/capability.rng | 0
{docs => src/conf}/schemas/cpu.rng | 0
{docs => src/conf}/schemas/cputypes.rng | 0
{docs => src/conf}/schemas/domain.rng | 0
{docs => src/conf}/schemas/domainbackup.rng | 0
{docs => src/conf}/schemas/domaincaps.rng | 0
.../conf}/schemas/domaincheckpoint.rng | 0
{docs => src/conf}/schemas/domaincommon.rng | 0
{docs => src/conf}/schemas/domainsnapshot.rng | 0
{docs => src/conf}/schemas/interface.rng | 0
{docs => src/conf}/schemas/meson.build | 4 +--
{docs => src/conf}/schemas/network.rng | 0
{docs => src/conf}/schemas/networkcommon.rng | 0
{docs => src/conf}/schemas/networkport.rng | 0
{docs => src/conf}/schemas/nodedev.rng | 0
{docs => src/conf}/schemas/nwfilter.rng | 0
.../conf}/schemas/nwfilter_params.rng | 0
.../conf}/schemas/nwfilterbinding.rng | 0
{docs => src/conf}/schemas/secret.rng | 0
{docs => src/conf}/schemas/storagecommon.rng | 0
{docs => src/conf}/schemas/storagepool.rng | 0
.../conf}/schemas/storagepoolcaps.rng | 0
{docs => src/conf}/schemas/storagevol.rng | 0
src/util/virxml.c | 2 +-
tests/virschematest.c | 36 ++++++++++---------
30 files changed, 26 insertions(+), 24 deletions(-)
rename {docs => src/conf}/schemas/basictypes.rng (100%)
rename {docs => src/conf}/schemas/capability.rng (100%)
rename {docs => src/conf}/schemas/cpu.rng (100%)
rename {docs => src/conf}/schemas/cputypes.rng (100%)
rename {docs => src/conf}/schemas/domain.rng (100%)
rename {docs => src/conf}/schemas/domainbackup.rng (100%)
rename {docs => src/conf}/schemas/domaincaps.rng (100%)
rename {docs => src/conf}/schemas/domaincheckpoint.rng (100%)
rename {docs => src/conf}/schemas/domaincommon.rng (100%)
rename {docs => src/conf}/schemas/domainsnapshot.rng (100%)
rename {docs => src/conf}/schemas/interface.rng (100%)
rename {docs => src/conf}/schemas/meson.build (83%)
rename {docs => src/conf}/schemas/network.rng (100%)
rename {docs => src/conf}/schemas/networkcommon.rng (100%)
rename {docs => src/conf}/schemas/networkport.rng (100%)
rename {docs => src/conf}/schemas/nodedev.rng (100%)
rename {docs => src/conf}/schemas/nwfilter.rng (100%)
rename {docs => src/conf}/schemas/nwfilter_params.rng (100%)
rename {docs => src/conf}/schemas/nwfilterbinding.rng (100%)
rename {docs => src/conf}/schemas/secret.rng (100%)
rename {docs => src/conf}/schemas/storagecommon.rng (100%)
rename {docs => src/conf}/schemas/storagepool.rng (100%)
rename {docs => src/conf}/schemas/storagepoolcaps.rng (100%)
rename {docs => src/conf}/schemas/storagevol.rng (100%)
diff --git a/docs/api_extension.rst b/docs/api_extension.rst
index 16d4b0a005..d70c244fd4 100644
--- a/docs/api_extension.rst
+++ b/docs/api_extension.rst
@@ -73,7 +73,7 @@ The first task is to define the public API. If the new API involves an
XML extension, you have to enhance the RelaxNG schema and document the
new elements or attributes:
-``docs/schemas/domaincommon.rng docs/formatdomain.html.in``
+``src/conf/schemas/domaincommon.rng docs/formatdomain.html.in``
If the API extension involves a new function, you have to add a
declaration in the public header, and arrange to export the function
diff --git a/docs/meson.build b/docs/meson.build
index 868267b764..7aebe08047 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -334,8 +334,6 @@ subdir('js')
subdir('kbase')
subdir('logos')
subdir('manpages')
-subdir('schemas')
-
foreach file : docs_assets
# This hack enables us to view the web pages
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 819efcea8c..2d447da7c3 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -345,7 +345,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
g_autofree char *schemafile = NULL;
if (!(schemafile = virFileFindResource("cpu.rng",
- abs_top_srcdir "/docs/schemas",
+ abs_top_srcdir "/src/conf/schemas",
PKGDATADIR "/schemas")))
return -1;
diff --git a/src/conf/meson.build b/src/conf/meson.build
index bd35d87e0a..82d265e975 100644
--- a/src/conf/meson.build
+++ b/src/conf/meson.build
@@ -111,3 +111,5 @@ virt_conf_lib = static_library(
libvirt_libs += virt_conf_lib
conf_inc_dir = include_directories('.')
+
+subdir('schemas')
diff --git a/docs/schemas/basictypes.rng b/src/conf/schemas/basictypes.rng
similarity index 100%
rename from docs/schemas/basictypes.rng
rename to src/conf/schemas/basictypes.rng
diff --git a/docs/schemas/capability.rng b/src/conf/schemas/capability.rng
similarity index 100%
rename from docs/schemas/capability.rng
rename to src/conf/schemas/capability.rng
diff --git a/docs/schemas/cpu.rng b/src/conf/schemas/cpu.rng
similarity index 100%
rename from docs/schemas/cpu.rng
rename to src/conf/schemas/cpu.rng
diff --git a/docs/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng
similarity index 100%
rename from docs/schemas/cputypes.rng
rename to src/conf/schemas/cputypes.rng
diff --git a/docs/schemas/domain.rng b/src/conf/schemas/domain.rng
similarity index 100%
rename from docs/schemas/domain.rng
rename to src/conf/schemas/domain.rng
diff --git a/docs/schemas/domainbackup.rng b/src/conf/schemas/domainbackup.rng
similarity index 100%
rename from docs/schemas/domainbackup.rng
rename to src/conf/schemas/domainbackup.rng
diff --git a/docs/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng
similarity index 100%
rename from docs/schemas/domaincaps.rng
rename to src/conf/schemas/domaincaps.rng
diff --git a/docs/schemas/domaincheckpoint.rng b/src/conf/schemas/domaincheckpoint.rng
similarity index 100%
rename from docs/schemas/domaincheckpoint.rng
rename to src/conf/schemas/domaincheckpoint.rng
diff --git a/docs/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
similarity index 100%
rename from docs/schemas/domaincommon.rng
rename to src/conf/schemas/domaincommon.rng
diff --git a/docs/schemas/domainsnapshot.rng b/src/conf/schemas/domainsnapshot.rng
similarity index 100%
rename from docs/schemas/domainsnapshot.rng
rename to src/conf/schemas/domainsnapshot.rng
diff --git a/docs/schemas/interface.rng b/src/conf/schemas/interface.rng
similarity index 100%
rename from docs/schemas/interface.rng
rename to src/conf/schemas/interface.rng
diff --git a/docs/schemas/meson.build b/src/conf/schemas/meson.build
similarity index 83%
rename from docs/schemas/meson.build
rename to src/conf/schemas/meson.build
index bb6a48787f..700161bf75 100644
--- a/docs/schemas/meson.build
+++ b/src/conf/schemas/meson.build
@@ -1,4 +1,4 @@
-docs_schema_files = [
+schema_files = [
'basictypes.rng',
'capability.rng',
'cpu.rng',
@@ -24,4 +24,4 @@ docs_schema_files = [
'storagevol.rng',
]
-install_data(docs_schema_files, install_dir: pkgdatadir / 'schemas')
+install_data(schema_files, install_dir: pkgdatadir / 'schemas')
diff --git a/docs/schemas/network.rng b/src/conf/schemas/network.rng
similarity index 100%
rename from docs/schemas/network.rng
rename to src/conf/schemas/network.rng
diff --git a/docs/schemas/networkcommon.rng b/src/conf/schemas/networkcommon.rng
similarity index 100%
rename from docs/schemas/networkcommon.rng
rename to src/conf/schemas/networkcommon.rng
diff --git a/docs/schemas/networkport.rng b/src/conf/schemas/networkport.rng
similarity index 100%
rename from docs/schemas/networkport.rng
rename to src/conf/schemas/networkport.rng
diff --git a/docs/schemas/nodedev.rng b/src/conf/schemas/nodedev.rng
similarity index 100%
rename from docs/schemas/nodedev.rng
rename to src/conf/schemas/nodedev.rng
diff --git a/docs/schemas/nwfilter.rng b/src/conf/schemas/nwfilter.rng
similarity index 100%
rename from docs/schemas/nwfilter.rng
rename to src/conf/schemas/nwfilter.rng
diff --git a/docs/schemas/nwfilter_params.rng b/src/conf/schemas/nwfilter_params.rng
similarity index 100%
rename from docs/schemas/nwfilter_params.rng
rename to src/conf/schemas/nwfilter_params.rng
diff --git a/docs/schemas/nwfilterbinding.rng b/src/conf/schemas/nwfilterbinding.rng
similarity index 100%
rename from docs/schemas/nwfilterbinding.rng
rename to src/conf/schemas/nwfilterbinding.rng
diff --git a/docs/schemas/secret.rng b/src/conf/schemas/secret.rng
similarity index 100%
rename from docs/schemas/secret.rng
rename to src/conf/schemas/secret.rng
diff --git a/docs/schemas/storagecommon.rng b/src/conf/schemas/storagecommon.rng
similarity index 100%
rename from docs/schemas/storagecommon.rng
rename to src/conf/schemas/storagecommon.rng
diff --git a/docs/schemas/storagepool.rng b/src/conf/schemas/storagepool.rng
similarity index 100%
rename from docs/schemas/storagepool.rng
rename to src/conf/schemas/storagepool.rng
diff --git a/docs/schemas/storagepoolcaps.rng b/src/conf/schemas/storagepoolcaps.rng
similarity index 100%
rename from docs/schemas/storagepoolcaps.rng
rename to src/conf/schemas/storagepoolcaps.rng
diff --git a/docs/schemas/storagevol.rng b/src/conf/schemas/storagevol.rng
similarity index 100%
rename from docs/schemas/storagevol.rng
rename to src/conf/schemas/storagevol.rng
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 268aad1d20..8ff59e7cda 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1099,7 +1099,7 @@ virXMLParseHelper(int domcode,
if (validate && schemafile != NULL) {
g_autofree char *schema = virFileFindResource(schemafile,
- abs_top_srcdir "/docs/schemas",
+ abs_top_srcdir "/src/conf/schemas",
PKGDATADIR "/schemas");
if (!schema ||
(virXMLValidateAgainstSchema(schema, xml) < 0))
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 4e657159e1..29a5546418 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -336,27 +336,29 @@ mymain(void)
{
int ret = 0;
+#define SCHEMAS_PATH "src/conf/schemas/"
+
#define DO_TEST(sch, ent) \
if (testSchemaEntries((sch), (ent), G_N_ELEMENTS(ent)) < 0) \
ret = -1;
- DO_TEST("docs/schemas/capability.rng", schemaCapability);
- DO_TEST("docs/schemas/domain.rng", schemaDomain);
- DO_TEST("docs/schemas/domaincaps.rng", schemaDomainCaps);
- DO_TEST("docs/schemas/domainbackup.rng", schemaDomainBackup);
- DO_TEST("docs/schemas/domaincheckpoint.rng", schemaDomainCheckpoint);
- DO_TEST("docs/schemas/domainsnapshot.rng", schemaDomainSnapshot);
- DO_TEST("docs/schemas/interface.rng", schemaInterface);
- DO_TEST("docs/schemas/network.rng", schemaNetwork);
- DO_TEST("docs/schemas/networkport.rng", schemaNetworkport);
- DO_TEST("docs/schemas/nodedev.rng", schemaNodedev);
- DO_TEST("docs/schemas/nwfilter.rng", schemaNwfilter);
- DO_TEST("docs/schemas/nwfilterbinding.rng", schemaNwfilterbinding);
- DO_TEST("docs/schemas/secret.rng", schemaSecret);
- DO_TEST("docs/schemas/storagepoolcaps.rng", schemaStoragepoolcaps);
- DO_TEST("docs/schemas/storagepool.rng", schemaStoragePool);
- DO_TEST("docs/schemas/storagevol.rng", schemaStorageVol);
- DO_TEST("docs/schemas/cpu.rng", schemaCpu);
+ DO_TEST(SCHEMAS_PATH "capability.rng", schemaCapability);
+ DO_TEST(SCHEMAS_PATH "domain.rng", schemaDomain);
+ DO_TEST(SCHEMAS_PATH "domaincaps.rng", schemaDomainCaps);
+ DO_TEST(SCHEMAS_PATH "domainbackup.rng", schemaDomainBackup);
+ DO_TEST(SCHEMAS_PATH "domaincheckpoint.rng", schemaDomainCheckpoint);
+ DO_TEST(SCHEMAS_PATH "domainsnapshot.rng", schemaDomainSnapshot);
+ DO_TEST(SCHEMAS_PATH "interface.rng", schemaInterface);
+ DO_TEST(SCHEMAS_PATH "network.rng", schemaNetwork);
+ DO_TEST(SCHEMAS_PATH "networkport.rng", schemaNetworkport);
+ DO_TEST(SCHEMAS_PATH "nodedev.rng", schemaNodedev);
+ DO_TEST(SCHEMAS_PATH "nwfilter.rng", schemaNwfilter);
+ DO_TEST(SCHEMAS_PATH "nwfilterbinding.rng", schemaNwfilterbinding);
+ DO_TEST(SCHEMAS_PATH "secret.rng", schemaSecret);
+ DO_TEST(SCHEMAS_PATH "storagepoolcaps.rng", schemaStoragepoolcaps);
+ DO_TEST(SCHEMAS_PATH "storagepool.rng", schemaStoragePool);
+ DO_TEST(SCHEMAS_PATH "storagevol.rng", schemaStorageVol);
+ DO_TEST(SCHEMAS_PATH "cpu.rng", schemaCpu);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.35.1
3 years
[PATCH] qemu_tpm: Do async IO when starting swtpm emulator
by Michal Privoznik
When vTPM is secured via virSecret libvirt passes the secret
value via an FD when swtpm is started (arguments --key and
--migration-key). The writing of the secret into the FDs is
handled via virCommand, specifically qemu_tpm calls
virCommandSetSendBuffer()) and then virCommandRunAsync() spawns a
thread to handle writing into the FD via
virCommandDoAsyncIOHelper. But the thread is not created unless
VIR_EXEC_ASYNC_IO flag is set, which it isn't. In order to fix
it, virCommandDoAsyncIO() must be called.
The credit goes to Marc-André Lureau
<marcandre.lureau(a)redhat.com> who has done all the debugging and
proposed fix in the bugzilla.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2064115
Fixes: a9c500d2b50c5c041a1bb6ae9724402cf1cec8fe
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_tpm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 50f9caabf3..56bccee128 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -899,6 +899,7 @@ qemuTPMEmulatorStart(virQEMUDriver *driver,
if (!(pidfile = qemuTPMEmulatorPidFileBuildPath(cfg->swtpmStateDir, shortName)))
return -1;
+ virCommandDoAsyncIO(cmd);
virCommandDaemonize(cmd);
virCommandSetPidFile(cmd, pidfile);
virCommandSetErrorFD(cmd, &errfd);
--
2.34.1
3 years
[PATCH 0/7] qemu: Add qemu-namespace XML to override device properties (-set replacement)
by Peter Krempa
The use of '-set' via the qemu argument passthrough broke when we
switched to using JSON with -device.
Provide a replacement using the qemu namespace XML elements.
Peter Krempa (7):
qemuDomainDefNamespaceFormatXML*: Convert to virXMLFormatElement
docs: drvqemu: Document overriding of device properties
qemu: domain: Add XML namespace code for overriding device config
conf: Introduce VIR_DOMAIN_TAINT_CUSTOM_DEVICE and use it in qemu
qemuBuildDeviceCommandlineFromJSON: Pass 'virDomainDef' into the
function
qemu: command: Override device definition according to the namespace
config
NEWS: Mention the qemu device property override feature
NEWS.rst | 7 +
docs/drvqemu.rst | 52 ++++
docs/schemas/domaincommon.rng | 32 +++
src/conf/domain_conf.c | 2 +
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 133 ++++++----
src/qemu/qemu_domain.c | 241 ++++++++++++++++--
src/qemu/qemu_domain.h | 33 +++
.../qemu-ns.x86_64-4.0.0.args | 2 +-
.../qemu-ns.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/qemu-ns.xml | 12 +
.../qemu-ns.x86_64-latest.xml | 12 +
12 files changed, 457 insertions(+), 72 deletions(-)
--
2.35.1
3 years
[libvirt PATCH] schemas: move out of docs, fix no-docs build
by root
From: Claudio Fontana <cfontana(a)suse.de>
schemas are used for more than just documentation,
virsh edit fails if schemas are not available.
Therefore, fix the no-docs build by moving schemas
to the top source directory.
Signed-off-by: Claudio Fontana <cfontana(a)suse.de>
---
docs/meson.build | 2 --
meson.build | 2 ++
{docs/schemas => schemas}/basictypes.rng | 0
{docs/schemas => schemas}/capability.rng | 0
{docs/schemas => schemas}/cpu.rng | 0
{docs/schemas => schemas}/cputypes.rng | 0
{docs/schemas => schemas}/domain.rng | 0
{docs/schemas => schemas}/domainbackup.rng | 0
{docs/schemas => schemas}/domaincaps.rng | 0
{docs/schemas => schemas}/domaincheckpoint.rng | 0
{docs/schemas => schemas}/domaincommon.rng | 0
{docs/schemas => schemas}/domainsnapshot.rng | 0
{docs/schemas => schemas}/interface.rng | 0
{docs/schemas => schemas}/meson.build | 0
{docs/schemas => schemas}/network.rng | 0
{docs/schemas => schemas}/networkcommon.rng | 0
{docs/schemas => schemas}/networkport.rng | 0
{docs/schemas => schemas}/nodedev.rng | 0
{docs/schemas => schemas}/nwfilter.rng | 0
{docs/schemas => schemas}/nwfilter_params.rng | 0
{docs/schemas => schemas}/nwfilterbinding.rng | 0
{docs/schemas => schemas}/secret.rng | 0
{docs/schemas => schemas}/storagecommon.rng | 0
{docs/schemas => schemas}/storagepool.rng | 0
{docs/schemas => schemas}/storagepoolcaps.rng | 0
{docs/schemas => schemas}/storagevol.rng | 0
26 files changed, 2 insertions(+), 2 deletions(-)
rename {docs/schemas => schemas}/basictypes.rng (100%)
rename {docs/schemas => schemas}/capability.rng (100%)
rename {docs/schemas => schemas}/cpu.rng (100%)
rename {docs/schemas => schemas}/cputypes.rng (100%)
rename {docs/schemas => schemas}/domain.rng (100%)
rename {docs/schemas => schemas}/domainbackup.rng (100%)
rename {docs/schemas => schemas}/domaincaps.rng (100%)
rename {docs/schemas => schemas}/domaincheckpoint.rng (100%)
rename {docs/schemas => schemas}/domaincommon.rng (100%)
rename {docs/schemas => schemas}/domainsnapshot.rng (100%)
rename {docs/schemas => schemas}/interface.rng (100%)
rename {docs/schemas => schemas}/meson.build (100%)
rename {docs/schemas => schemas}/network.rng (100%)
rename {docs/schemas => schemas}/networkcommon.rng (100%)
rename {docs/schemas => schemas}/networkport.rng (100%)
rename {docs/schemas => schemas}/nodedev.rng (100%)
rename {docs/schemas => schemas}/nwfilter.rng (100%)
rename {docs/schemas => schemas}/nwfilter_params.rng (100%)
rename {docs/schemas => schemas}/nwfilterbinding.rng (100%)
rename {docs/schemas => schemas}/secret.rng (100%)
rename {docs/schemas => schemas}/storagecommon.rng (100%)
rename {docs/schemas => schemas}/storagepool.rng (100%)
rename {docs/schemas => schemas}/storagepoolcaps.rng (100%)
rename {docs/schemas => schemas}/storagevol.rng (100%)
diff --git a/docs/meson.build b/docs/meson.build
index 868267b764..7aebe08047 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -334,8 +334,6 @@ subdir('js')
subdir('kbase')
subdir('logos')
subdir('manpages')
-subdir('schemas')
-
foreach file : docs_assets
# This hack enables us to view the web pages
diff --git a/meson.build b/meson.build
index f6259e59a4..bea1b8e0ea 100644
--- a/meson.build
+++ b/meson.build
@@ -2125,6 +2125,8 @@ if gen_docs
subdir('docs')
endif
+subdir('schemas')
+
subdir('build-aux')
diff --git a/docs/schemas/basictypes.rng b/schemas/basictypes.rng
similarity index 100%
rename from docs/schemas/basictypes.rng
rename to schemas/basictypes.rng
diff --git a/docs/schemas/capability.rng b/schemas/capability.rng
similarity index 100%
rename from docs/schemas/capability.rng
rename to schemas/capability.rng
diff --git a/docs/schemas/cpu.rng b/schemas/cpu.rng
similarity index 100%
rename from docs/schemas/cpu.rng
rename to schemas/cpu.rng
diff --git a/docs/schemas/cputypes.rng b/schemas/cputypes.rng
similarity index 100%
rename from docs/schemas/cputypes.rng
rename to schemas/cputypes.rng
diff --git a/docs/schemas/domain.rng b/schemas/domain.rng
similarity index 100%
rename from docs/schemas/domain.rng
rename to schemas/domain.rng
diff --git a/docs/schemas/domainbackup.rng b/schemas/domainbackup.rng
similarity index 100%
rename from docs/schemas/domainbackup.rng
rename to schemas/domainbackup.rng
diff --git a/docs/schemas/domaincaps.rng b/schemas/domaincaps.rng
similarity index 100%
rename from docs/schemas/domaincaps.rng
rename to schemas/domaincaps.rng
diff --git a/docs/schemas/domaincheckpoint.rng b/schemas/domaincheckpoint.rng
similarity index 100%
rename from docs/schemas/domaincheckpoint.rng
rename to schemas/domaincheckpoint.rng
diff --git a/docs/schemas/domaincommon.rng b/schemas/domaincommon.rng
similarity index 100%
rename from docs/schemas/domaincommon.rng
rename to schemas/domaincommon.rng
diff --git a/docs/schemas/domainsnapshot.rng b/schemas/domainsnapshot.rng
similarity index 100%
rename from docs/schemas/domainsnapshot.rng
rename to schemas/domainsnapshot.rng
diff --git a/docs/schemas/interface.rng b/schemas/interface.rng
similarity index 100%
rename from docs/schemas/interface.rng
rename to schemas/interface.rng
diff --git a/docs/schemas/meson.build b/schemas/meson.build
similarity index 100%
rename from docs/schemas/meson.build
rename to schemas/meson.build
diff --git a/docs/schemas/network.rng b/schemas/network.rng
similarity index 100%
rename from docs/schemas/network.rng
rename to schemas/network.rng
diff --git a/docs/schemas/networkcommon.rng b/schemas/networkcommon.rng
similarity index 100%
rename from docs/schemas/networkcommon.rng
rename to schemas/networkcommon.rng
diff --git a/docs/schemas/networkport.rng b/schemas/networkport.rng
similarity index 100%
rename from docs/schemas/networkport.rng
rename to schemas/networkport.rng
diff --git a/docs/schemas/nodedev.rng b/schemas/nodedev.rng
similarity index 100%
rename from docs/schemas/nodedev.rng
rename to schemas/nodedev.rng
diff --git a/docs/schemas/nwfilter.rng b/schemas/nwfilter.rng
similarity index 100%
rename from docs/schemas/nwfilter.rng
rename to schemas/nwfilter.rng
diff --git a/docs/schemas/nwfilter_params.rng b/schemas/nwfilter_params.rng
similarity index 100%
rename from docs/schemas/nwfilter_params.rng
rename to schemas/nwfilter_params.rng
diff --git a/docs/schemas/nwfilterbinding.rng b/schemas/nwfilterbinding.rng
similarity index 100%
rename from docs/schemas/nwfilterbinding.rng
rename to schemas/nwfilterbinding.rng
diff --git a/docs/schemas/secret.rng b/schemas/secret.rng
similarity index 100%
rename from docs/schemas/secret.rng
rename to schemas/secret.rng
diff --git a/docs/schemas/storagecommon.rng b/schemas/storagecommon.rng
similarity index 100%
rename from docs/schemas/storagecommon.rng
rename to schemas/storagecommon.rng
diff --git a/docs/schemas/storagepool.rng b/schemas/storagepool.rng
similarity index 100%
rename from docs/schemas/storagepool.rng
rename to schemas/storagepool.rng
diff --git a/docs/schemas/storagepoolcaps.rng b/schemas/storagepoolcaps.rng
similarity index 100%
rename from docs/schemas/storagepoolcaps.rng
rename to schemas/storagepoolcaps.rng
diff --git a/docs/schemas/storagevol.rng b/schemas/storagevol.rng
similarity index 100%
rename from docs/schemas/storagevol.rng
rename to schemas/storagevol.rng
--
2.35.1
3 years
Plans for the next release
by Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
April Fools' release on Apr 01 I suggest entering the freeze on Monday
Mar 28 and tagging RC2 on Wednesday Mar 30.
I hope this works for everyone.
Jirka
3 years
[PATCH RFC 0/1] s390x CPU Model Feature Deprecation
by Collin Walling
The s390x architecture has a growing list of features that will no longer
be supported on future hardware releases. This introduces an issue with
migration such that guests, running on models with these features enabled,
will be rejected outright by machines that do not support these features.
A current example is the CSSKE feature that has been deprecated for some time.
It has been publicly announced that gen15 will be the last release to
support this feature, however we have postponed this to gen16a. A possible
solution to remedy this would be to create a new QEMU QMP Response that allows
users to query for deprecated/unsupported features.
This presents two parts of the puzzle: how to report deprecated features to
a user (libvirt) and how should libvirt handle this information.
First, let's discuss the latter. The patch presented alongside this cover letter
attempts to solve the migration issue by hard-coding the CSSKE feature to be
disabled for all s390x CPU models. This is done by simply appending the CSSKE
feature with the disabled policy to the host-model.
libvirt pseudo:
if arch is s390x
set CSSKE to disabled for host-model
This will be recorded under the host-model as (observable via domcapabilities):
<mode name='host-model' supported='yes'>
<model fallback='forbid'>z13.2-base</model>
<feature policy='require' name='aen'/>
<feature policy='require' name='aefsi'/>
<feature policy='require' name='diag318'/>
...
<feature policy='disable' name='csske'/>
...
Obviously a hard-coded path is not a desired approach and requires a
constant update whenever newer features are listed for deprecation.
The patch is presented to instead spin up the discussion as to where
it is appropriate to record these deprecated features (e.g. should these
be reported under the host-model? or added to the guest CPU definition
prior to start up? etc). There is one issue observed by this change to
the host-model, denoted directly below.
A change in the host-model XML affects the hypervisor-cpu-comparison
command, which uses the libvirt-recorded host-model XML. Issuing
comparison on a machine that still supports CSSKE (but with it flagged
as disabled in the host-model XML) with an equal or older CPU model
that does *not* present CSSKE as disabled in the XML will be reported
as incompatible. The response should report "identical" or "superset"
because technically the hardware still supports the feature.
A possible solution is to modify the hypervisor-cpu-comparison command
to query the host-model via expansion to get the proper hypervisor CPU
model as opposed to using libvirt's modified definition.
Secondly, let's discuss the how to report the deprecated features. Namely,
an introduction of a new QEMU QMP response.
This would be a long-term approach that allows a user to query a list of
deprecated features for a particular architecture. A list will be kept
within QEMU that contains all deprecated CPU features. This allows the
retention of CPU model definitions within QEMU. Libvirt may query this
list and update the host-model definition to disable the features reported
by QEMU.
QEMU QMP Response example:
{ "execute": "query-cpu-model-deprecated-features" }
{ "return": { "props": { "name": "csske", "name": "feat_a", "name": "feat_b" }}}
libvirt pseudo:
if query_deprecated_features is supported
list = query_deprecated_features()
for each feat in list
set feat to disabled for host-model
Then, any new features that are flagged for deprecated in the future may
simply be added to this "deprecated features" list in QEMU alongside a
new CPU definition.
Please let me know your thoughts on these approaches. All input is welcome.
Thanks.
Collin Walling (1):
qemu: capabilities: disable csske for host cpu
src/qemu/qemu_capabilities.c | 10 ++++++++++
tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.12.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.8.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.9.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_3.0.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 +
8 files changed, 17 insertions(+)
--
2.31.1
3 years
[libvirt RFC v2] virfile: set pipe size in virFileWrapperFdNew to improve throughput
by root
From: Claudio Fontana <cfontana(a)suse.de>
virsh save is very slow with a default pipe size, so set a larger one.
This change improves throughput by ~400% on fast nvme or ramdisk,
for the current only user of virFileWrapperFdNew: the qemu driver.
Best value currently measured is 1MB, which happens to be also
the kernel default for the pipe-max-size.
We do not try to use a pipe buffer larger than what the setting
of /proc/sys/fs/pipe-max-size currently allows.
Signed-off-by: Claudio Fontana <cfontana(a)suse.de>
---
src/util/virfile.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
see v1 at
https://listman.redhat.com/archives/libvir-list/2022-March/229252.html
Changes v1 -> v2:
* removed VIR_FILE_WRAPPER_BIG_PIPE, made the new pipe resizing
unconditional (Michal)
* moved code to separate functions (Michal)
* removed ternary op, disliked in libvirt (Michal)
* added #ifdef __linux__ (Ani Sinha)
* try smallest value between currently best measured value (1MB)
and the pipe-max-size setting. If pipe-max-size cannot be read,
try kernel default max (1MB). (Daniel)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index a04f888e06..13bdd42c68 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -201,6 +201,71 @@ struct _virFileWrapperFd {
};
#ifndef WIN32
+
+#ifdef __linux__
+/**
+ * virFileWrapperGetBestPipeSize:
+ *
+ * get the best pipe size to use with virFileWrapper.
+ *
+ * We first check the maximum we are allowed by the system pipe-max-size,
+ * and then use the minimum between that and our tested best value.
+ * This is because a request beyond pipe-max-size may fail with EPERM.
+ * If we are unable to read pipe-max-size, use the kernel default (1MB).
+ *
+ * Return value is the pipe size to use.
+ */
+
+static int virFileWrapperGetBestPipeSize(void)
+{
+ const char path[] = "/proc/sys/fs/pipe-max-size";
+ int best_sz = 1024 * 1024; /* good virsh save results with this size */
+ int max_sz;
+
+ if (virFileReadValueInt(&max_sz, path) < 0) {
+ max_sz = 1024 * 1024; /* this is the kernel default pipe-max-size */
+ VIR_WARN("failed to read %s, trying default %d", path, max_sz);
+ } else if (max_sz > best_sz) {
+ max_sz = best_sz;
+ }
+ return max_sz;
+}
+
+/**
+ * virFileWrapperSetPipeSize:
+ * @fd: the fd of the pipe
+ *
+ * Set best pipe size on the passed file descriptor for bulk transfers of data.
+ *
+ * default pipe size (usually 64K) is generally not suited for large transfers
+ * to fast devices. This has been measured to improve virsh save by 400%
+ * in ideal conditions.
+ *
+ * Return value is 0 on success, -1 and errno set on error.
+ * OS note: only for linux, on other OS this is a no-op.
+ */
+static int
+virFileWrapperSetPipeSize(int fd)
+{
+ int pipe_sz = virFileWrapperGetBestPipeSize();
+ int rv = fcntl(fd, F_SETPIPE_SZ, pipe_sz);
+
+ if (rv < 0) {
+ VIR_ERROR(_("failed to set pipe size to %d (errno=%d)"), pipe_sz, errno);
+ return -1;
+ }
+ VIR_INFO("fd %d pipe size adjusted to %d", fd, rv);
+ return 0;
+}
+
+#else /* !__linux__ */
+static int virFileWrapperSetPipeSize(int fd)
+{
+ return 0;
+}
+#endif /* !__linux__ */
+
+
/**
* virFileWrapperFdNew:
* @fd: pointer to fd to wrap
@@ -282,6 +347,10 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags)
ret->cmd = virCommandNewArgList(iohelper_path, name, NULL);
+ if (virFileWrapperSetPipeSize(pipefd[!output]) < 0) {
+ virReportError(VIR_ERR_SYSTEM_ERROR, "%s", _("unable to set pipe size, data transfer might be slow"));
+ }
+
if (output) {
virCommandSetInputFD(ret->cmd, pipefd[0]);
virCommandSetOutputFD(ret->cmd, fd);
--
2.35.1
3 years
[PATCH] domain_conf: include checks against dom->os.type and dom->virtType
by Jamm02
All the checks against dom->os.type and dom->virtType in
virDomainInputDefParseXML shifted to
virDomainInputDefValidate function
Signed-off-by: Jamm02 <codeguy.moteen(a)gmail.com>
---
src/conf/domain_conf.c | 49 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e0dfc9e45f..b237fd9ab1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11837,6 +11837,55 @@ virDomainPanicDefParseXML(virDomainXMLOption *xmlopt,
return NULL;
}
+static virDomainInputDef *
+virDomainInputDefValidate(const virDomainDef *dom,
+ xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
+{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
+ virDomainInputDef *def;
+ g_autofree char *bus = NULL;
+
+ def = g_new0(virDomainInputDef, 1);
+
+ ctxt->node = node;
+ bus = virXMLPropString(node, "bus");
+
+ if (bus) {
+ if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown input bus type '%s'"), bus);
+ goto error;
+ }
+
+ } else {
+ if (dom->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+ if ((def->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
+ def->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
+ (ARCH_IS_X86(dom->os.arch) || dom->os.arch == VIR_ARCH_NONE)) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_PS2;
+ } else if (ARCH_IS_S390(dom->os.arch) ||
+ def->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
+ } else if (def->type == VIR_DOMAIN_INPUT_TYPE_EVDEV) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_NONE;
+ } else {
+ def->bus = VIR_DOMAIN_INPUT_BUS_USB;
+ }
+ } else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN ||
+ dom->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
+ } else {
+ if ((dom->virtType == VIR_DOMAIN_VIRT_VZ ||
+ dom->virtType == VIR_DOMAIN_VIRT_PARALLELS))
+ def->bus = VIR_DOMAIN_INPUT_BUS_PARALLELS;
+ }
+ }
+
+ error:
+ virDomainInputDefFree(def);
+ return NULL;
+}
/* Parse the XML definition for an input device */
static virDomainInputDef *
virDomainInputDefParseXML(virDomainXMLOption *xmlopt,
--
2.35.1
3 years
[PATCH] domain_conf: include checks against dom->os.type and dom->virtType
by Jamm02
All the checks against dom->os.type and dom->virtType in
virDomainInputDefParseXML shifted to
virDomainInputDefValidate function
Signed-off-by: Jamm02 <codeguy.moteen(a)gmail.com>
---
src/conf/domain_conf.c | 49 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e0dfc9e45f..b237fd9ab1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11837,6 +11837,55 @@ virDomainPanicDefParseXML(virDomainXMLOption *xmlopt,
return NULL;
}
+static virDomainInputDef *
+virDomainInputDefValidate(const virDomainDef *dom,
+ xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
+{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
+ virDomainInputDef *def;
+ g_autofree char *bus = NULL;
+
+ def = g_new0(virDomainInputDef, 1);
+
+ ctxt->node = node;
+ bus = virXMLPropString(node, "bus");
+
+ if (bus) {
+ if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown input bus type '%s'"), bus);
+ goto error;
+ }
+
+ } else {
+ if (dom->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+ if ((def->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
+ def->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
+ (ARCH_IS_X86(dom->os.arch) || dom->os.arch == VIR_ARCH_NONE)) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_PS2;
+ } else if (ARCH_IS_S390(dom->os.arch) ||
+ def->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
+ } else if (def->type == VIR_DOMAIN_INPUT_TYPE_EVDEV) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_NONE;
+ } else {
+ def->bus = VIR_DOMAIN_INPUT_BUS_USB;
+ }
+ } else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN ||
+ dom->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
+ def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
+ } else {
+ if ((dom->virtType == VIR_DOMAIN_VIRT_VZ ||
+ dom->virtType == VIR_DOMAIN_VIRT_PARALLELS))
+ def->bus = VIR_DOMAIN_INPUT_BUS_PARALLELS;
+ }
+ }
+
+ error:
+ virDomainInputDefFree(def);
+ return NULL;
+}
/* Parse the XML definition for an input device */
static virDomainInputDef *
virDomainInputDefParseXML(virDomainXMLOption *xmlopt,
--
2.35.1
3 years
[PATCH] virNWFilterLockIface: Preserve correct lock ordering
by Michal Privoznik
In the not so distant past, the lock ordering in
virNWFilterLockIface() was as follows: global mutex ifaceMapLock
was acquired, then internal representation of given interface was
looked up in a hash table (or created brand new if none was
found), the global lock was released and the lock of the
interface was acquired.
But this was mistakenly changed as the function was rewritten to
use automatic mutexes, because now the global lock is held
throughout the whole run of the function and thus the interface
specific lock is acquired with the global lock held. This results
in a deadlock.
Fixes: dd8150c48dcf94e8d3b0481be08eeef822b98b02
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/nwfilter/nwfilter_learnipaddr.c | 49 +++++++++++++++--------------
1 file changed, 26 insertions(+), 23 deletions(-)
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 2c85972012..ec2d337188 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -143,37 +143,40 @@ static bool threadsTerminate;
int
virNWFilterLockIface(const char *ifname)
{
- VIR_LOCK_GUARD lock = virLockGuardLock(&ifaceMapLock);
- virNWFilterIfaceLock *ifaceLock = virHashLookup(ifaceLockMap, ifname);
+ virNWFilterIfaceLock *ifaceLock = NULL;
- if (!ifaceLock) {
- ifaceLock = g_new0(virNWFilterIfaceLock, 1);
+ VIR_WITH_MUTEX_LOCK_GUARD(&ifaceMapLock) {
+ ifaceLock = virHashLookup(ifaceLockMap, ifname);
- if (virMutexInitRecursive(&ifaceLock->lock) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("mutex initialization failed"));
- g_free(ifaceLock);
- return -1;
- }
+ if (!ifaceLock) {
+ ifaceLock = g_new0(virNWFilterIfaceLock, 1);
- if (virStrcpyStatic(ifaceLock->ifname, ifname) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("interface name %s does not fit into buffer"),
- ifaceLock->ifname);
- g_free(ifaceLock);
- return -1;
- }
+ if (virMutexInitRecursive(&ifaceLock->lock) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("mutex initialization failed"));
+ g_free(ifaceLock);
+ return -1;
+ }
+
+ if (virStrcpyStatic(ifaceLock->ifname, ifname) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("interface name %s does not fit into buffer"),
+ ifaceLock->ifname);
+ g_free(ifaceLock);
+ return -1;
+ }
+
+ while (virHashAddEntry(ifaceLockMap, ifname, ifaceLock)) {
+ g_free(ifaceLock);
+ return -1;
+ }
- while (virHashAddEntry(ifaceLockMap, ifname, ifaceLock)) {
- g_free(ifaceLock);
- return -1;
+ ifaceLock->refctr = 0;
}
- ifaceLock->refctr = 0;
+ ifaceLock->refctr++;
}
- ifaceLock->refctr++;
-
virMutexLock(&ifaceLock->lock);
return 0;
--
2.34.1
3 years