- remote: fix double free of migration params on error - qemu: avoid deadlock in qemuDomainObjStopWorker We are dropping the only reference here so that the event loop thread is going to be exited synchronously. In order to avoid deadlocks we need to unlock the VM so that any handler being called can finish execution and thus even loop thread be finished too. - virsh: add tmm main command word Add tmm command word into virsh tool to call get tmm memory info API. It makes virsh can use tmm main commmand to show tmm memory info on console. This command requires specific kernel and a kernel driver to make sure its regular function. If runnning environment missing the above reliance, this command will show error result on console. - libvirt: add get tmm memory info API and libvirtd RPC Add the get tmm memory info API into libvirt-host. Also should add the RPC calls into libvirtd for API calling. - libvirt: support the virtCCA feature Add cvm parameter into the type of LaunchSecurity which is a optional filed for libvirt xml. Its purpose is to pass the cvm parameter through to qemu. Also this patch support virsh edit to save cvm parameter into libvirt temporary xml. - qemu_driver: Add calc_mode for dirtyrate statistics - virsh: Add mode option to domdirtyrate-calc virsh api - qemu: Generate command line for dirty-ring-size - qemu: support dirty ring feature - conf: Turn virDomainDef.kvm_features into a struct - qemu_validate: Allow kvm hint-dedicated on non-passthrough VMs - virDomainFeaturesKVMDefParse: Remove tautological "if" - virDomainFeaturesKVMDefParse: Remove tautological "switch" - virxml: Add virXMLPropUInt - virxml: Add virXMLPropInt - virxml: Add virXMLPropTristateSwitch - virxml: Add virXMLPropTristateBool - virDomainFeaturesKVMDefParse: Remove ctxt - virDomainFeaturesDefParse: Factor out KVM parsing into separate function - internal.h: Introduce and use VIR_IS_POW2() - hotpatch: if hotpatch_path not in qemu.conf,the hotpatch doesn't antoload Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
105 lines
3.3 KiB
Diff
105 lines
3.3 KiB
Diff
From 78bfdbe8b72eb81fbe1e96b1e94a07a5944b0e97 Mon Sep 17 00:00:00 2001
|
|
From: Tim Wiederhake <twiederh@redhat.com>
|
|
Date: Fri, 16 Apr 2021 11:41:46 +0200
|
|
Subject: [PATCH] virxml: Add virXMLPropTristateSwitch
|
|
|
|
Convenience function to return the value of an on / off XML attribute.
|
|
|
|
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
|
|
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
Reviewed-by: Shaokun Wei <weishaokun@kylinos.cn>
|
|
---
|
|
src/libvirt_private.syms | 1 +
|
|
src/util/virxml.c | 44 ++++++++++++++++++++++++++++++++++++++++
|
|
src/util/virxml.h | 7 +++++++
|
|
3 files changed, 52 insertions(+)
|
|
|
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
index 42b3700d57..15924e69a5 100644
|
|
--- a/src/libvirt_private.syms
|
|
+++ b/src/libvirt_private.syms
|
|
@@ -3483,6 +3483,7 @@ virXMLPickShellSafeComment;
|
|
virXMLPropString;
|
|
virXMLPropStringLimit;
|
|
virXMLPropTristateBool;
|
|
+virXMLPropTristateSwitch;
|
|
virXMLSaveFile;
|
|
virXMLValidateAgainstSchema;
|
|
virXMLValidatorFree;
|
|
diff --git a/src/util/virxml.c b/src/util/virxml.c
|
|
index a1fe319e08..b7f8063497 100644
|
|
--- a/src/util/virxml.c
|
|
+++ b/src/util/virxml.c
|
|
@@ -603,6 +603,50 @@ virXMLPropTristateBool(xmlNodePtr node,
|
|
}
|
|
|
|
|
|
+/**
|
|
+ * virXMLPropTristateSwitch:
|
|
+ * @node: XML dom node pointer
|
|
+ * @name: Name of the property (attribute) to get
|
|
+ * @flags: Bitwise or of virXMLPropFlags
|
|
+ * @result: The returned value
|
|
+ *
|
|
+ * Convenience function to return value of an on / off attribute.
|
|
+ *
|
|
+ * Returns 1 in case of success in which case @result is set,
|
|
+ * or 0 if the attribute is not present,
|
|
+ * or -1 and reports an error on failure.
|
|
+ */
|
|
+int
|
|
+virXMLPropTristateSwitch(xmlNodePtr node,
|
|
+ const char* name,
|
|
+ virXMLPropFlags flags,
|
|
+ virTristateSwitch *result)
|
|
+{
|
|
+ g_autofree char *tmp = NULL;
|
|
+ int val;
|
|
+
|
|
+ if (!(tmp = virXMLPropString(node, name))) {
|
|
+ if (!(flags & VIR_XML_PROP_REQUIRED))
|
|
+ return 0;
|
|
+
|
|
+ virReportError(VIR_ERR_XML_ERROR,
|
|
+ _("Missing required attribute '%s' in element '%s'"),
|
|
+ name, node->name);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ if ((val = virTristateSwitchTypeFromString(tmp)) <= 0) {
|
|
+ virReportError(VIR_ERR_XML_ERROR,
|
|
+ _("Invalid value for attribute '%s' in element '%s': '%s'. Expected 'on' or 'off'"),
|
|
+ name, node->name, tmp);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ *result = val;
|
|
+ return 1;
|
|
+}
|
|
+
|
|
+
|
|
/**
|
|
* virXPathBoolean:
|
|
* @xpath: the XPath string to evaluate
|
|
diff --git a/src/util/virxml.h b/src/util/virxml.h
|
|
index 1d7070b98f..0cf293d5ae 100644
|
|
--- a/src/util/virxml.h
|
|
+++ b/src/util/virxml.h
|
|
@@ -94,6 +94,13 @@ virXMLPropTristateBool(xmlNodePtr node,
|
|
virTristateBool *result)
|
|
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
|
|
|
|
+int
|
|
+virXMLPropTristateSwitch(xmlNodePtr node,
|
|
+ const char *name,
|
|
+ virXMLPropFlags flags,
|
|
+ virTristateSwitch *result)
|
|
+ ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
|
|
+
|
|
/* Internal function; prefer the macros below. */
|
|
xmlDocPtr virXMLParseHelper(int domcode,
|
|
const char *filename,
|
|
--
|
|
2.27.0
|
|
|