virBufferAddLit(&opt, ",media=cdrom");
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
- virBufferVSprintf(&opt, ",id=drive-%s", disk->info.alias);
+ virBufferVSprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
} else {
if (busid == -1 && unitid == -1) {
if (idx != -1)
_("unsupported disk bus '%s' with device setup"), bus);
goto error;
}
- virBufferVSprintf(&opt, ",drive=drive-%s", disk->info.alias);
+ virBufferVSprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
virBufferVSprintf(&opt, ",id=%s", disk->info.alias);
if (virBufferError(&opt)) {
/* Config type for XML import/export conversions */
#define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
+#define QEMU_DRIVE_HOST_PREFIX "drive-"
+
#define qemuReportError(code, fmt...) \
virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)
goto cleanup;
}
+ /* New QEMU has separate names for host & guest side of the disk
+ * and libvirt gives the host side a 'drive-' prefix. The passed
+ * in devname is the guest side though
+ */
+ if (STRPREFIX(thisdev, QEMU_DRIVE_HOST_PREFIX))
+ thisdev += strlen(QEMU_DRIVE_HOST_PREFIX);
+
if (STRNEQ(thisdev, devname))
continue;
p = info;
while (*p) {
+ /* New QEMU has separate names for host & guest side of the disk
+ * and libvirt gives the host side a 'drive-' prefix. The passed
+ * in devname is the guest side though
+ */
+ if (STRPREFIX(p, QEMU_DRIVE_HOST_PREFIX))
+ p += strlen(QEMU_DRIVE_HOST_PREFIX);
+
if (STREQLEN (p, devname, devnamelen)
&& p[devnamelen] == ':' && p[devnamelen+1] == ' ') {