]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix virDomainGetXMLDesc cache settings output
authorSoren Hansen <soren@ubuntu.com>
Tue, 9 Mar 2010 12:59:51 +0000 (13:59 +0100)
committerDaniel Veillard <veillard@redhat.com>
Tue, 9 Mar 2010 12:59:51 +0000 (13:59 +0100)
If a special cache strategy for a disk has been specified in a domain
definition, but no driverName has been set, virDomainGetXMLDesc would not
include the <driver> tag at all.

* src/conf/domain_conf.c: make sure any <driver> tag setting is
  serialized if set.

src/conf/domain_conf.c

index 96ba0b013d6d8282bf664e236a4a5042a8db0871..56c5239dcf478baf854dffb0a01d29c7fd2971af 100644 (file)
@@ -4718,8 +4718,10 @@ virDomainDiskDefFormat(virBufferPtr buf,
                       "    <disk type='%s' device='%s'>\n",
                       type, device);
 
-    if (def->driverName) {
-        virBufferVSprintf(buf, "      <driver name='%s'", def->driverName);
+    if (def->driverName || def->driverType || def->cachemode) {
+        virBufferVSprintf(buf, "      <driver");
+        if (def->driverName)
+            virBufferVSprintf(buf, " name='%s'", def->driverName);
         if (def->driverType)
             virBufferVSprintf(buf, " type='%s'", def->driverType);
         if (def->cachemode)