[PATCH] libxl: fix cdrom default driver name

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

 



In recent libvirt libxl does fill non-existant driver elements with type='raw',
but lacks the name='qemu' attribute that it had in the past.
Without that the xml fails to validate, therefore old XML files can't be
edited/defined anymore.

Since the cdrom device type only works with the qemu driver, add that as
the default attribute just as it was added in the past.

Example of the verification error:
  $ virt-xml-validate mytest.xml
  Relax-NG validity error : Extra element devices in interleave

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@xxxxxxxxxxxxx>
---
 src/libxl/libxl_domain.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 68a501c..70ddcea 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -367,8 +367,9 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         int actual_type = virStorageSourceGetActualType(disk->src);
         int format = virDomainDiskGetFormat(disk);
 
-        /* for network-based disks, set 'qemu' as the default driver */
-        if (actual_type == VIR_STORAGE_TYPE_NETWORK) {
+        /* for network-based disk and cdrom, set 'qemu' as the default driver */
+        if (actual_type == VIR_STORAGE_TYPE_NETWORK ||
+            disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
             if (!virDomainDiskGetDriver(disk) &&
                 virDomainDiskSetDriver(disk, "qemu") < 0)
                 return -1;
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux