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(a)canonical.com>
---
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