From 8126d870783e69cfa9e9f8b366f21548c1abe3fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Bosdonnat?= Date: Mon, 17 Oct 2016 09:57:22 +0200 Subject: [PATCH] xl: don't output (null) target in domxml-to-native 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index a06983e35c..3752464d29 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -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; -- 2.39.5