[PATCH 0/2] qemu: Add some cpu hotpluggable infomation when run "virsh setvcpus command"
by Jidong Xia
The optional cpu attribute current can be used to specify whether
fewer than the maximum number of virtual CPUs should be enabled.
With this patch, when run "virsh setvcpus vm --count <current>"
with --live or --config, we can see some cpu information in vm xml.
Jidong Xia (1):
qemu: Add some cpu hotpluggable inforamtion in vm xml when run
"virsh setvcpus vm --count <current> --config;virsh destroy vm;
virsh start vm".
xiajidong (1):
qemu: Add some cpu hotpluggable inforamtion in vm xml when run
"virsh setvcpus vm --count <current> --live".
src/qemu/qemu_hotplug.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--
1.8.3.1
4 years, 8 months
[PATCH] qemucapstest: Refresh data for qemu 5.0 on x86_64
by Peter Krempa
Bump to v5.0.0-rc3-8-g3119154db0 and make sure that 'liburing' is picked
up by qemu.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../caps_5.0.0.x86_64.replies | 99 +++++++++++++++++--
.../caps_5.0.0.x86_64.xml | 68 ++++++++++++-
2 files changed, 156 insertions(+), 11 deletions(-)
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.replies
index af2299a41e..39b6d4f182 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.replies
@@ -17,11 +17,11 @@
{
"return": {
"qemu": {
- "micro": 91,
+ "micro": 93,
"minor": 2,
"major": 4
},
- "package": "v5.0.0-rc1"
+ "package": "v5.0.0-rc3-8-g3119154db0"
},
"id": "libvirt-2"
}
@@ -882,6 +882,10 @@
"name": "tpm-passthrough",
"parent": "tpm-backend"
},
+ {
+ "name": "Icelake-Server-v3-x86_64-cpu",
+ "parent": "x86_64-cpu"
+ },
{
"name": "pentium3-v1-x86_64-cpu",
"parent": "x86_64-cpu"
@@ -1291,8 +1295,8 @@
"parent": "base-xhci"
},
{
- "name": "pc-i440fx-2.6-machine",
- "parent": "generic-pc-machine"
+ "name": "mioe3680_pci",
+ "parent": "pci-device"
},
{
"name": "i82551",
@@ -1315,11 +1319,11 @@
"parent": "pci-ide"
},
{
- "name": "nvme",
- "parent": "pci-device"
+ "name": "pc-i440fx-2.6-machine",
+ "parent": "generic-pc-machine"
},
{
- "name": "vmxnet3",
+ "name": "nvme",
"parent": "pci-device"
},
{
@@ -1327,7 +1331,7 @@
"parent": "object"
},
{
- "name": "mioe3680_pci",
+ "name": "vmxnet3",
"parent": "pci-device"
},
{
@@ -9055,6 +9059,39 @@
"static": false,
"migration-safe": true
},
+ {
+ "name": "Icelake-Server-v3",
+ "typename": "Icelake-Server-v3-x86_64-cpu",
+ "unavailable-features": [
+ "avx512f",
+ "avx512dq",
+ "clwb",
+ "avx512cd",
+ "avx512bw",
+ "avx512vl",
+ "avx512vbmi",
+ "pku",
+ "avx512vbmi2",
+ "gfni",
+ "vaes",
+ "vpclmulqdq",
+ "avx512vnni",
+ "avx512bitalg",
+ "avx512-vpopcntdq",
+ "la57",
+ "wbnoinvd",
+ "avx512f",
+ "avx512f",
+ "avx512f",
+ "pku",
+ "rdctl-no",
+ "ibrs-all",
+ "mds-no",
+ "taa-no"
+ ],
+ "static": false,
+ "migration-safe": true
+ },
{
"name": "Icelake-Server-v2",
"typename": "Icelake-Server-v2-x86_64-cpu",
@@ -22244,7 +22281,8 @@
"meta-type": "enum",
"values": [
"threads",
- "native"
+ "native",
+ "io_uring"
]
},
{
@@ -26527,6 +26565,49 @@
"static": false,
"migration-safe": true
},
+ {
+ "name": "Icelake-Server-v3",
+ "typename": "Icelake-Server-v3-x86_64-cpu",
+ "unavailable-features": [
+ "fma",
+ "pcid",
+ "x2apic",
+ "tsc-deadline",
+ "avx",
+ "f16c",
+ "avx2",
+ "invpcid",
+ "avx512f",
+ "avx512dq",
+ "rdseed",
+ "avx512cd",
+ "avx512bw",
+ "avx512vl",
+ "avx512vbmi",
+ "umip",
+ "avx512vbmi2",
+ "gfni",
+ "vaes",
+ "vpclmulqdq",
+ "avx512vnni",
+ "avx512bitalg",
+ "avx512-vpopcntdq",
+ "spec-ctrl",
+ "arch-capabilities",
+ "ssbd",
+ "3dnowprefetch",
+ "wbnoinvd",
+ "xsavec",
+ "rdctl-no",
+ "ibrs-all",
+ "skip-l1dfl-vmentry",
+ "mds-no",
+ "pschange-mc-no",
+ "taa-no"
+ ],
+ "static": false,
+ "migration-safe": true
+ },
{
"name": "Icelake-Server-v2",
"typename": "Icelake-Server-v2-x86_64-cpu",
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
index 496d0e90d7..d524340843 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
@@ -230,10 +230,10 @@
<flag name='fsdev.multidevs'/>
<flag name='virtio.packed'/>
<flag name='pcie-root-port.hotplug'/>
- <version>4002091</version>
+ <version>4002093</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>
- <package>v5.0.0-rc1</package>
+ <package>v5.0.0-rc3-8-g3119154db0</package>
<arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'>
<property name='vmx-entry-load-rtit-ctl' type='boolean' value='false'/>
@@ -780,6 +780,33 @@
<cpu type='kvm' name='IvyBridge-v1' typename='IvyBridge-v1-x86_64-cpu' usable='yes'/>
<cpu type='kvm' name='IvyBridge-IBRS' typename='IvyBridge-IBRS-x86_64-cpu' usable='yes'/>
<cpu type='kvm' name='IvyBridge' typename='IvyBridge-x86_64-cpu' usable='yes'/>
+ <cpu type='kvm' name='Icelake-Server-v3' typename='Icelake-Server-v3-x86_64-cpu' usable='no'>
+ <blocker name='avx512f'/>
+ <blocker name='avx512dq'/>
+ <blocker name='clwb'/>
+ <blocker name='avx512cd'/>
+ <blocker name='avx512bw'/>
+ <blocker name='avx512vl'/>
+ <blocker name='avx512vbmi'/>
+ <blocker name='pku'/>
+ <blocker name='avx512vbmi2'/>
+ <blocker name='gfni'/>
+ <blocker name='vaes'/>
+ <blocker name='vpclmulqdq'/>
+ <blocker name='avx512vnni'/>
+ <blocker name='avx512bitalg'/>
+ <blocker name='avx512-vpopcntdq'/>
+ <blocker name='la57'/>
+ <blocker name='wbnoinvd'/>
+ <blocker name='avx512f'/>
+ <blocker name='avx512f'/>
+ <blocker name='avx512f'/>
+ <blocker name='pku'/>
+ <blocker name='rdctl-no'/>
+ <blocker name='ibrs-all'/>
+ <blocker name='mds-no'/>
+ <blocker name='taa-no'/>
+ </cpu>
<cpu type='kvm' name='Icelake-Server-v2' typename='Icelake-Server-v2-x86_64-cpu' usable='no'>
<blocker name='avx512f'/>
<blocker name='avx512dq'/>
@@ -1978,6 +2005,43 @@
<blocker name='avx'/>
<blocker name='f16c'/>
</cpu>
+ <cpu type='tcg' name='Icelake-Server-v3' typename='Icelake-Server-v3-x86_64-cpu' usable='no'>
+ <blocker name='fma'/>
+ <blocker name='pcid'/>
+ <blocker name='x2apic'/>
+ <blocker name='tsc-deadline'/>
+ <blocker name='avx'/>
+ <blocker name='f16c'/>
+ <blocker name='avx2'/>
+ <blocker name='invpcid'/>
+ <blocker name='avx512f'/>
+ <blocker name='avx512dq'/>
+ <blocker name='rdseed'/>
+ <blocker name='avx512cd'/>
+ <blocker name='avx512bw'/>
+ <blocker name='avx512vl'/>
+ <blocker name='avx512vbmi'/>
+ <blocker name='umip'/>
+ <blocker name='avx512vbmi2'/>
+ <blocker name='gfni'/>
+ <blocker name='vaes'/>
+ <blocker name='vpclmulqdq'/>
+ <blocker name='avx512vnni'/>
+ <blocker name='avx512bitalg'/>
+ <blocker name='avx512-vpopcntdq'/>
+ <blocker name='spec-ctrl'/>
+ <blocker name='arch-capabilities'/>
+ <blocker name='ssbd'/>
+ <blocker name='3dnowprefetch'/>
+ <blocker name='wbnoinvd'/>
+ <blocker name='xsavec'/>
+ <blocker name='rdctl-no'/>
+ <blocker name='ibrs-all'/>
+ <blocker name='skip-l1dfl-vmentry'/>
+ <blocker name='mds-no'/>
+ <blocker name='pschange-mc-no'/>
+ <blocker name='taa-no'/>
+ </cpu>
<cpu type='tcg' name='Icelake-Server-v2' typename='Icelake-Server-v2-x86_64-cpu' usable='no'>
<blocker name='fma'/>
<blocker name='pcid'/>
--
2.25.1
4 years, 8 months
[libvirt-python PATCH v2] setup: require python >= 3.5 to build
by Daniel P. Berrangé
Pytjon 3.5 is the oldest Python version available across our supported
build platforms.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
setup.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 56b6eea..39a07de 100755
--- a/setup.py
+++ b/setup.py
@@ -17,8 +17,8 @@ import re
import shutil
import time
-if sys.version_info[0] != 3:
- print("libvirt-python requires Python 3.x to build")
+if sys.version_info < (3, 5):
+ print("libvirt-python requires Python >= 3.5 to build")
sys.exit(1)
MIN_LIBVIRT = "0.9.11"
@@ -368,5 +368,9 @@ of recent versions of Linux (and other OSes).''',
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
]
)
--
2.25.2
4 years, 8 months
[libvirt PATCH] virsh: Fix return code for dump and migrate
by Andrea Bolognani
When the job monitoring logic was refactored, these two commands
were not converted properly and the result is that a successful
dump or migration (char '0') would be reported as a failed one
(int 48) instead.
Fixes: dc0771cfa2e78ffecd7c8234538ee548748d7bef
Reported-by: Brian Rak <brak(a)gameservers.com>
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
tools/virsh-domain.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d52eb7bc2f..502685f44b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5436,7 +5436,6 @@ static const vshCmdOptDef opts_dump[] = {
static void
doDump(void *opaque)
{
- char ret = '1';
virshCtrlData *data = opaque;
vshControl *ctl = data->ctl;
const vshCmd *cmd = data->cmd;
@@ -5508,7 +5507,7 @@ doDump(void *opaque)
}
}
- ret = '0';
+ data->ret = 0;
out:
#ifndef WIN32
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
@@ -5516,7 +5515,6 @@ doDump(void *opaque)
#endif /* !WIN32 */
if (dom)
virshDomainFree(dom);
- data->ret = ret;
g_main_loop_quit(data->eventLoop);
}
@@ -10722,7 +10720,6 @@ static const vshCmdOptDef opts_migrate[] = {
static void
doMigrate(void *opaque)
{
- char ret = '1';
virDomainPtr dom = NULL;
const char *desturi = NULL;
const char *opt = NULL;
@@ -11001,14 +10998,14 @@ doMigrate(void *opaque)
if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
- ret = '0';
+ data->ret = 0;
} else {
/* For traditional live migration, connect to the destination host directly. */
virDomainPtr ddom = NULL;
if ((ddom = virDomainMigrate3(dom, dconn, params, nparams, flags))) {
virshDomainFree(ddom);
- ret = '0';
+ data->ret = 0;
}
}
@@ -11019,7 +11016,6 @@ doMigrate(void *opaque)
#endif /* !WIN32 */
virTypedParamsFree(params, nparams);
virshDomainFree(dom);
- data->ret = ret;
g_main_loop_quit(data->eventLoop);
return;
--
2.25.3
4 years, 8 months
[libvirt PATCH 0/6] Some slirp/dbus related fixes
by marcandre.lureau@redhat.com
From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Hi,
Here is a subset of the series posted earlier "RFC: basic CGroup
support with qemu:///session", as requested by Pavel.
Marc-André Lureau (6):
slirp: leave the dbus daemon running on error
slirp: add helper to VM cgroup
qemu-dbus: prevent double start of the bus daemon
qemu-dbus: remove unused variable
qemu-dbus: register DBus bus to the VM cgroup
qemu-cgroup: remove unnecessary include
src/qemu/qemu_cgroup.c | 1 -
src/qemu/qemu_dbus.c | 29 +++++++++++++++++++++++++++--
src/qemu/qemu_dbus.h | 3 +++
src/qemu/qemu_extdevice.c | 12 ++++++++++++
src/qemu/qemu_slirp.c | 16 +++++++++++++++-
src/qemu/qemu_slirp.h | 3 +++
6 files changed, 60 insertions(+), 4 deletions(-)
--
2.26.0.106.g9fadedd637
4 years, 8 months
[libvirt PATCH v3 0/5] QEMU: support QEMU built without TCG
by Tobin Feldman-Fitzthum
Rebased and resent from about a month ago.
Since version 2.10, QEMU can be built without TCG. This patch
adds capabillity QEMU_CAPS_TCG_DISABLED that allows libvirt
to use a QEMU built without TCG.
Rather than create a capability that is set whenever TCG is
enabled (almost always), QEMU_CAPS_TCG_DISABLED is set only
when the TCG is not available. This avoids some issues
with backwards compatability.
For a domain that was created using QEMU >= 2.10 with KVM,
there is no information in the cached XML file that says
whether or not TCG was enabled. Versions of QEMU older
than 2.10 do not have a QMP interface for determining
whether QEMU is available. Since QEMU_CAPS_TCG_DISABLED
is set only when TCG is disabled, we do not have to do any
extra work to infer an appropriate value in either of these
cases.
QEMU_CAPS_TCG_DISABLED is set via QMP command qom-list-types.
Tobin Feldman-Fitzthum (5):
add QEMU_CAPS_TCG_DISABLED and probe conditionally
add virQEMUCapsGetVirtType convenience function
add virQEMUCapsProbeQMPTCGState function to set QEMU_CAPS_TCG_DISABLED
use new functions when probing
Add second qom-list-types call to test data.
src/qemu/qemu_capabilities.c | 81 +-
src/qemu/qemu_capabilities.h | 3 +
.../caps_2.10.0.aarch64.replies | 2699 ++-
.../caps_2.10.0.ppc64.replies | 2799 +++-
.../caps_2.10.0.s390x.replies | 1027 +-
.../caps_2.10.0.x86_64.replies | 1708 +-
.../caps_2.11.0.s390x.replies | 1063 +-
.../caps_2.11.0.x86_64.replies | 1692 +-
.../caps_2.12.0.aarch64.replies | 2912 +++-
.../caps_2.12.0.ppc64.replies | 2947 +++-
.../caps_2.12.0.s390x.replies | 1087 +-
.../caps_2.12.0.x86_64.replies | 1767 +-
.../caps_3.0.0.ppc64.replies | 2979 +++-
.../caps_3.0.0.s390x.replies | 1117 +-
.../caps_3.0.0.x86_64.replies | 1783 +-
.../caps_3.1.0.ppc64.replies | 2999 +++-
.../caps_3.1.0.x86_64.replies | 1803 +-
.../caps_4.0.0.aarch64.replies | 3175 +++-
.../caps_4.0.0.ppc64.replies | 3171 +++-
.../caps_4.0.0.s390x.replies | 1259 +-
.../caps_4.0.0.x86_64.replies | 1915 ++-
.../caps_4.1.0.x86_64.replies | 2155 ++-
.../caps_4.2.0.aarch64.replies | 3355 +++-
.../caps_4.2.0.ppc64.replies | 3208 +++-
.../caps_4.2.0.s390x.replies | 1264 +-
.../caps_4.2.0.x86_64.replies | 2244 ++-
.../caps_5.0.0.aarch64.replies | 3391 +++-
.../caps_5.0.0.ppc64.replies | 13986 +++++++++-------
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1214 +-
.../caps_5.0.0.x86_64.replies | 2267 ++-
30 files changed, 64897 insertions(+), 8173 deletions(-)
--
2.20.1 (Apple Git-117)
4 years, 8 months
[libvirt PATCH] conf: split out virDomainFeaturesDefParse
by Ján Tomko
The virDomainDefParseXML function has grown so large it broke the build:
../../src/conf/domain_conf.c:20362:1: error: stack frame size of 4168 bytes
in function 'virDomainDefParseXML' [-Werror,-Wframe-larger-than=]
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Technically a build breaker fix. I'm sure I will regret not having it
pushed as such tomorrow.
Formatted with patience.
src/conf/domain_conf.c | 965 +++++++++++++++++++++--------------------
1 file changed, 492 insertions(+), 473 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9f3362c934..d9c4b487a8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19181,6 +19181,496 @@ virDomainResourceDefParse(xmlNodePtr node,
return NULL;
}
+
+static int virDomainFeaturesDefParse(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
+{
+ g_autofree xmlNodePtr *nodes = NULL;
+ g_autofree char *tmp = NULL;
+ xmlNodePtr node = NULL;
+ int n, gic_version;
+ size_t i;
+
+ if ((n = virXPathNodeSet("./features/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
+ if (val < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unexpected feature '%s'"), nodes[i]->name);
+ goto error;
+ }
+
+ switch ((virDomainFeature) val) {
+ case VIR_DOMAIN_FEATURE_APIC:
+ if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
+ int eoi;
+ if ((eoi = virTristateSwitchTypeFromString(tmp)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown value for attribute eoi: '%s'"),
+ tmp);
+ goto error;
+ }
+ def->apic_eoi = eoi;
+ VIR_FREE(tmp);
+ }
+ G_GNUC_FALLTHROUGH;
+ case VIR_DOMAIN_FEATURE_ACPI:
+ case VIR_DOMAIN_FEATURE_PAE:
+ case VIR_DOMAIN_FEATURE_VIRIDIAN:
+ case VIR_DOMAIN_FEATURE_PRIVNET:
+ case VIR_DOMAIN_FEATURE_HYPERV:
+ case VIR_DOMAIN_FEATURE_KVM:
+ case VIR_DOMAIN_FEATURE_MSRS:
+ case VIR_DOMAIN_FEATURE_XEN:
+ def->features[val] = VIR_TRISTATE_SWITCH_ON;
+ break;
+
+ case VIR_DOMAIN_FEATURE_CAPABILITIES:
+ if ((tmp = virXMLPropString(nodes[i], "policy"))) {
+ if ((def->features[val] = virDomainCapabilitiesPolicyTypeFromString(tmp)) == -1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown policy attribute '%s' of feature '%s'"),
+ tmp, virDomainFeatureTypeToString(val));
+ goto error;
+ }
+ VIR_FREE(tmp);
+ } else {
+ def->features[val] = VIR_TRISTATE_SWITCH_ABSENT;
+ }
+ break;
+
+ case VIR_DOMAIN_FEATURE_VMCOREINFO:
+ case VIR_DOMAIN_FEATURE_HAP:
+ case VIR_DOMAIN_FEATURE_PMU:
+ case VIR_DOMAIN_FEATURE_PVSPINLOCK:
+ case VIR_DOMAIN_FEATURE_VMPORT:
+ case VIR_DOMAIN_FEATURE_SMM:
+ if ((tmp = virXMLPropString(nodes[i], "state"))) {
+ if ((def->features[val] = virTristateSwitchTypeFromString(tmp)) == -1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown state attribute '%s' of feature '%s'"),
+ tmp, virDomainFeatureTypeToString(val));
+ goto error;
+ }
+ VIR_FREE(tmp);
+ } else {
+ def->features[val] = VIR_TRISTATE_SWITCH_ON;
+ }
+ break;
+
+ case VIR_DOMAIN_FEATURE_GIC:
+ if ((tmp = virXMLPropString(nodes[i], "version"))) {
+ gic_version = virGICVersionTypeFromString(tmp);
+ if (gic_version < 0 || gic_version == VIR_GIC_VERSION_NONE) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("malformed gic version: %s"), tmp);
+ goto error;
+ }
+ def->gic_version = gic_version;
+ VIR_FREE(tmp);
+ }
+ def->features[val] = VIR_TRISTATE_SWITCH_ON;
+ break;
+
+ case VIR_DOMAIN_FEATURE_IOAPIC:
+ tmp = virXMLPropString(nodes[i], "driver");
+ if (tmp) {
+ int value = virDomainIOAPICTypeFromString(tmp);
+ if (value < 0 || value == VIR_DOMAIN_IOAPIC_NONE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown driver mode: %s"),
+ tmp);
+ goto error;
+ }
+ def->features[val] = value;
+ VIR_FREE(tmp);
+ }
+ break;
+
+ case VIR_DOMAIN_FEATURE_HPT:
+ tmp = virXMLPropString(nodes[i], "resizing");
+ if (tmp) {
+ int value = virDomainHPTResizingTypeFromString(tmp);
+ if (value < 0 || value == VIR_DOMAIN_HPT_RESIZING_NONE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown HPT resizing setting: %s"),
+ tmp);
+ goto error;
+ }
+ def->hpt_resizing = (virDomainHPTResizing) value;
+ VIR_FREE(tmp);
+ }
+
+ if (virDomainParseScaledValue("./features/hpt/maxpagesize",
+ NULL,
+ ctxt,
+ &def->hpt_maxpagesize,
+ 1024,
+ ULLONG_MAX,
+ false) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s",
+ _("Unable to parse HPT maxpagesize setting"));
+ goto error;
+ }
+ def->hpt_maxpagesize = VIR_DIV_UP(def->hpt_maxpagesize, 1024);
+
+ if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE ||
+ def->hpt_maxpagesize > 0) {
+ def->features[val] = VIR_TRISTATE_SWITCH_ON;
+ }
+ break;
+
+ case VIR_DOMAIN_FEATURE_HTM:
+ case VIR_DOMAIN_FEATURE_NESTED_HV:
+ case VIR_DOMAIN_FEATURE_CCF_ASSIST:
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing state attribute '%s' of feature '%s'"),
+ tmp, virDomainFeatureTypeToString(val));
+ goto error;
+ }
+ if ((def->features[val] = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown state attribute '%s' of feature '%s'"),
+ tmp, virDomainFeatureTypeToString(val));
+ goto error;
+ }
+ VIR_FREE(tmp);
+ break;
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_FEATURE_LAST:
+ break;
+ }
+ }
+ VIR_FREE(nodes);
+
+ if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
+ int feature;
+ int value;
+ node = ctxt->node;
+ if ((n = virXPathNodeSet("./features/hyperv/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ feature = virDomainHypervTypeFromString((const char *)nodes[i]->name);
+ if (feature < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported HyperV Enlightenment feature: %s"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ ctxt->node = nodes[i];
+
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing 'state' attribute for "
+ "HyperV Enlightenment feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value of state argument "
+ "for HyperV Enlightenment feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ VIR_FREE(tmp);
+ def->hyperv_features[feature] = value;
+
+ switch ((virDomainHyperv) feature) {
+ case VIR_DOMAIN_HYPERV_RELAXED:
+ case VIR_DOMAIN_HYPERV_VAPIC:
+ case VIR_DOMAIN_HYPERV_VPINDEX:
+ case VIR_DOMAIN_HYPERV_RUNTIME:
+ case VIR_DOMAIN_HYPERV_SYNIC:
+ case VIR_DOMAIN_HYPERV_STIMER:
+ case VIR_DOMAIN_HYPERV_RESET:
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
+ case VIR_DOMAIN_HYPERV_IPI:
+ case VIR_DOMAIN_HYPERV_EVMCS:
+ break;
+
+ case VIR_DOMAIN_HYPERV_SPINLOCKS:
+ if (value != VIR_TRISTATE_SWITCH_ON)
+ break;
+
+ if (virXPathUInt("string(./@retries)", ctxt,
+ &def->hyperv_spinlocks) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("invalid HyperV spinlock retry count"));
+ goto error;
+ }
+
+ if (def->hyperv_spinlocks < 0xFFF) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("HyperV spinlock retry count must be "
+ "at least 4095"));
+ goto error;
+ }
+ break;
+
+ case VIR_DOMAIN_HYPERV_VENDOR_ID:
+ if (value != VIR_TRISTATE_SWITCH_ON)
+ break;
+
+ if (!(def->hyperv_vendor_id = virXMLPropString(nodes[i],
+ "value"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing 'value' attribute for "
+ "HyperV feature 'vendor_id'"));
+ goto error;
+ }
+
+ if (strlen(def->hyperv_vendor_id) > VIR_DOMAIN_HYPERV_VENDOR_ID_MAX) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("HyperV vendor_id value must not be more "
+ "than %d characters."),
+ VIR_DOMAIN_HYPERV_VENDOR_ID_MAX);
+ goto error;
+ }
+
+ /* ensure that the string can be passed to qemu */
+ if (strchr(def->hyperv_vendor_id, ',')) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("HyperV vendor_id value is invalid"));
+ goto error;
+ }
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_HYPERV_LAST:
+ break;
+ }
+ }
+ VIR_FREE(nodes);
+ ctxt->node = node;
+ }
+
+ if (def->features[VIR_DOMAIN_HYPERV_STIMER] == VIR_TRISTATE_SWITCH_ON) {
+ int value;
+ if ((n = virXPathNodeSet("./features/hyperv/stimer/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ if (STRNEQ((const char *)nodes[i]->name, "direct")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported Hyper-V stimer feature: %s"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing 'state' attribute for "
+ "Hyper-V stimer '%s' feature"), "direct");
+ goto error;
+ }
+
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value of state argument "
+ "for Hyper-V stimer '%s' feature"), "direct");
+ goto error;
+ }
+
+ VIR_FREE(tmp);
+ def->hyperv_stimer_direct = value;
+ }
+ VIR_FREE(nodes);
+ }
+
+ if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
+ int feature;
+ int value;
+ if ((n = virXPathNodeSet("./features/kvm/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ feature = virDomainKVMTypeFromString((const char *)nodes[i]->name);
+ if (feature < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported KVM feature: %s"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ switch ((virDomainKVM) feature) {
+ case VIR_DOMAIN_KVM_HIDDEN:
+ case VIR_DOMAIN_KVM_DEDICATED:
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing 'state' attribute for "
+ "KVM feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value of state argument "
+ "for KVM feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ VIR_FREE(tmp);
+ def->kvm_features[feature] = value;
+ break;
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_KVM_LAST:
+ break;
+ }
+ }
+ VIR_FREE(nodes);
+ }
+
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ int feature;
+ int value;
+ g_autofree char *ptval = NULL;
+
+ if ((n = virXPathNodeSet("./features/xen/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ feature = virDomainXenTypeFromString((const char *)nodes[i]->name);
+ if (feature < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported Xen feature: %s"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing 'state' attribute for "
+ "Xen feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value of state argument "
+ "for Xen feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ VIR_FREE(tmp);
+ def->xen_features[feature] = value;
+
+ switch ((virDomainXen) feature) {
+ case VIR_DOMAIN_XEN_E820_HOST:
+ break;
+
+ case VIR_DOMAIN_XEN_PASSTHROUGH:
+ if (value != VIR_TRISTATE_SWITCH_ON)
+ break;
+
+ if ((ptval = virXMLPropString(nodes[i], "mode"))) {
+ int mode = virDomainXenPassthroughModeTypeFromString(ptval);
+
+ if (mode < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported mode '%s' for Xen passthrough feature"),
+ ptval);
+ goto error;
+ }
+
+ if (mode != VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT &&
+ mode != VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'mode' attribute for Xen feature "
+ "'passthrough' must be 'sync_pt' or 'share_pt'"));
+ goto error;
+ }
+ def->xen_passthrough_mode = mode;
+ }
+ break;
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_XEN_LAST:
+ break;
+ }
+ }
+ VIR_FREE(nodes);
+ }
+
+ if (def->features[VIR_DOMAIN_FEATURE_SMM] == VIR_TRISTATE_SWITCH_ON) {
+ int rv = virDomainParseScaledValue("string(./features/smm/tseg)",
+ "string(./features/smm/tseg/@unit)",
+ ctxt,
+ &def->tseg_size,
+ 1024 * 1024, /* Defaults to mebibytes */
+ ULLONG_MAX,
+ false);
+ if (rv < 0)
+ goto error;
+ def->tseg_specified = rv;
+ }
+
+ if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) {
+ if ((node = virXPathNode("./features/msrs", ctxt)) == NULL)
+ goto error;
+
+ if (!(tmp = virXMLPropString(node, "unknown"))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing 'unknown' attribute for feature '%s'"),
+ virDomainFeatureTypeToString(VIR_DOMAIN_FEATURE_MSRS));
+ goto error;
+ }
+
+ if ((def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] = virDomainMsrsUnknownTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown 'unknown' value '%s'"),
+ tmp);
+ goto error;
+ }
+ VIR_FREE(tmp);
+ }
+
+ if ((n = virXPathNodeSet("./features/capabilities/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ int val = virDomainProcessCapsFeatureTypeFromString((const char *)nodes[i]->name);
+ if (val < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unexpected capability feature '%s'"), nodes[i]->name);
+ goto error;
+ }
+
+ if ((tmp = virXMLPropString(nodes[i], "state"))) {
+ if ((def->caps_features[val] = virTristateSwitchTypeFromString(tmp)) == -1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown state attribute '%s' of feature capability '%s'"),
+ tmp, virDomainProcessCapsFeatureTypeToString(val));
+ goto error;
+ }
+ VIR_FREE(tmp);
+ } else {
+ def->caps_features[val] = VIR_TRISTATE_SWITCH_ON;
+ }
+ }
+ VIR_FREE(nodes);
+ return 0;
+
+ error:
+ return -1;
+}
+
+
static int
virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
{
@@ -20366,7 +20856,7 @@ virDomainDefParseXML(xmlDocPtr xml,
{
xmlNodePtr node = NULL;
size_t i, j;
- int n, gic_version;
+ int n;
long id = -1;
virDomainDefPtr def;
bool uuid_generated = false;
@@ -20844,480 +21334,9 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./features/*", ctxt, &nodes)) < 0)
+ if (virDomainFeaturesDefParse(def, ctxt) < 0)
goto error;
- for (i = 0; i < n; i++) {
- int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
- if (val < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unexpected feature '%s'"), nodes[i]->name);
- goto error;
- }
-
- switch ((virDomainFeature) val) {
- case VIR_DOMAIN_FEATURE_APIC:
- if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
- int eoi;
- if ((eoi = virTristateSwitchTypeFromString(tmp)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown value for attribute eoi: '%s'"),
- tmp);
- goto error;
- }
- def->apic_eoi = eoi;
- VIR_FREE(tmp);
- }
- G_GNUC_FALLTHROUGH;
- case VIR_DOMAIN_FEATURE_ACPI:
- case VIR_DOMAIN_FEATURE_PAE:
- case VIR_DOMAIN_FEATURE_VIRIDIAN:
- case VIR_DOMAIN_FEATURE_PRIVNET:
- case VIR_DOMAIN_FEATURE_HYPERV:
- case VIR_DOMAIN_FEATURE_KVM:
- case VIR_DOMAIN_FEATURE_MSRS:
- case VIR_DOMAIN_FEATURE_XEN:
- def->features[val] = VIR_TRISTATE_SWITCH_ON;
- break;
-
- case VIR_DOMAIN_FEATURE_CAPABILITIES:
- if ((tmp = virXMLPropString(nodes[i], "policy"))) {
- if ((def->features[val] = virDomainCapabilitiesPolicyTypeFromString(tmp)) == -1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown policy attribute '%s' of feature '%s'"),
- tmp, virDomainFeatureTypeToString(val));
- goto error;
- }
- VIR_FREE(tmp);
- } else {
- def->features[val] = VIR_TRISTATE_SWITCH_ABSENT;
- }
- break;
-
- case VIR_DOMAIN_FEATURE_VMCOREINFO:
- case VIR_DOMAIN_FEATURE_HAP:
- case VIR_DOMAIN_FEATURE_PMU:
- case VIR_DOMAIN_FEATURE_PVSPINLOCK:
- case VIR_DOMAIN_FEATURE_VMPORT:
- case VIR_DOMAIN_FEATURE_SMM:
- if ((tmp = virXMLPropString(nodes[i], "state"))) {
- if ((def->features[val] = virTristateSwitchTypeFromString(tmp)) == -1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown state attribute '%s' of feature '%s'"),
- tmp, virDomainFeatureTypeToString(val));
- goto error;
- }
- VIR_FREE(tmp);
- } else {
- def->features[val] = VIR_TRISTATE_SWITCH_ON;
- }
- break;
-
- case VIR_DOMAIN_FEATURE_GIC:
- if ((tmp = virXMLPropString(nodes[i], "version"))) {
- gic_version = virGICVersionTypeFromString(tmp);
- if (gic_version < 0 || gic_version == VIR_GIC_VERSION_NONE) {
- virReportError(VIR_ERR_XML_ERROR,
- _("malformed gic version: %s"), tmp);
- goto error;
- }
- def->gic_version = gic_version;
- VIR_FREE(tmp);
- }
- def->features[val] = VIR_TRISTATE_SWITCH_ON;
- break;
-
- case VIR_DOMAIN_FEATURE_IOAPIC:
- tmp = virXMLPropString(nodes[i], "driver");
- if (tmp) {
- int value = virDomainIOAPICTypeFromString(tmp);
- if (value < 0 || value == VIR_DOMAIN_IOAPIC_NONE) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unknown driver mode: %s"),
- tmp);
- goto error;
- }
- def->features[val] = value;
- VIR_FREE(tmp);
- }
- break;
-
- case VIR_DOMAIN_FEATURE_HPT:
- tmp = virXMLPropString(nodes[i], "resizing");
- if (tmp) {
- int value = virDomainHPTResizingTypeFromString(tmp);
- if (value < 0 || value == VIR_DOMAIN_HPT_RESIZING_NONE) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unknown HPT resizing setting: %s"),
- tmp);
- goto error;
- }
- def->hpt_resizing = (virDomainHPTResizing) value;
- VIR_FREE(tmp);
- }
-
- if (virDomainParseScaledValue("./features/hpt/maxpagesize",
- NULL,
- ctxt,
- &def->hpt_maxpagesize,
- 1024,
- ULLONG_MAX,
- false) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s",
- _("Unable to parse HPT maxpagesize setting"));
- goto error;
- }
- def->hpt_maxpagesize = VIR_DIV_UP(def->hpt_maxpagesize, 1024);
-
- if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE ||
- def->hpt_maxpagesize > 0) {
- def->features[val] = VIR_TRISTATE_SWITCH_ON;
- }
- break;
-
- case VIR_DOMAIN_FEATURE_HTM:
- case VIR_DOMAIN_FEATURE_NESTED_HV:
- case VIR_DOMAIN_FEATURE_CCF_ASSIST:
- if (!(tmp = virXMLPropString(nodes[i], "state"))) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("missing state attribute '%s' of feature '%s'"),
- tmp, virDomainFeatureTypeToString(val));
- goto error;
- }
- if ((def->features[val] = virTristateSwitchTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown state attribute '%s' of feature '%s'"),
- tmp, virDomainFeatureTypeToString(val));
- goto error;
- }
- VIR_FREE(tmp);
- break;
-
- /* coverity[dead_error_begin] */
- case VIR_DOMAIN_FEATURE_LAST:
- break;
- }
- }
- VIR_FREE(nodes);
-
- if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
- int feature;
- int value;
- node = ctxt->node;
- if ((n = virXPathNodeSet("./features/hyperv/*", ctxt, &nodes)) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- feature = virDomainHypervTypeFromString((const char *)nodes[i]->name);
- if (feature < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported HyperV Enlightenment feature: %s"),
- nodes[i]->name);
- goto error;
- }
-
- ctxt->node = nodes[i];
-
- if (!(tmp = virXMLPropString(nodes[i], "state"))) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing 'state' attribute for "
- "HyperV Enlightenment feature '%s'"),
- nodes[i]->name);
- goto error;
- }
-
- if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("invalid value of state argument "
- "for HyperV Enlightenment feature '%s'"),
- nodes[i]->name);
- goto error;
- }
-
- VIR_FREE(tmp);
- def->hyperv_features[feature] = value;
-
- switch ((virDomainHyperv) feature) {
- case VIR_DOMAIN_HYPERV_RELAXED:
- case VIR_DOMAIN_HYPERV_VAPIC:
- case VIR_DOMAIN_HYPERV_VPINDEX:
- case VIR_DOMAIN_HYPERV_RUNTIME:
- case VIR_DOMAIN_HYPERV_SYNIC:
- case VIR_DOMAIN_HYPERV_STIMER:
- case VIR_DOMAIN_HYPERV_RESET:
- case VIR_DOMAIN_HYPERV_FREQUENCIES:
- case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
- case VIR_DOMAIN_HYPERV_TLBFLUSH:
- case VIR_DOMAIN_HYPERV_IPI:
- case VIR_DOMAIN_HYPERV_EVMCS:
- break;
-
- case VIR_DOMAIN_HYPERV_SPINLOCKS:
- if (value != VIR_TRISTATE_SWITCH_ON)
- break;
-
- if (virXPathUInt("string(./@retries)", ctxt,
- &def->hyperv_spinlocks) < 0) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("invalid HyperV spinlock retry count"));
- goto error;
- }
-
- if (def->hyperv_spinlocks < 0xFFF) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("HyperV spinlock retry count must be "
- "at least 4095"));
- goto error;
- }
- break;
-
- case VIR_DOMAIN_HYPERV_VENDOR_ID:
- if (value != VIR_TRISTATE_SWITCH_ON)
- break;
-
- if (!(def->hyperv_vendor_id = virXMLPropString(nodes[i],
- "value"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing 'value' attribute for "
- "HyperV feature 'vendor_id'"));
- goto error;
- }
-
- if (strlen(def->hyperv_vendor_id) > VIR_DOMAIN_HYPERV_VENDOR_ID_MAX) {
- virReportError(VIR_ERR_XML_ERROR,
- _("HyperV vendor_id value must not be more "
- "than %d characters."),
- VIR_DOMAIN_HYPERV_VENDOR_ID_MAX);
- goto error;
- }
-
- /* ensure that the string can be passed to qemu */
- if (strchr(def->hyperv_vendor_id, ',')) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("HyperV vendor_id value is invalid"));
- goto error;
- }
-
- /* coverity[dead_error_begin] */
- case VIR_DOMAIN_HYPERV_LAST:
- break;
- }
- }
- VIR_FREE(nodes);
- ctxt->node = node;
- }
-
- if (def->features[VIR_DOMAIN_HYPERV_STIMER] == VIR_TRISTATE_SWITCH_ON) {
- int value;
- if ((n = virXPathNodeSet("./features/hyperv/stimer/*", ctxt, &nodes)) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- if (STRNEQ((const char *)nodes[i]->name, "direct")) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported Hyper-V stimer feature: %s"),
- nodes[i]->name);
- goto error;
- }
-
- if (!(tmp = virXMLPropString(nodes[i], "state"))) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing 'state' attribute for "
- "Hyper-V stimer '%s' feature"), "direct");
- goto error;
- }
-
- if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("invalid value of state argument "
- "for Hyper-V stimer '%s' feature"), "direct");
- goto error;
- }
-
- VIR_FREE(tmp);
- def->hyperv_stimer_direct = value;
- }
- VIR_FREE(nodes);
- }
-
- if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
- int feature;
- int value;
- if ((n = virXPathNodeSet("./features/kvm/*", ctxt, &nodes)) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- feature = virDomainKVMTypeFromString((const char *)nodes[i]->name);
- if (feature < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported KVM feature: %s"),
- nodes[i]->name);
- goto error;
- }
-
- switch ((virDomainKVM) feature) {
- case VIR_DOMAIN_KVM_HIDDEN:
- case VIR_DOMAIN_KVM_DEDICATED:
- if (!(tmp = virXMLPropString(nodes[i], "state"))) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing 'state' attribute for "
- "KVM feature '%s'"),
- nodes[i]->name);
- goto error;
- }
-
- if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("invalid value of state argument "
- "for KVM feature '%s'"),
- nodes[i]->name);
- goto error;
- }
-
- VIR_FREE(tmp);
- def->kvm_features[feature] = value;
- break;
-
- /* coverity[dead_error_begin] */
- case VIR_DOMAIN_KVM_LAST:
- break;
- }
- }
- VIR_FREE(nodes);
- }
-
- if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
- int feature;
- int value;
- g_autofree char *ptval = NULL;
-
- if ((n = virXPathNodeSet("./features/xen/*", ctxt, &nodes)) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- feature = virDomainXenTypeFromString((const char *)nodes[i]->name);
- if (feature < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported Xen feature: %s"),
- nodes[i]->name);
- goto error;
- }
-
- if (!(tmp = virXMLPropString(nodes[i], "state"))) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing 'state' attribute for "
- "Xen feature '%s'"),
- nodes[i]->name);
- goto error;
- }
-
- if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("invalid value of state argument "
- "for Xen feature '%s'"),
- nodes[i]->name);
- goto error;
- }
-
- VIR_FREE(tmp);
- def->xen_features[feature] = value;
-
- switch ((virDomainXen) feature) {
- case VIR_DOMAIN_XEN_E820_HOST:
- break;
-
- case VIR_DOMAIN_XEN_PASSTHROUGH:
- if (value != VIR_TRISTATE_SWITCH_ON)
- break;
-
- if ((ptval = virXMLPropString(nodes[i], "mode"))) {
- int mode = virDomainXenPassthroughModeTypeFromString(ptval);
-
- if (mode < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported mode '%s' for Xen passthrough feature"),
- ptval);
- goto error;
- }
-
- if (mode != VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT &&
- mode != VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'mode' attribute for Xen feature "
- "'passthrough' must be 'sync_pt' or 'share_pt'"));
- goto error;
- }
- def->xen_passthrough_mode = mode;
- }
- break;
-
- /* coverity[dead_error_begin] */
- case VIR_DOMAIN_XEN_LAST:
- break;
- }
- }
- VIR_FREE(nodes);
- }
-
- if (def->features[VIR_DOMAIN_FEATURE_SMM] == VIR_TRISTATE_SWITCH_ON) {
- int rv = virDomainParseScaledValue("string(./features/smm/tseg)",
- "string(./features/smm/tseg/@unit)",
- ctxt,
- &def->tseg_size,
- 1024 * 1024, /* Defaults to mebibytes */
- ULLONG_MAX,
- false);
- if (rv < 0)
- goto error;
- def->tseg_specified = rv;
- }
-
- if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) {
- if ((node = virXPathNode("./features/msrs", ctxt)) == NULL)
- goto error;
-
- if (!(tmp = virXMLPropString(node, "unknown"))) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("missing 'unknown' attribute for feature '%s'"),
- virDomainFeatureTypeToString(VIR_DOMAIN_FEATURE_MSRS));
- goto error;
- }
-
- if ((def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] = virDomainMsrsUnknownTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown 'unknown' value '%s'"),
- tmp);
- goto error;
- }
- VIR_FREE(tmp);
- }
-
- if ((n = virXPathNodeSet("./features/capabilities/*", ctxt, &nodes)) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- int val = virDomainProcessCapsFeatureTypeFromString((const char *)nodes[i]->name);
- if (val < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unexpected capability feature '%s'"), nodes[i]->name);
- goto error;
- }
-
- if ((tmp = virXMLPropString(nodes[i], "state"))) {
- if ((def->caps_features[val] = virTristateSwitchTypeFromString(tmp)) == -1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown state attribute '%s' of feature capability '%s'"),
- tmp, virDomainProcessCapsFeatureTypeToString(val));
- goto error;
- }
- VIR_FREE(tmp);
- } else {
- def->caps_features[val] = VIR_TRISTATE_SWITCH_ON;
- }
- }
- VIR_FREE(nodes);
-
if (virDomainEventActionParseXML(ctxt, "on_reboot",
"string(./on_reboot[1])",
&def->onReboot,
--
2.25.1
4 years, 8 months
[PATCH] docs: Remove stray parenthesis
by Jim Fehlig
Commit fadbaa2375 introduced a stray parenthesis in formatdomain.html.in.
Remove it.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Pushing under the trivial rule.
docs/formatdomain.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9ccae54e04..27275c8429 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2263,7 +2263,7 @@
</tr>
<tr>
<td>passthrough</td>
- <td>Enable IOMMU mappings allowing PCI passthrough)</td>
+ <td>Enable IOMMU mappings allowing PCI passthrough</td>
<td>on, off; mode - optional string sync_pt or share_pt</td>
<td><span class="since">6.3.0</span></td>
</tr>
--
2.26.0
4 years, 8 months
[PATCH] docs: Document reserved PCI addresses for QEMU
by Michal Privoznik
>From time to time we are asked which PCI addresses are reserved
in QEMU. Let's document them in one place, it's easier than
reconstructing the list from the code each time.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/pci-addresses.rst | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/docs/pci-addresses.rst b/docs/pci-addresses.rst
index 885d50517a..6c203fb1ac 100644
--- a/docs/pci-addresses.rst
+++ b/docs/pci-addresses.rst
@@ -235,3 +235,43 @@ guest OS rather than as ``0001:08:00.1``, which is the address of the
device on the host.
Of course, all the rules and behaviors described above still apply.
+
+
+Reserved addresses
+==================
+
+Due to some historical reasons hypervisors might expect some PCI
+devices to appear at certain addresses instead of 'random' ones.
+For QEMU this is machine type and guest architecture dependant.
+But to give you at least a gist here is list of reserved PCI
+addresses:
+
+For ``I440FX`` the following addresses are reserved:
+
+============ ======================
+0000:00:01.0 ISA bridge
+0000:00:01.1 primary IDE controller
+0000:00:01.2 PIIX3 USB controller
+0000:00:01.3 PCI bridge
+0000:00:02.0 primary video card
+============ ======================
+
+For ``Q35`` the following addresses are reserved:
+
+============ =======================
+0000:00:1f.2 primary SATA controller
+0000:00:1f.0 ISA bridge
+0000:00:1f.3 SMBus
+0000:00:01.0 primary video card
+============ =======================
+
+and the following are recommended (libvirt will try to place
+corresponding devices there because that's how real ``Q35`` would
+do it, but won't fail if the address is already taken):
+
+============ ===============
+0000:00:1a.0 USB2 controller
+0000:00:1b.0 ICH9 sound chip
+0000:00:1d.0 USB2 controller
+0000:00:1e.0 dmi-to-pci bridge
+============ ===============
--
2.25.3
4 years, 8 months