qemu: handle more machines with a single builtin IDE controller

like I440FX by moving the condition into qemuDomainMachineHasBuiltinIDE
and adding more machines.

Reference: http://bugs.debian.org/805189
This commit is contained in:
Guido Günther 2015-11-21 19:58:56 +01:00
parent 5e3ad0b775
commit e4ab3b5d38
3 changed files with 25 additions and 12 deletions

View File

@ -1054,11 +1054,12 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
*/ */
return virAsprintf(&controller->info.alias, "pci.%d", controller->idx); return virAsprintf(&controller->info.alias, "pci.%d", controller->idx);
} else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE) { } else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE) {
/* for any machine based on I440FX, the first (and currently /* for any machine based on e.g. I440FX or G3Beige, the
* only) IDE controller is an integrated controller hardcoded * first (and currently only) IDE controller is an integrated
* with id "ide" * controller hardcoded with id "ide"
*/ */
if (qemuDomainMachineIsI440FX(domainDef) && controller->idx == 0) if (qemuDomainMachineHasBuiltinIDE(domainDef) &&
controller->idx == 0)
return VIR_STRDUP(controller->info.alias, "ide"); return VIR_STRDUP(controller->info.alias, "ide");
} else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) { } else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
/* for any Q35 machine, the first SATA controller is the /* for any Q35 machine, the first SATA controller is the
@ -4914,14 +4915,15 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
break; break;
case VIR_DOMAIN_CONTROLLER_TYPE_IDE: case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
/* Since we currently only support the integrated IDE controller /* Since we currently only support the integrated IDE
* on 440fx, if we ever get to here, it's because some other * controller on various boards, if we ever get to here, it's
* machinetype had an IDE controller specified, or a 440fx had * because some other machinetype had an IDE controller
* multiple ide controllers. * specified, or one with a single IDE contraller had multiple
* ide controllers specified.
*/ */
if (qemuDomainMachineIsI440FX(domainDef)) if (qemuDomainMachineHasBuiltinIDE(domainDef))
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only a single IDE controller is unsupported " _("Only a single IDE controller is supported "
"for this machine type")); "for this machine type"));
else else
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -9900,9 +9902,9 @@ qemuBuildCommandLine(virConnectPtr conn,
cont->idx == 0 && qemuDomainMachineIsQ35(def)) cont->idx == 0 && qemuDomainMachineIsQ35(def))
continue; continue;
/* first IDE controller on i440fx machines is implicit */ /* first IDE controller is implicit on various machines */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE && if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
cont->idx == 0 && qemuDomainMachineIsI440FX(def)) cont->idx == 0 && qemuDomainMachineHasBuiltinIDE(def))
continue; continue;
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&

View File

@ -3724,6 +3724,16 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
} }
bool
qemuDomainMachineHasBuiltinIDE(const virDomainDef *def)
{
return qemuDomainMachineIsI440FX(def) ||
STREQ(def->os.machine, "malta") ||
STREQ(def->os.machine, "sun4u") ||
STREQ(def->os.machine, "g3beige");
}
/** /**
* qemuDomainUpdateCurrentMemorySize: * qemuDomainUpdateCurrentMemorySize:
* *

View File

@ -479,6 +479,7 @@ bool qemuDomainMachineIsQ35(const virDomainDef *def);
bool qemuDomainMachineIsI440FX(const virDomainDef *def); bool qemuDomainMachineIsI440FX(const virDomainDef *def);
bool qemuDomainMachineNeedsFDC(const virDomainDef *def); bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
bool qemuDomainMachineIsS390CCW(const virDomainDef *def); bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver, int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
virDomainObjPtr vm); virDomainObjPtr vm);