[PATCH] crypto: add support for sm4 without key length suffix
by luzhipeng
qemu add sm4 in release 9, but the name of sm4 doesn't have the key
length suffix, So set size to 0, construct cipher name without
key length as suffix.
Signed-off-by: luzhipeng <luzhipeng(a)cestc.cn>
---
docs/formatstorageencryption.rst | 8 +++++---
src/qemu/qemu_block.c | 10 +++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/docs/formatstorageencryption.rst b/docs/formatstorageencryption.rst
index 066d285090..6cb8cf024c 100644
--- a/docs/formatstorageencryption.rst
+++ b/docs/formatstorageencryption.rst
@@ -75,11 +75,13 @@ initialization vector generation.
``name``
The name of the cipher algorithm used for data encryption, such as 'aes',
- 'des', 'cast5', 'serpent', 'twofish', etc. Support of the specific
+ 'des', 'cast5', 'serpent', 'twofish', 'sm4', etc. Support of the specific
algorithm is storage driver implementation dependent.
``size``
- The size of the cipher in bits, such as '256', '192', '128', etc. Support
- of the specific size for a specific cipher is hypervisor dependent.
+ The size of the cipher in bits, such as '256', '192', '128', '0', etc.
+ '0' indicates that the encryption algorithm name doesn't have key length
+ suffix. Support of the specific size for a specific cipher is hypervisor
+ dependent.
``mode``
An optional cipher algorithm mode such as 'cbc', 'xts', 'ecb', etc.
Support of the specific cipher mode is hypervisor dependent.
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index d6cdf521c4..f63f3a36e0 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -2137,9 +2137,13 @@ qemuBlockStorageSourceCreateGetEncryptionLUKS(virStorageSource *src,
if (src->encryption) {
if (src->encryption->encinfo.cipher_name) {
- cipheralg = g_strdup_printf("%s-%u",
- src->encryption->encinfo.cipher_name,
- src->encryption->encinfo.cipher_size);
+ if (src->encryption->encinfo.cipher_size) {
+ cipheralg = g_strdup_printf("%s-%u",
+ src->encryption->encinfo.cipher_name,
+ src->encryption->encinfo.cipher_size);
+ } else {
+ cipheralg = g_strdup_printf("%s", src->encryption->encinfo.cipher_name);
+ }
}
if (virJSONValueObjectAdd(&props,
--
2.31.1
4 months, 2 weeks
[PATCH v2 0/6] qemu: Introduce the ability to disable the built-in PS/2 controller
by Kamil Szczęk
A while back QEMU introduced a new machine property for disabling the
i8042 PS/2 controller (commit 4ccd5fe22feb95137d325f422016a6473541fe9f)
which up until then was a built-in device included by all PC machine
type descendants unconditionally. This new option allowed users to
disable emulation of this controller, thus removing the default PS/2
peripherals. The rationale for why somebody might want to disable
PS/2 peripherals is explained in the aforementioned commit. This series
of patches exposes this machine property via the 'ps2' feature, while
also taking care of side-effects, such as inhibiting the implicit
creation of PS/2 inputs in the domain XML.
Changes from v1:
- Use abstract 'generic-pc' machine type instead of concrete 'pc' for
property detection.
- Introduce test cases along with monitor replies and capability flags.
- Add NEWS mention of the new feature.
Kamil Szczęk (6):
qemu: Improve PS/2 controller detection
qemu_capabilities: Introduce QEMU_CAPS_MACHINE_I8042_OPT
qemucapabilitiesdata: Add data for QEMU_CAPS_MACHINE_I8042_OPT
qemu: Introduce 'ps2' feature
qemuxmlconftest: Add test cases for the new 'ps2' feature
NEWS: Mention the new 'ps2' feature
NEWS.rst | 6 +
docs/formatdomain.rst | 5 +
src/conf/domain_conf.c | 6 +-
src/conf/domain_conf.h | 1 +
src/conf/domain_validate.c | 23 ++
src/conf/schemas/domaincommon.rng | 5 +
src/qemu/qemu_capabilities.c | 42 +++
src/qemu/qemu_capabilities.h | 9 +-
src/qemu/qemu_command.c | 5 +
src/qemu/qemu_domain.c | 29 ++-
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_validate.c | 27 +-
.../caps_5.2.0_x86_64.replies | 169 ++++++++++--
.../caps_6.0.0_x86_64.replies | 189 ++++++++++++--
.../caps_6.1.0_x86_64.replies | 203 +++++++++++++--
.../caps_6.2.0_x86_64.replies | 212 ++++++++++++++--
.../caps_7.0.0_x86_64.replies | 225 ++++++++++++++--
.../caps_7.0.0_x86_64.xml | 1 +
.../caps_7.1.0_x86_64.replies | 240 ++++++++++++++++--
.../caps_7.1.0_x86_64.xml | 1 +
.../caps_7.2.0_x86_64+hvf.replies | 240 ++++++++++++++++--
.../caps_7.2.0_x86_64+hvf.xml | 1 +
.../caps_7.2.0_x86_64.replies | 240 ++++++++++++++++--
.../caps_7.2.0_x86_64.xml | 1 +
.../caps_8.0.0_x86_64.replies | 240 ++++++++++++++++--
.../caps_8.0.0_x86_64.xml | 1 +
.../caps_8.1.0_x86_64.replies | 236 +++++++++++++++--
.../caps_8.1.0_x86_64.xml | 1 +
.../caps_8.2.0_x86_64.replies | 236 +++++++++++++++--
.../caps_8.2.0_x86_64.xml | 1 +
.../caps_9.0.0_x86_64.replies | 240 ++++++++++++++++--
.../caps_9.0.0_x86_64.xml | 1 +
.../caps_9.1.0_x86_64.replies | 240 ++++++++++++++++--
.../caps_9.1.0_x86_64.xml | 1 +
...-off-explicit-ps2-inputs.x86_64-latest.err | 1 +
.../machine-i8042-off-explicit-ps2-inputs.xml | 19 ++
...hine-i8042-off-vmport-on.x86_64-latest.err | 1 +
.../machine-i8042-off-vmport-on.xml | 18 ++
.../machine-i8042-off.x86_64-6.2.0.err | 1 +
.../machine-i8042-off.x86_64-latest.args | 33 +++
.../machine-i8042-off.x86_64-latest.xml | 32 +++
tests/qemuxmlconfdata/machine-i8042-off.xml | 17 ++
.../machine-i8042-on.x86_64-6.2.0.err | 1 +
.../machine-i8042-on.x86_64-latest.args | 33 +++
.../machine-i8042-on.x86_64-latest.xml | 34 +++
tests/qemuxmlconfdata/machine-i8042-on.xml | 17 ++
tests/qemuxmlconftest.c | 6 +
47 files changed, 3030 insertions(+), 261 deletions(-)
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.xml
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-vmport-on.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-vmport-on.xml
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.x86_64-6.2.0.err
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.xml
create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.x86_64-6.2.0.err
create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.xml
--
2.45.0
4 months, 2 weeks
[PATCH v2] vmx: Ensure unique disk targets when parsing
by Adam Julis
Disk targets are generated in virVMXParseConfig() with
virVMXGenerateDiskTarget(). It works on combination of
controller, fix offset, unit and prefix. While SCSI and SATA have
same prefix "sd", function virVMXGenerateDiskTarget() could
returned in some cases same targets.
In this patch, after loaded SCSI and SATA disks to the def,
indexes are regenerated, now simply from position of the disk in
array of disks (def). With this, required uniqueness is
guaranteed.
Because assigned addresses of disks are generated from their
indexes, for every changed SATA disk is called
virDomainDiskDefAssignAddress() with the updated value.
The corresponding tests have been modified to match the index
changes.
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
Since previous version in mailing list was complicated for trying to
preserve the indexes of SCSI and previous tests, this one going to
straightforward, although it changes all (SCSI and SATA) indexes. It's
not a bug, since we cannot guarantee the same naming inside the guest
anyway.
src/vmx/vmx.c | 19 +++++++++++++++++++
tests/vmx2xmldata/esx-in-the-wild-11.xml | 4 ++--
tests/vmx2xmldata/esx-in-the-wild-12.xml | 4 ++--
tests/vmx2xmldata/esx-in-the-wild-2.xml | 4 ++--
tests/vmx2xmldata/esx-in-the-wild-8.xml | 4 ++--
tests/vmx2xmldata/scsi-driver.xml | 12 ++++++------
6 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 227744d062..22e59726c8 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1400,6 +1400,7 @@ virVMXParseConfig(virVMXContext *ctx,
virCPUDef *cpu = NULL;
char *firmware = NULL;
size_t saved_ndisks = 0;
+ size_t i;
if (ctx->parseFileName == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1805,6 +1806,24 @@ virVMXParseConfig(virVMXContext *ctx,
}
}
+ /* now disks contain only SCSI and SATA, SATA could have same name (dst) as SCSI
+ * so replace all their names with new ones to guarantee their uniqueness
+ * finally, regenerate correct addresses, while it depends on the index */
+
+ for (i = 0; i < def->ndisks; i++) {
+ virDomainDiskDef *disk = def->disks[i];
+
+ VIR_FREE(disk->dst);
+ disk->dst = virIndexToDiskName(i, "sd");
+
+ if (virDomainDiskDefAssignAddress(NULL, disk, def) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not assign address to disk '%1$s'"),
+ virDomainDiskGetSource(disk));
+ goto cleanup;
+ }
+ }
+
/* def:disks (ide) */
for (bus = 0; bus < 2; ++bus) {
for (unit = 0; unit < 2; ++unit) {
diff --git a/tests/vmx2xmldata/esx-in-the-wild-11.xml b/tests/vmx2xmldata/esx-in-the-wild-11.xml
index 8807a057d7..d9522c1be2 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-11.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-11.xml
@@ -22,8 +22,8 @@
</disk>
<disk type='file' device='disk'>
<source file='[datastore] directory/esx6.7-rhel7.7-x86_64_3.vmdk'/>
- <target dev='sdp' bus='scsi'/>
- <address type='drive' controller='0' bus='0' target='0' unit='16'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='scsi' index='0' model='vmpvscsi'/>
<interface type='bridge'>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-12.xml b/tests/vmx2xmldata/esx-in-the-wild-12.xml
index 42184501d0..a7730845ee 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-12.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-12.xml
@@ -21,9 +21,9 @@
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
- <target dev='sda' bus='sata'/>
+ <target dev='sdb' bus='sata'/>
<readonly/>
- <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='scsi' index='0' model='vmpvscsi'/>
<controller type='sata' index='0'/>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-2.xml b/tests/vmx2xmldata/esx-in-the-wild-2.xml
index 59071b5d3a..1a66f5e9c7 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-2.xml
@@ -20,9 +20,9 @@
</disk>
<disk type='file' device='cdrom'>
<source file='[datastore] directory/Debian1-cdrom.iso'/>
- <target dev='sdp' bus='scsi'/>
+ <target dev='sdb' bus='scsi'/>
<readonly/>
- <address type='drive' controller='1' bus='0' target='0' unit='0'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/vmimages/tools-isoimages/linux.iso'/>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-8.xml b/tests/vmx2xmldata/esx-in-the-wild-8.xml
index 47d22ced2a..d5356bda34 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-8.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-8.xml
@@ -36,9 +36,9 @@
</disk>
<disk type='file' device='cdrom'>
<source file='[692eb778-2d4937fe] CentOS-4.7.ServerCD-x86_64.iso'/>
- <target dev='sda' bus='sata'/>
+ <target dev='sdd' bus='sata'/>
<readonly/>
- <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='3'/>
</disk>
<controller type='scsi' index='0' model='vmpvscsi'/>
<controller type='sata' index='0'/>
diff --git a/tests/vmx2xmldata/scsi-driver.xml b/tests/vmx2xmldata/scsi-driver.xml
index e5b73420c3..42b6fffe24 100644
--- a/tests/vmx2xmldata/scsi-driver.xml
+++ b/tests/vmx2xmldata/scsi-driver.xml
@@ -19,18 +19,18 @@
</disk>
<disk type='file' device='disk'>
<source file='[datastore] directory/harddisk2.vmdk'/>
- <target dev='sdp' bus='scsi'/>
- <address type='drive' controller='1' bus='0' target='0' unit='0'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
<source file='[datastore] directory/harddisk3.vmdk'/>
- <target dev='sdae' bus='scsi'/>
- <address type='drive' controller='2' bus='0' target='0' unit='0'/>
+ <target dev='sdc' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>
<disk type='file' device='disk'>
<source file='[datastore] directory/harddisk4.vmdk'/>
- <target dev='sdat' bus='scsi'/>
- <address type='drive' controller='3' bus='0' target='0' unit='0'/>
+ <target dev='sdd' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='3'/>
</disk>
<controller type='scsi' index='0' model='buslogic'/>
<controller type='scsi' index='1' model='lsilogic'/>
--
2.45.2
4 months, 2 weeks
[PATCH v2 0/3] qemuxmlconftest: Add test cases for broken and missing XML files
by Peter Krempa
Patch 3/3 adds the actual test:
Changes to v1:
- fixed missing NULL termination of the 'skip' array
- "backported" g_string_replace into glibcompat.c until we bump minimum
glib
- started striping 'abs_srcdir' strings from qemuxmlconftest's '.err'
output files
Peter Krempa (3):
glibcompat: "Backport" 'g_string_replace'
testQemuConfXMLCommon: Strip 'abs_srcdir' paths from '.err' files in
qemuxmlconftest
qemuxmlconftest: Add test cases for broken and missing XML files
src/libvirt_private.syms | 1 +
src/util/glibcompat.c | 65 +++++++++++++++++++
src/util/glibcompat.h | 10 +++
.../broken-xml-invalid.x86_64-latest.err | 3 +
tests/qemuxmlconfdata/broken-xml-invalid.xml | 1 +
.../nonexistent-file.x86_64-latest.err | 1 +
tests/qemuxmlconftest.c | 16 ++++-
tests/testutilsqemu.h | 1 +
tests/virschematest.c | 12 ++++
9 files changed, 107 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxmlconfdata/broken-xml-invalid.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/broken-xml-invalid.xml
create mode 100644 tests/qemuxmlconfdata/nonexistent-file.x86_64-latest.err
--
2.45.2
4 months, 2 weeks
[PATCH v3 0/9] ch: support restore with network devices
by Purna Pavan Chandra
Current ch driver supports restore only for domains without any network
configuration defined. This was because libvirt explicitly passes network fds
and CH did not had support to restore with new net FDS. This support has been
added recently, https://github.com/cloud-hypervisor/cloud-hypervisor/pull/6402
The changes in this patch series includes moving to socket communication for
restore api, create new net fds and pass them via SCM_RIGHTS to CH.
New changes in v3:
* Rebase on latest master
* Fixe typos
* Mention improvements in NEWS.rst
v2: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/message/6...
New changes in v2:
* Reword of few commints
* Add version checks in save/restore validations
* Add use_timeout in chSocketRecv
* Address Praveen Paladugu's comments
v1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/PT...
Purna Pavan Chandra (9):
ch: report response message instead of just code
ch: Pass net ids explicitly during vm creation
ch: refactor chProcessAddNetworkDevices
ch: support poll with -1 in chSocketRecv
ch: use monitor socket fd to send restore request
ch: refactor virCHMonitorSaveVM
ch: support restore with net devices
ch: kill CH process if restore fails
NEWS: Mention restore with n/w devices support for ch
NEWS.rst | 6 +
src/ch/ch_capabilities.c | 6 +
src/ch/ch_capabilities.h | 1 +
src/ch/ch_driver.c | 29 +++--
src/ch/ch_monitor.c | 62 +++++++----
src/ch/ch_monitor.h | 6 +-
src/ch/ch_process.c | 233 +++++++++++++++++++++++++++++++--------
7 files changed, 260 insertions(+), 83 deletions(-)
--
2.34.1
4 months, 2 weeks
[PATCH] qemuxmlconftest: Add test cases for broken and missing XML files
by Peter Krempa
Add test cases for few edge cases which excercise the XML reporting from
libxml2 in anticipation of upcoming changes of behaviour.
'virschematest' must skip parsing of the broken file altogether so this
patch adds infrastructure to allow that.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
This patch is meant as an addendum to my review of:
[PATCH] util: open XML files before calling libxml2
.../broken-xml-invalid.x86_64-latest.err | 3 +++
tests/qemuxmlconfdata/broken-xml-invalid.xml | 1 +
.../nonexistent-file.x86_64-latest.err | 1 +
tests/qemuxmlconftest.c | 8 +++++++-
tests/testutilsqemu.h | 1 +
tests/virschematest.c | 11 +++++++++++
6 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxmlconfdata/broken-xml-invalid.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/broken-xml-invalid.xml
create mode 100644 tests/qemuxmlconfdata/nonexistent-file.x86_64-latest.err
diff --git a/tests/qemuxmlconfdata/broken-xml-invalid.x86_64-latest.err b/tests/qemuxmlconfdata/broken-xml-invalid.x86_64-latest.err
new file mode 100644
index 0000000000..601f547cc6
--- /dev/null
+++ b/tests/qemuxmlconfdata/broken-xml-invalid.x86_64-latest.err
@@ -0,0 +1,3 @@
+/home/pipo/libvirt/tests/qemuxmlconfdata/broken-xml-invalid.xml:2: Couldn't find end of Start Tag dom line 1
+(null)
+^
diff --git a/tests/qemuxmlconfdata/broken-xml-invalid.xml b/tests/qemuxmlconfdata/broken-xml-invalid.xml
new file mode 100644
index 0000000000..9903e61ead
--- /dev/null
+++ b/tests/qemuxmlconfdata/broken-xml-invalid.xml
@@ -0,0 +1 @@
+<dom
diff --git a/tests/qemuxmlconfdata/nonexistent-file.x86_64-latest.err b/tests/qemuxmlconfdata/nonexistent-file.x86_64-latest.err
new file mode 100644
index 0000000000..59e92917f9
--- /dev/null
+++ b/tests/qemuxmlconfdata/nonexistent-file.x86_64-latest.err
@@ -0,0 +1 @@
+XML error: failed to parse xml document '/home/pipo/libvirt/tests/qemuxmlconfdata/nonexistent-file.xml'
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 8aa8efea13..9e6d40fe33 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -372,6 +372,7 @@ testCheckExclusiveFlags(int flags)
FLAG_REAL_CAPS |
FLAG_SLIRP_HELPER |
FLAG_ALLOW_DUPLICATE_OUTPUT |
+ FLAG_ALLOW_MISSING_INPUT |
0, -1);
return 0;
@@ -671,7 +672,8 @@ testQemuConfXMLCommon(testQemuInfo *info,
if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
goto cleanup;
- if (!virFileExists(info->infile)) {
+ if (!(info->flags & FLAG_ALLOW_MISSING_INPUT) &&
+ !virFileExists(info->infile)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Input file '%s' not found", info->infile);
goto cleanup;
@@ -1233,6 +1235,10 @@ mymain(void)
g_unsetenv("PIPEWIRE_REMOTE");
g_unsetenv("PIPEWIRE_RUNTIME_DIR");
+ DO_TEST_CAPS_ARCH_LATEST_FULL("nonexistent-file", "x86_64",
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_ALLOW_MISSING_INPUT);
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("broken-xml-invalid");
+
DO_TEST_CAPS_LATEST("x86_64-pc-minimal");
DO_TEST_CAPS_LATEST_ABI_UPDATE("x86_64-pc-minimal");
DO_TEST_CAPS_LATEST("x86_64-q35-minimal");
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index a5806f244b..90632031ff 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -61,6 +61,7 @@ typedef enum {
FLAG_REAL_CAPS = 1 << 2,
FLAG_SLIRP_HELPER = 1 << 3,
FLAG_ALLOW_DUPLICATE_OUTPUT = 1 << 4, /* allow multiple tests with the same output file */
+ FLAG_ALLOW_MISSING_INPUT = 1 << 5,
} testQemuInfoFlags;
struct testQemuConf {
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 9b6649a6cf..b4113619e2 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -36,6 +36,7 @@ struct testSchemaEntry {
const char **exceptions; /* optional NULL terminated list of filenames inside
directory where the expected validation result is
inverted */
+ const char **skip; /* list of files to skip altogether */
const char *dirRegex;
const char *file;
};
@@ -131,6 +132,10 @@ testSchemaDir(const char *schema,
!g_regex_match(filter, ent->d_name, 0, NULL))
continue;
+ if (entry->skip &&
+ g_strv_contains(entry->skip, ent->d_name))
+ continue;
+
if (entry->exceptions)
exception = g_strv_contains(entry->exceptions, ent->d_name);
@@ -237,10 +242,16 @@ static const char *exceptions_qemuxmlconfdata[] = {
NULL
};
+/* skip tests with completely broken XML */
+static const char *skip_qemuxmlconfdata[] = {
+ "broken-xml-invalid.xml"
+};
+
static const struct testSchemaEntry schemaDomain[] = {
{ .dir = "tests/domainschemadata" },
{ .dir = "tests/qemuxmlconfdata",
.exceptions = exceptions_qemuxmlconfdata,
+ .skip = skip_qemuxmlconfdata,
},
{ .dir = "tests/xmconfigdata" },
{ .dir = "tests/lxcxml2xmldata" },
--
2.45.2
4 months, 2 weeks
[PATCH 0/3] Intel-IOMMU: Add dma-translation switch
by Sandesh Patel
Since Qemu commit 8646d9c (Support IR-only mode without DMA translation) version 7.1.0,
Qemu support dma-translation attribute for Intel IOMMU. This patch adds a new attribute
dma_translation to configure this.
Sandesh Patel (3):
Conf: add dma_translation attribute to iommu
qemu: format dma-translation on intel-iommu command line
tests: add test for intel-iommu dma-translation attribute
docs/formatdomain.rst | 7 ++++
src/conf/domain_conf.c | 15 ++++++++
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 5 +++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 1 +
src/qemu/qemu_validate.c | 6 +++
.../caps_7.1.0_x86_64.xml | 1 +
.../caps_7.2.0_x86_64+hvf.xml | 1 +
.../caps_7.2.0_x86_64.xml | 1 +
.../caps_8.0.0_x86_64.xml | 1 +
.../caps_8.1.0_x86_64.xml | 1 +
.../caps_8.2.0_x86_64.xml | 1 +
.../caps_9.0.0_x86_64.xml | 1 +
.../caps_9.1.0_x86_64.xml | 1 +
.../migration-out-nbd-bitmaps-in.xml | 1 +
...l-iommu-dma-translation.x86_64-latest.args | 34 +++++++++++++++++
...el-iommu-dma-translation.x86_64-latest.xml | 1 +
.../intel-iommu-dma-translation.xml | 37 +++++++++++++++++++
tests/qemuxmlconftest.c | 1 +
21 files changed, 120 insertions(+)
create mode 100644 tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.args
create mode 120000 tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/intel-iommu-dma-translation.xml
--
2.22.3
4 months, 2 weeks
[PATCH 0/3] tests: qemu: Update test cases and bump 9.1 caps dump
by Peter Krempa
Peter Krempa (3):
qemuxmlconftest: Add test for old-style NUMA memory specification
qemuxmlconftest: Don't use soon-to-be-removed machine types
qemucapabilitiesdata: Update data for qemu-9.1 dev cycle on x86_64
.../caps_9.1.0_x86_64.replies | 3796 +++++++++--------
.../caps_9.1.0_x86_64.xml | 162 +-
.../controller-usb-order.x86_64-latest.args | 2 +-
.../controller-usb-order.x86_64-latest.xml | 2 +-
.../qemuxmlconfdata/controller-usb-order.xml | 2 +-
...pu-numa-memory-oldstyle.x86_64-latest.args | 34 +
...cpu-numa-memory-oldstyle.x86_64-latest.xml | 36 +
.../cpu-numa-memory-oldstyle.xml | 27 +
...rbd-encryption-layering.x86_64-latest.args | 2 +-
...-rbd-encryption-layering.x86_64-latest.xml | 2 +-
.../disk-network-rbd-encryption-layering.xml | 2 +-
...rbd-encryption-luks-any.x86_64-latest.args | 2 +-
...-rbd-encryption-luks-any.x86_64-latest.xml | 2 +-
.../disk-network-rbd-encryption-luks-any.xml | 2 +-
...-network-rbd-encryption.x86_64-latest.args | 2 +-
...k-network-rbd-encryption.x86_64-latest.xml | 2 +-
.../disk-network-rbd-encryption.xml | 2 +-
tests/qemuxmlconfdata/luks-disk-invalid.xml | 2 +-
.../luks-disks-source.x86_64-latest.args | 2 +-
.../luks-disks-source.x86_64-latest.xml | 2 +-
tests/qemuxmlconfdata/luks-disks-source.xml | 2 +-
.../luks-disks.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/luks-disks.xml | 2 +-
...memory-default-hugepage.x86_64-latest.args | 2 +-
.../memfd-memory-default-hugepage.xml | 2 +-
.../memfd-memory-numa.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/memfd-memory-numa.xml | 2 +-
...vcpus-topology-mismatch.x86_64-latest.args | 8 +-
...avcpus-topology-mismatch.x86_64-latest.xml | 2 +-
.../numavcpus-topology-mismatch.xml | 2 +-
tests/qemuxmlconftest.c | 1 +
31 files changed, 2241 insertions(+), 1871 deletions(-)
create mode 100644 tests/qemuxmlconfdata/cpu-numa-memory-oldstyle.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/cpu-numa-memory-oldstyle.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/cpu-numa-memory-oldstyle.xml
--
2.45.2
4 months, 2 weeks
[PATCH 2/2] qemu: Introduce the ability to disable the built-in PS/2 controller
by Kamil Szczęk
A while back QEMU introduced a new machine option for disabling the
i8042 PS/2 controller (commit 4ccd5fe22feb95137d325f422016a6473)
which up until then was a built-in device included by all PC machine
type descendants unconditionally. This new option allowed users to
disable emulation of this controller, thus removing the default PS/2
peripherals. The rationale for why somebody might want to disable
PS/2 peripherals is explained in the aforementioned commit.
This introduces a new 'ps2' feature which, when disabled, results in
no implicit PS/2 bus input devices being automatically added to the
domain and addition of the 'i8042=off' machine option to the QEMU
command-line.
A notable side effect of disabling the i8042 controller in QEMU is that
the vmport device won't be created. For this reason we will not allow
setting the vmport feature if the ps2 feature is explicitly disabled.
Signed-off-by: Kamil Szczęk <kamil(a)szczek.dev>
---
docs/formatdomain.rst | 5 +++++
src/conf/domain_conf.c | 6 +++++-
src/conf/domain_conf.h | 1 +
src/conf/domain_validate.c | 23 +++++++++++++++++++++++
src/conf/schemas/domaincommon.rng | 5 +++++
src/qemu/qemu_capabilities.c | 21 +++++++++++++++++++++
src/qemu/qemu_capabilities.h | 4 ++++
src/qemu/qemu_command.c | 5 +++++
src/qemu/qemu_domain.c | 3 ++-
src/qemu/qemu_validate.c | 23 +++++++++++++++++++++++
10 files changed, 94 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index c56b739b23..3300a57393 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2262,6 +2262,11 @@ are:
exceptions when enabled (``on``). If the attribute is not defined, the
hypervisor default will be used.
:since:`Since 10.4.0` (QEMU/KVM and ARM virt guests only)
+``ps2``
+ Depending on the ``state`` attribute (values ``on``, ``off``) enable or
+ disable the emulation of a PS/2 controller used by ``ps2`` bus input devices.
+ If the attribute is not defined, the hypervisor default will be used.
+ :since:`Since 10.7.0` (QEMU only)
Time keeping
------------
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 86b563fbfb..19d14eb13d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -185,6 +185,7 @@ VIR_ENUM_IMPL(virDomainFeature,
"tcg",
"async-teardown",
"ras",
+ "ps2",
);
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@@ -17015,7 +17016,8 @@ virDomainFeaturesDefParse(virDomainDef *def,
case VIR_DOMAIN_FEATURE_HTM:
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
- case VIR_DOMAIN_FEATURE_RAS: {
+ case VIR_DOMAIN_FEATURE_RAS:
+ case VIR_DOMAIN_FEATURE_PS2: {
virTristateSwitch state;
if (virXMLPropTristateSwitch(nodes[i], "state",
@@ -20879,6 +20881,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
case VIR_DOMAIN_FEATURE_RAS:
+ case VIR_DOMAIN_FEATURE_PS2:
if (src->features[i] != dst->features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%1$s' differs: source: '%2$s', destination: '%3$s'"),
@@ -27670,6 +27673,7 @@ virDomainDefFormatFeatures(virBuffer *buf,
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
case VIR_DOMAIN_FEATURE_RAS:
+ case VIR_DOMAIN_FEATURE_PS2:
switch ((virTristateSwitch) def->features[i]) {
case VIR_TRISTATE_SWITCH_LAST:
case VIR_TRISTATE_SWITCH_ABSENT:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 95ddf5470e..5b9ed67232 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2181,6 +2181,7 @@ typedef enum {
VIR_DOMAIN_FEATURE_TCG,
VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN,
VIR_DOMAIN_FEATURE_RAS,
+ VIR_DOMAIN_FEATURE_PS2,
VIR_DOMAIN_FEATURE_LAST
} virDomainFeature;
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 39b8d67928..56f1092841 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2744,6 +2744,29 @@ virDomainInputDefValidate(const virDomainInputDef *input,
return -1;
}
+ switch ((virDomainInputBus) input->bus) {
+ case VIR_DOMAIN_INPUT_BUS_PS2:
+ if (def->features[VIR_DOMAIN_FEATURE_PS2] == VIR_TRISTATE_SWITCH_OFF) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("ps2 bus inputs require the ps2 feature not to be disabled"));
+ return -1;
+ }
+ break;
+
+ case VIR_DOMAIN_INPUT_BUS_DEFAULT:
+ case VIR_DOMAIN_INPUT_BUS_USB:
+ case VIR_DOMAIN_INPUT_BUS_XEN:
+ case VIR_DOMAIN_INPUT_BUS_PARALLELS:
+ case VIR_DOMAIN_INPUT_BUS_VIRTIO:
+ case VIR_DOMAIN_INPUT_BUS_NONE:
+ break;
+
+ case VIR_DOMAIN_INPUT_BUS_LAST:
+ default:
+ virReportEnumRangeError(virDomainInputBus, input->bus);
+ return -1;
+ }
+
return 0;
}
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 7d58dce465..9b6dddae81 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -6912,6 +6912,11 @@
<ref name="featurestate"/>
</element>
</optional>
+ <optional>
+ <element name="ps2">
+ <ref name="featurestate"/>
+ </element>
+ </optional>
</interleave>
</element>
</optional>
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 19a057d94d..4c135b2558 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -713,6 +713,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"sev-snp-guest", /* QEMU_CAPS_SEV_SNP_GUEST */
"netdev.user", /* QEMU_CAPS_NETDEV_USER */
"acpi-erst", /* QEMU_CAPS_DEVICE_ACPI_ERST */
+ "machine-i8042-opt", /* QEMU_CAPS_MACHINE_I8042_OPT */
);
@@ -1748,6 +1749,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsVirt[] = {
{ "ras", QEMU_CAPS_MACHINE_VIRT_RAS },
};
+static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsPC[] = {
+ { "i8042", QEMU_CAPS_MACHINE_I8042_OPT },
+};
+
static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsGeneric[] = {
{ "confidential-guest-support", QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT },
};
@@ -1759,6 +1764,9 @@ static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
{ "virt", virQEMUCapsMachinePropsVirt,
G_N_ELEMENTS(virQEMUCapsMachinePropsVirt),
-1 },
+ { "pc", virQEMUCapsMachinePropsPC,
+ G_N_ELEMENTS(virQEMUCapsMachinePropsPC),
+ -1 },
{ "none", virQEMUCapsMachinePropsGeneric,
G_N_ELEMENTS(virQEMUCapsMachinePropsGeneric),
-1 },
@@ -6026,6 +6034,19 @@ virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps,
STREQ(def->os.machine, "isapc");
}
+bool
+virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps,
+ const virDomainDef *def)
+{
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_I8042_OPT))
+ return false;
+
+ return qemuDomainIsI440FX(def) ||
+ qemuDomainIsQ35(def) ||
+ qemuDomainIsXenFV(def) ||
+ STREQ(def->os.machine, "isapc");
+}
+
/*
* The preferred machine to use if none is listed explicitly
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d77a4bf4d9..d21cbfbce4 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -692,6 +692,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_SEV_SNP_GUEST, /* -object sev-snp-guest */
QEMU_CAPS_NETDEV_USER, /* -netdev user */
QEMU_CAPS_DEVICE_ACPI_ERST, /* -device acpi-erst */
+ QEMU_CAPS_MACHINE_I8042_OPT, /* -machine xxx,i8042=on/off */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
@@ -720,6 +721,9 @@ bool virQEMUCapsSupportsVmport(virQEMUCaps *qemuCaps,
bool virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps,
const virDomainDef *def);
+bool virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps,
+ const virDomainDef *def);
+
const char *virQEMUCapsGetBinary(virQEMUCaps *qemuCaps);
virArch virQEMUCapsGetArch(virQEMUCaps *qemuCaps);
unsigned int virQEMUCapsGetVersion(virQEMUCaps *qemuCaps);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f15e6bda1e..53fbf49e20 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6887,6 +6887,11 @@ qemuAppendDomainFeaturesMachineParam(virBuffer *buf,
virBufferAsprintf(buf, ",ras=%s", str);
}
+ if (def->features[VIR_DOMAIN_FEATURE_PS2] != VIR_TRISTATE_SWITCH_ABSENT) {
+ const char *str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_PS2]);
+ virBufferAsprintf(buf, ",i8042=%s", str);
+ }
+
return 0;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 56f09699db..66b0caac24 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3926,7 +3926,8 @@ static int
qemuDomainDefAddImplicitInputDevice(virDomainDef *def,
virQEMUCaps *qemuCaps)
{
- if (virQEMUCapsSupportsI8042(qemuCaps, def)) {
+ if (virQEMUCapsSupportsI8042(qemuCaps, def) &&
+ def->features[VIR_DOMAIN_FEATURE_PS2] != VIR_TRISTATE_SWITCH_OFF) {
if (virDomainDefMaybeAddInput(def,
VIR_DOMAIN_INPUT_TYPE_MOUSE,
VIR_DOMAIN_INPUT_BUS_PS2) < 0)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 7730344c52..2007d040fe 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -143,6 +143,13 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
_("vmport is not available with this QEMU binary"));
return -1;
}
+
+ if (def->features[i] == VIR_TRISTATE_SWITCH_ON &&
+ def->features[VIR_DOMAIN_FEATURE_PS2] == VIR_TRISTATE_SWITCH_OFF) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("vmport feature requires the ps2 feature not to be disabled"));
+ return -1;
+ }
break;
case VIR_DOMAIN_FEATURE_VMCOREINFO:
@@ -242,6 +249,22 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
}
break;
+ case VIR_DOMAIN_FEATURE_PS2:
+ if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
+ !virQEMUCapsSupportsI8042(qemuCaps, def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("ps2 feature is not available with this QEMU binary"));
+ return -1;
+ }
+
+ if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
+ !virQEMUCapsSupportsI8042Toggle(qemuCaps, def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("ps2 feature state cannot be controlled with this QEMU binary"));
+ return -1;
+ }
+ break;
+
case VIR_DOMAIN_FEATURE_SMM:
case VIR_DOMAIN_FEATURE_KVM:
case VIR_DOMAIN_FEATURE_XEN:
--
2.45.0
4 months, 2 weeks