]> xenbits.xensource.com Git - libvirt.git/commitdiff
Set default name for SPICE agent channel
authorChristophe Fergeau <cfergeau@redhat.com>
Fri, 23 Mar 2012 10:04:13 +0000 (11:04 +0100)
committerChristophe Fergeau <cfergeau@redhat.com>
Wed, 28 Mar 2012 16:33:32 +0000 (18:33 +0200)
libvirt documentation for channels with type 'spicevmc' says that the
'target' child node has:
"an optional attribute name controls how the guest will have access
 to the channel, and defaults to name='com.redhat.spice.0'."

However, this default value is never set in libvirt code base,
there's only a check in qemu_command.c to error out if the name
attribute doesn't have the expected value (if it's set).

This commit sets a default target name for spicevmc channels during
the domain configuration parsing so that the code agrees with the
documentation.

src/conf/domain_conf.c

index ea558bbcef81bc2944e94566d34c2d3fd17442bc..24e10e6ecc0bbca11645b731719f8dd0a16e26e9 100644 (file)
@@ -5248,6 +5248,13 @@ virDomainChrDefParseXML(virCapsPtr caps,
             goto error;
         } else {
             def->source.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_VDAGENT;
+            if (!def->target.name) {
+                def->target.name = strdup("com.redhat.spice.0");
+                if (!def->target.name) {
+                    virReportOOMError();
+                    goto error;
+                }
+            }
         }
     }