From: Daniel P. Berrange Date: Thu, 20 Oct 2011 13:56:30 +0000 (+0100) Subject: Default console target type with no element X-Git-Tag: v0.9.7~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=876c8b3bd3fcb8407825bc3adb38875cedf24935;p=thirdparty%2Flibvirt.git Default console target type with no element When no element was set at all, the default console target type was not being honoured * src/conf/domain_conf.c: Set default target type for consoles with no --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e88a1cfdac..84743c1952 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3997,6 +3997,7 @@ virDomainChrDefParseXML(virCapsPtr caps, const char *nodeName; virDomainChrDefPtr def; int remaining; + bool seenTarget = false; if (!(def = virDomainChrDefNew())) return NULL; @@ -4026,6 +4027,7 @@ virDomainChrDefParseXML(virCapsPtr caps, while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { if (xmlStrEqual(cur->name, BAD_CAST "target")) { + seenTarget = true; if (virDomainChrDefParseTargetXML(caps, def, cur) < 0) { goto error; } @@ -4035,6 +4037,10 @@ virDomainChrDefParseXML(virCapsPtr caps, } } + if (!seenTarget && + ((def->targetType = virDomainChrDefaultTargetType(caps, def->deviceType)) < 0)) + goto cleanup; + if (def->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) { if (def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) { virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",