[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] libvirt, libxl and QDISKs



Jim Fehlig wrote:
> Ian Campbell wrote:
>   
>> On Thu, 2013-04-25 at 14:22 +0100, Dave Scott wrote:
>>   
>>     
>>> On 25/04/13 13:43, Ian Campbell wrote:
>>>     
>>>       
>>   
>>     
>>> It looks like we could define a "qdisk" driverName.
>>>     
>>>       
>> Yes, I think this would work. WRT to your comment below it looks like
>> other libvirt drivers call this driver "qemu".
>>   
>>     
>
> IMO, we should just extend the above to map driverName 'qemu' to backend
> 'qdisk'.  But what about the formats?  I though qdisk could handle all
> of them, particularly with qemu-upstream, even vmdk?
>   

Something like the attached, which seems to work well for me when
specifying driverName = qemu, e.g.

    <disk type='file' device='disk'>
      <driver name='qemu'/>
      <source file='/var/lib/xen/images/sles11sp2-pv/disk0.raw'/>
      <target dev='xvda' bus='xen'/>
    </disk>

Regards,
Jim

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 7e0753a..f549a5d 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -505,6 +505,29 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, 
libxl_device_disk *x_disk)
         } else if (STREQ(l_disk->driverName, "phy")) {
             x_disk->format = LIBXL_DISK_FORMAT_RAW;
             x_disk->backend = LIBXL_DISK_BACKEND_PHY;
+        } else if (STREQ(l_disk->driverName, "qemu")) {
+            x_disk->backend = LIBXL_DISK_BACKEND_QDISK;
+            switch (l_disk->format) {
+            case VIR_STORAGE_FILE_QCOW:
+                x_disk->format = LIBXL_DISK_FORMAT_QCOW;
+                break;
+            case VIR_STORAGE_FILE_QCOW2:
+                x_disk->format = LIBXL_DISK_FORMAT_QCOW2;
+                break;
+            case VIR_STORAGE_FILE_VHD:
+                x_disk->format = LIBXL_DISK_FORMAT_VHD;
+                break;
+            case VIR_STORAGE_FILE_NONE:
+                /* No subtype specified, default to raw */
+            case VIR_STORAGE_FILE_RAW:
+                x_disk->format = LIBXL_DISK_FORMAT_RAW;
+                break;
+            default:
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("libxenlight does not support disk format 
%s"),
+                               
virStorageFileFormatTypeToString(l_disk->format));
+                return -1;
+            }
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("libxenlight does not support disk driver %s"),
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.