提交 e1cb1c06 编写于 作者: M Michal Privoznik 提交者: Cole Robinson

qemu: Add controllers in specified order

qemu is sensitive to the order of arguments passed. Hence, if a
device requires a controller, the controller cmd string must
precede device cmd string. The same apply for controllers, when
for instance ccid controller requires usb controller. So
controllers create partial ordering in which they should be added
to qemu cmd line.
(cherry picked from commit 0f720ab3)
上级 a2e51ac0
...@@ -4473,6 +4473,16 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -4473,6 +4473,16 @@ qemuBuildCommandLine(virConnectPtr conn,
int usbcontroller = 0; int usbcontroller = 0;
bool usblegacy = false; bool usblegacy = false;
uname_normalize(&ut); uname_normalize(&ut);
int contOrder[] = {
/* We don't add an explicit IDE or FD controller because the
* provided PIIX4 device already includes one. It isn't possible to
* remove the PIIX4. */
VIR_DOMAIN_CONTROLLER_TYPE_USB,
VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
VIR_DOMAIN_CONTROLLER_TYPE_SATA,
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
VIR_DOMAIN_CONTROLLER_TYPE_CCID,
};
VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d " VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "
"caps=%p migrateFrom=%s migrateFD=%d " "caps=%p migrateFrom=%s migrateFD=%d "
...@@ -5051,15 +5061,11 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -5051,15 +5061,11 @@ qemuBuildCommandLine(virConnectPtr conn,
} }
if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
for (j = 0; j < 1; j++) { for (j = 0; j < ARRAY_CARDINALITY(contOrder); j++) {
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
virDomainControllerDefPtr cont = def->controllers[i]; virDomainControllerDefPtr cont = def->controllers[i];
/* We don't add an explicit IDE or FD controller because the if (cont->type != contOrder[j])
* provided PIIX4 device already includes one. It isn't possible to
* remove the PIIX4. */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE ||
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC)
continue; continue;
/* Also, skip USB controllers with type none.*/ /* Also, skip USB controllers with type none.*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册