提交 a84fce35 编写于 作者: J Ján Tomko

Do not mask QEMU_CAPS_DEVICE in qemuBuildDriveStr

For some disk types (SD), we want to emit the syntax
we used for disks before -device was available even
if QEMU supports -device.

Use the qemuDiskBusNeedsDeviceArg helper to figure out
whether to use the old or new syntax.
上级 2e33ef48
...@@ -1106,6 +1106,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, ...@@ -1106,6 +1106,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
char *source = NULL; char *source = NULL;
int actualType = virStorageSourceGetActualType(disk->src); int actualType = virStorageSourceGetActualType(disk->src);
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
bool emitDeviceSyntax = qemuDiskBusNeedsDeviceArg(disk->bus);
if (idx < 0) { if (idx < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
...@@ -1246,7 +1247,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, ...@@ -1246,7 +1247,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
} }
VIR_FREE(source); VIR_FREE(source);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) if (emitDeviceSyntax)
virBufferAddLit(&opt, "if=none"); virBufferAddLit(&opt, "if=none");
else else
virBufferAsprintf(&opt, "if=%s", bus); virBufferAsprintf(&opt, "if=%s", bus);
...@@ -1263,7 +1264,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, ...@@ -1263,7 +1264,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
} }
} }
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (emitDeviceSyntax) {
virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
} else { } else {
if (busid == -1 && unitid == -1) { if (busid == -1 && unitid == -1) {
...@@ -1916,7 +1917,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, ...@@ -1916,7 +1917,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
char *optstr; char *optstr;
unsigned int bootindex = 0; unsigned int bootindex = 0;
virDomainDiskDefPtr disk = def->disks[i]; virDomainDiskDefPtr disk = def->disks[i];
bool deviceFlagMasked = false;
/* PowerPC pseries based VMs do not support floppy device */ /* PowerPC pseries based VMs do not support floppy device */
if ((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) && if ((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) &&
...@@ -1945,15 +1945,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, ...@@ -1945,15 +1945,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
virCommandAddArg(cmd, "-drive"); virCommandAddArg(cmd, "-drive");
if (!qemuDiskBusNeedsDeviceArg(disk->bus)) {
virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
deviceFlagMasked = true;
}
optstr = qemuBuildDriveStr(disk, optstr = qemuBuildDriveStr(disk,
emitBootindex ? false : !!bootindex, emitBootindex ? false : !!bootindex,
qemuCaps); qemuCaps);
if (deviceFlagMasked)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
if (!optstr) if (!optstr)
return -1; return -1;
virCommandAddArg(cmd, optstr); virCommandAddArg(cmd, optstr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册