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.
This commit is contained in:
Cédric Bosdonnat 2016-10-17 09:57:22 +02:00
parent df93b5f5f5
commit 8126d87078

View File

@ -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;