]> xenbits.xensource.com Git - libvirt.git/commitdiff
xl: don't output (null) target in domxml-to-native
authorCédric Bosdonnat <cbosdonnat@suse.com>
Mon, 17 Oct 2016 07:57:22 +0000 (09:57 +0200)
committerCédric Bosdonnat <cbosdonnat@suse.com>
Wed, 19 Oct 2016 13:21:34 +0000 (15:21 +0200)
When converting a domain xml containing a CDROM device without
any attached source, don't add a target=(null) to the libxl config
disk definition: xen doesn't like it at all and would fail to start
the domain.

src/xenconfig/xen_xl.c

index a06983e35c1c2ce9d15c5ad3b3a6047965df0cc5..3752464d298f52638e713425903effd614f99b4f 100644 (file)
@@ -1068,7 +1068,7 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
 
     /* devtype */
     if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
-        virBufferAddLit(&buf, "devtype=cdrom,");
+        virBufferAddLit(&buf, "devtype=cdrom");
 
     /*
      * target
@@ -1081,7 +1081,8 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
     if (xenFormatXLDiskSrc(disk->src, &target) < 0)
         goto cleanup;
 
-    virBufferAsprintf(&buf, "target=%s", target);
+    if (target)
+        virBufferAsprintf(&buf, ",target=%s", target);
 
     if (virBufferCheckError(&buf) < 0)
         goto cleanup;