On 02/03/2016 03:25 PM, Andrea Bolognani wrote:
When a domain is configured to use GIC but no version has been
specified by the user, default to GIC v2.
---
src/qemu/qemu_domain.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1895520..d120e15 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1239,6 +1239,18 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
static int
+qemuDomainDefAddDefaultFeatures(virDomainDefPtr def)
?qemuDomainDefSetDefaultFeatures?
You're not adding gic, it's already added, you're just setting the
default version... although this could be unnecessary if host were the
default...
+{
+ /* Default to GIC v2 if no version was specified */
+ if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON &&
+ def->gic_version == VIR_GIC_VERSION_NONE)
+ def->gic_version = VIR_GIC_VERSION_2;
+
+ return 0;
Since there is no other return value, this should be a void
Also, consider my comment in 1/7... We could set the version=host when
we send the XML to Why not use 'host' as the default? If that's the
case, then this patch goes away.
BTW: Somewhere along the way docs/formatdomain.html.in needs an
adjustment to describe the options (host, 2, 3) and how they work.
John
+}
+
+
+static int
qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
{
const char *canon;
@@ -1289,6 +1301,9 @@ qemuDomainDefPostParse(virDomainDefPtr def,
if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
goto cleanup;
+ if (qemuDomainDefAddDefaultFeatures(def) < 0)
+ goto cleanup;
+
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;