[PATCH 1/2] tests: qemu: use domain type 'kvm' for kvm-features-off
by zhenwei pi
KVM features off test cases should be tested for a KVM domain, so
keep align kvm-features-off test with kvm-features except KVM
features on/off.
Signed-off-by: zhenwei pi <pizhenwei(a)bytedance.com>
---
tests/qemuxml2argvdata/kvm-features-off.args | 4 ++--
tests/qemuxml2argvdata/kvm-features-off.xml | 5 +++--
tests/qemuxml2xmloutdata/kvm-features-off.xml | 7 +++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/qemuxml2argvdata/kvm-features-off.args b/tests/qemuxml2argvdata/kvm-features-off.args
index f6f13495e6..f7133bc0c3 100644
--- a/tests/qemuxml2argvdata/kvm-features-off.args
+++ b/tests/qemuxml2argvdata/kvm-features-off.args
@@ -11,7 +11,8 @@ QEMU_AUDIO_DRV=none \
-name guest=QEMUGuest1,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
--machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-machine pc,accel=kvm,usb=off,dump-guest-core=off \
+-cpu host \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \
@@ -25,5 +26,4 @@ QEMU_AUDIO_DRV=none \
-no-shutdown \
-boot strict=on \
-usb \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/kvm-features-off.xml b/tests/qemuxml2argvdata/kvm-features-off.xml
index d63a573239..7871698f06 100644
--- a/tests/qemuxml2argvdata/kvm-features-off.xml
+++ b/tests/qemuxml2argvdata/kvm-features-off.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
@@ -16,6 +16,7 @@
<poll-control state='off'/>
</kvm>
</features>
+ <cpu mode='host-passthrough' check='none'/>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
@@ -26,6 +27,6 @@
<controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
- <memballoon model='virtio'/>
+ <memballoon model='none'/>
</devices>
</domain>
diff --git a/tests/qemuxml2xmloutdata/kvm-features-off.xml b/tests/qemuxml2xmloutdata/kvm-features-off.xml
index f2e9407ac9..9c176190a5 100644
--- a/tests/qemuxml2xmloutdata/kvm-features-off.xml
+++ b/tests/qemuxml2xmloutdata/kvm-features-off.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
@@ -16,6 +16,7 @@
<poll-control state='off'/>
</kvm>
</features>
+ <cpu mode='host-passthrough' check='none' migratable='off'/>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
@@ -29,8 +30,6 @@
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
- <memballoon model='virtio'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
- </memballoon>
+ <memballoon model='none'/>
</devices>
</domain>
--
2.25.1
3 years
[PATCH v2 0/8] qemu: QAPI-schema: Add support for enum value 'features'
by Peter Krempa
Patches 2-8 were already reviewed by Michal. 1/8 is new as the qemu
functionality was just merged upstream.
Peter Krempa (8):
qemucapabilitiestest: Update capability probe for qemu-6.2 on x86_64
virQEMUQAPISchemaTraverseEnum: Move helper variables into loop
virQEMUQAPISchemaTraverseEnum: Use the modern 'members' array
virQEMUQAPISchemaTraverseEnum: Allow query of enume type features
testQEMUSchemaValidateEnum: Refactor logic to simplify switching to
new QMP schema format
testQEMUSchemaValidateEnum: Use new 'members' for 'enum' meta type
testQEMUSchemaValidateDeprecated: Move to the top
testQEMUSchemaValidateEnum: Validate deprecated members
src/qemu/qemu_qapi.c | 46 +-
.../caps_6.2.0.x86_64.replies | 3513 +++++++++++++++--
.../caps_6.2.0.x86_64.xml | 2 +-
tests/testutilsqemuschema.c | 130 +-
4 files changed, 3214 insertions(+), 477 deletions(-)
--
2.31.1
3 years
[PATCH v2] qemu_block: Refactor qemuBlockExportAddNBD()
by Kristina Hanicova
This is v2 of: https://listman.redhat.com/archives/libvir-list/2021-October/msg01035.html
Diff to v1:
* negation of 'if' with switched body (proposed by Peter)
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/qemu/qemu_block.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 34fdec2c4b..b8e70f6a83 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3592,28 +3592,21 @@ qemuBlockExportAddNBD(virDomainObj *vm,
const char *bitmap)
{
qemuDomainObjPrivate *priv = vm->privateData;
+ g_autoptr(virJSONValue) nbdprops = NULL;
+ const char *bitmaps[2] = { bitmap, NULL };
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_EXPORT_ADD)) {
- g_autoptr(virJSONValue) nbdprops = NULL;
- const char *bitmaps[2] = { bitmap, NULL };
+ /* older qemu versions didn't support configuring the exportname and
+ * took the 'drivealias' as the export name */
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
+ return qemuMonitorNBDServerAdd(priv->mon, drivealias, NULL, writable, NULL);
- if (!(nbdprops = qemuBlockExportGetNBDProps(src->nodeformat,
- exportname,
- writable,
- bitmaps)))
- return -1;
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_EXPORT_ADD))
+ return qemuMonitorNBDServerAdd(priv->mon, src->nodeformat,
+ exportname, writable, bitmap);
- return qemuMonitorBlockExportAdd(priv->mon, &nbdprops);
- } else {
- return qemuMonitorNBDServerAdd(priv->mon, src->nodeformat,
- exportname, writable, bitmap);
- }
- } else {
- /* older qemu versions didn't support configuring the exportname and
- * took the 'drivealias' as the export name */
- return qemuMonitorNBDServerAdd(priv->mon, drivealias, NULL, writable, NULL);
- }
+ if (!(nbdprops = qemuBlockExportGetNBDProps(src->nodeformat, exportname,
+ writable, bitmaps)))
+ return -1;
- return 0;
+ return qemuMonitorBlockExportAdd(priv->mon, &nbdprops);
}
--
2.31.1
3 years
[PATCH] virsh: Fix ambiguous output in metadata-change event
by Han Han
When you set metadata with type element like the following:
dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT, "<test/>", 'abc', "HAHAH", 0)
Then for `virsh event --all`, then it will output this message:
event 'metadata-change' for domain 'rhel9': element HAHAH
The message is ambiguous since it looks like the params for
metadata-change event is the element HAHAH. Actually that means the type is
element while the url is HAHAH. Let's make it more clear.
Signed-off-by: Han Han <hhan(a)redhat.com>
---
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7f3356a536..d454075dfc 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13317,7 +13317,7 @@ virshEventMetadataChangePrint(virConnectPtr conn G_GNUC_UNUSED,
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virBufferAsprintf(&buf, _("event 'metadata-change' for domain '%s': %s %s\n"),
+ virBufferAsprintf(&buf, _("event 'metadata-change' for domain '%s': type %s, uri %s\n"),
virDomainGetName(dom),
UNKNOWNSTR(virshEventMetadataChangeTypeTypeToString(type)),
NULLSTR(nsuri));
--
2.33.1
3 years
[PATCH 0/2] Unify calculation of ovs and tc.
by jx8zjs
For other interface type, values in tc rules are calculated by multiply by
8*1000 instead of 8*1024.
Related link:
https://listman.redhat.com/archives/libvir-list/2021-October/msg01121.html
zhangjl02 (2):
virnetdevopenvswitch: unify calculation of ovs and tc. For other
interface type, values in tc rules are calculated by multiply by
8*1000 instead of 8*1024.
virnetdevopenvswitchtest: fix inbound value calculation
src/util/virnetdevopenvswitch.c | 2 +-
tests/virnetdevopenvswitchtest.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.30.2.windows.1
3 years
[PATCH] ch_driver: Drop needless fwd declaration
by Michal Privoznik
In ch_driver.c there are two forward declarations that are not
needed. Drop them.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/ch/ch_driver.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 1824d2fd16..9eaf3ee499 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -47,11 +47,6 @@
VIR_LOG_INIT("ch.ch_driver");
-static int chStateInitialize(bool privileged,
- const char *root,
- virStateInhibitCallback callback,
- void *opaque);
-static int chStateCleanup(void);
virCHDriver *ch_driver = NULL;
static virDomainObj *
--
2.32.0
3 years
[PATCH 0/2] lib: Drop retval check for virCapabilitiesAddGuest{, Domain)()
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (2):
lib: Don't check for virCapabilitiesAddGuest() retval
lib: Don't check for virCapabilitiesAddGuestDomain() retval
src/bhyve/bhyve_capabilities.c | 13 ++++-----
src/ch/ch_conf.c | 20 +++-----------
src/esx/esx_driver.c | 14 +++-------
src/hyperv/hyperv_driver.c | 12 +++------
src/libxl/libxl_capabilities.c | 34 +++++++++---------------
src/lxc/lxc_conf.c | 38 ++++++---------------------
src/openvz/openvz_conf.c | 19 +++-----------
src/qemu/qemu_capabilities.c | 31 +++++-----------------
src/security/virt-aa-helper.c | 23 +++-------------
src/test/test_driver.c | 19 +++-----------
src/vbox/vbox_common.c | 18 +++----------
src/vmware/vmware_conf.c | 26 ++++++------------
src/vz/vz_driver.c | 8 +++---
tests/testutils.c | 41 ++++++++++++-----------------
tests/testutilslxc.c | 26 +++++++-----------
tests/testutilsqemu.c | 30 ++++++---------------
tests/testutilsxen.c | 48 +++++++++++++++-------------------
tests/vmx2xmltest.c | 38 +++++++--------------------
tests/xml2vmxtest.c | 39 +++++++--------------------
19 files changed, 147 insertions(+), 350 deletions(-)
--
2.32.0
3 years
[PATCH] qemu: tpm: Enable creation of certs for TPM 1.2 in non-privileged mode
by Stefan Berger
When 'swtpm_setup --print-capabilities' shows the 'tpm12-not-need-root'
flag, then it is possible to create certificates for the TPM 1.2 also
in non-privileged mode since swtpm_setup doesn't need tcsd anymore.
Check for this flag and create the certificates if this flag is found.
Signed-off-by: Stefan Berger <stefanb(a)linux.ibm.com>
---
src/qemu/qemu_tpm.c | 5 ++++-
src/util/virtpm.c | 1 +
src/util/virtpm.h | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index e1b08a66c5..91e21ae646 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -463,11 +463,14 @@ qemuTPMEmulatorRunSetup(const char *storagepath,
if (!swtpm_setup)
return -1;
- if (!privileged && tpmversion == VIR_DOMAIN_TPM_VERSION_1_2)
+ if (!privileged && tpmversion == VIR_DOMAIN_TPM_VERSION_1_2 &&
+ !virTPMSwtpmSetupCapsGet(
+ VIR_TPM_SWTPM_SETUP_FEATURE_TPM12_NOT_NEED_ROOT)) {
return virFileWriteStr(logfile,
_("Did not create EK and certificates since "
"this requires privileged mode for a "
"TPM 1.2\n"), 0600);
+ }
if (!privileged && qemuTPMCreateConfigFiles(swtpm_setup) < 0)
return -1;
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index 0f50de866c..40d9272e66 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -46,6 +46,7 @@ VIR_ENUM_IMPL(virTPMSwtpmSetupFeature,
VIR_TPM_SWTPM_SETUP_FEATURE_LAST,
"cmdarg-pwdfile-fd",
"cmdarg-create-config-files",
+ "tpm12-not-need-root",
);
/**
diff --git a/src/util/virtpm.h b/src/util/virtpm.h
index 3bb03b3b33..b75eb84f31 100644
--- a/src/util/virtpm.h
+++ b/src/util/virtpm.h
@@ -39,6 +39,7 @@ typedef enum {
typedef enum {
VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_PWDFILE_FD,
VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_CREATE_CONFIG_FILES,
+ VIR_TPM_SWTPM_SETUP_FEATURE_TPM12_NOT_NEED_ROOT,
VIR_TPM_SWTPM_SETUP_FEATURE_LAST
} virTPMSwtpmSetupFeature;
--
2.31.1
3 years
[PATCH] qemu: support kvm-pv-ipi off
by zhenwei pi
QEMU version 3.1 introduced PV_SEND_IPI CPUID feature bit under
commit 7f710c32bb8 (target-i386: adds PV_SEND_IPI CPUID feature bit).
This patch adds a new KVM feature 'pv-ipi' to disable this feature
(enabled by default). Newer CPU platform (Ex, AMD Zen2) supports
hardware accelation for IPI in guest, to use this feature to get
better performance in some scenarios. Detailed about the discussion:
https://lkml.org/lkml/2021/10/20/423
To disable kvm-pv-ipi and have libvirt add "-cpu host,kvm-pv-ipi=off"
to the QEMU command line, the following XML code needs to be added to the
guest's domain description:
<features>
<kvm>
<pv-ipi state='off'/>
</kvm>
</features>
Signed-off-by: zhenwei pi <pizhenwei(a)bytedance.com>
---
docs/formatdomain.rst | 2 ++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 3 +++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 5 +++++
5 files changed, 16 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 58768f7e5e..8ff833bbd2 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -1842,6 +1842,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
<hidden state='on'/>
<hint-dedicated state='on'/>
<poll-control state='on'/>
+ <pv-ipi state='off'/>
</kvm>
<xen>
<e820_host state='on'/>
@@ -1930,6 +1931,7 @@ are:
hidden Hide the KVM hypervisor from standard MSR based discovery on, off :since:`1.2.8 (QEMU 2.1.0)`
hint-dedicated Allows a guest to enable optimizations when running on dedicated vCPUs on, off :since:`5.7.0 (QEMU 2.12.0)`
poll-control Decrease IO completion latency by introducing a grace period of busy waiting on, off :since:`6.10.0 (QEMU 4.2)`
+ pv-ipi Paravirtualized send IPIs on, off :since:`7.10.0 (QEMU 3.1)`
============== ============================================================================ ======= ============================
``xen``
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f71e375a33..67df13d90d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -7177,6 +7177,11 @@
<ref name="featurestate"/>
</element>
</optional>
+ <optional>
+ <element name="pv-ipi">
+ <ref name="featurestate"/>
+ </element>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 48c6ee9865..c8868de577 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -204,6 +204,7 @@ VIR_ENUM_IMPL(virDomainKVM,
"hidden",
"hint-dedicated",
"poll-control",
+ "pv-ipi",
);
VIR_ENUM_IMPL(virDomainXen,
@@ -21789,6 +21790,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
case VIR_DOMAIN_KVM_HIDDEN:
case VIR_DOMAIN_KVM_DEDICATED:
case VIR_DOMAIN_KVM_POLLCONTROL:
+ case VIR_DOMAIN_KVM_PVIPI:
if (src->kvm_features[i] != dst->kvm_features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of KVM feature '%s' differs: "
@@ -27821,6 +27823,7 @@ virDomainDefFormatFeatures(virBuffer *buf,
case VIR_DOMAIN_KVM_HIDDEN:
case VIR_DOMAIN_KVM_DEDICATED:
case VIR_DOMAIN_KVM_POLLCONTROL:
+ case VIR_DOMAIN_KVM_PVIPI:
if (def->kvm_features[j])
virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
virDomainKVMTypeToString(j),
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f4be5c84f0..cb6d8975b8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2073,6 +2073,7 @@ typedef enum {
VIR_DOMAIN_KVM_HIDDEN = 0,
VIR_DOMAIN_KVM_DEDICATED,
VIR_DOMAIN_KVM_POLLCONTROL,
+ VIR_DOMAIN_KVM_PVIPI,
VIR_DOMAIN_KVM_LAST
} virDomainKVM;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7374b2beca..f7c19246d8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6848,6 +6848,11 @@ qemuBuildCpuCommandLine(virCommand *cmd,
virBufferAddLit(&buf, ",kvm-poll-control=on");
break;
+ case VIR_DOMAIN_KVM_PVIPI:
+ if (def->kvm_features[i] == VIR_TRISTATE_SWITCH_OFF)
+ virBufferAddLit(&buf, ",kvm-pv-ipi=off");
+ break;
+
case VIR_DOMAIN_KVM_LAST:
break;
}
--
2.25.1
3 years
[PATCH v2] qemu_agent: remove unused code
by Kristina Hanicova
This is v2 of: https://listman.redhat.com/archives/libvir-list/2021-October/msg01064.html
Diff to v1:
* I forgot to delete another part of the unused code which
belonged together (noticed by Jano)
This section of code was left unused ever since it was introduced
ten years ago. I think we can safely remove it.
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/qemu/qemu_agent.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5f421be6f6..f319b881fc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -60,17 +60,6 @@ VIR_LOG_INIT("qemu.qemu_agent");
*/
#define QEMU_AGENT_MAX_RESPONSE (10 * 1024 * 1024)
-/* When you are the first to uncomment this,
- * don't forget to uncomment the corresponding
- * part in qemuAgentIOProcessEvent as well.
- *
-static struct {
- const char *type;
- void (*handler)(qemuAgent *agent, virJSONValue *data);
-} eventHandlers[] = {
-};
-*/
-
typedef struct _qemuAgentMessage qemuAgentMessage;
struct _qemuAgentMessage {
char *txBuffer;
@@ -237,17 +226,6 @@ qemuAgentIOProcessEvent(qemuAgent *agent,
return -1;
}
-/*
- for (i = 0; i < G_N_ELEMENTS(eventHandlers); i++) {
- if (STREQ(eventHandlers[i].type, type)) {
- virJSONValue *data = virJSONValueObjectGet(obj, "data");
- VIR_DEBUG("handle %s handler=%p data=%p", type,
- eventHandlers[i].handler, data);
- (eventHandlers[i].handler)(agent, data);
- break;
- }
- }
-*/
return 0;
}
--
2.31.1
3 years