]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Allow volume type disk for device 'lun'
authorOsier Yang <jyang@redhat.com>
Fri, 5 Apr 2013 17:07:13 +0000 (01:07 +0800)
committerOsier Yang <jyang@redhat.com>
Mon, 8 Apr 2013 11:10:34 +0000 (19:10 +0800)
This allows one use block type volume as the disk source for device
'lun'.

src/qemu/qemu_command.c

index 84f87565295827cbd665042b3cf57ea00bbb1263..8f1d28e14bdbb220e3463dbbe394352e7193f0bf 100644 (file)
@@ -3131,10 +3131,11 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
                                virDomainDiskProtocolTypeToString(disk->protocol));
                 goto error;
             }
-        } else if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("disk device='lun' is not supported for type='%s'"),
-                           virDomainDiskTypeToString(disk->type));
+        } else if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK &&
+                   !(disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME &&
+                     disk->srcpool->voltype == VIR_STORAGE_VOL_BLOCK)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("disk device='lun' is only valid for block type disk source"));
             goto error;
         }
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) {