提交 7fcf943b 编写于 作者: O Osier Yang

qemu: Prohibit setting tray status as open for block type disk

上级 ad7db439
...@@ -1963,6 +1963,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -1963,6 +1963,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
break; break;
} }
} else { } else {
if ((disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) &&
(disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("tray status 'open' is invalid for "
"block type disk"));
goto error;
}
virBufferEscape(&opt, ',', ",", "file=%s,", disk->src); virBufferEscape(&opt, ',', ",", "file=%s,", disk->src);
} }
} }
...@@ -4641,6 +4648,14 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -4641,6 +4648,14 @@ qemuBuildCommandLine(virConnectPtr conn,
const char *fmt; const char *fmt;
virDomainDiskDefPtr disk = def->disks[i]; virDomainDiskDefPtr disk = def->disks[i];
if ((disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) &&
(disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("tray status 'open' is invalid for "
"block type disk"));
goto error;
}
if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) { if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
virCommandAddArg(cmd, "-usbdevice"); virCommandAddArg(cmd, "-usbdevice");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册