]> xenbits.xensource.com Git - libvirt.git/commitdiff
Default console target type with no <target> element
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 20 Oct 2011 13:56:30 +0000 (14:56 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 3 Nov 2011 12:01:13 +0000 (12:01 +0000)
When no <target> 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 <target>

src/conf/domain_conf.c

index e88a1cfdac229f90ab2f4fd2473bf5b2d41b6f58..84743c19524ad07a58b8981cb6d9159c7c59a244 100644 (file)
@@ -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",