qemu: domain: split out post parse default device handling

Should be a no-op
This commit is contained in:
Cole Robinson 2016-01-06 20:35:36 -05:00
parent ee719cdcca
commit 9cec6239c1

View File

@ -1035,12 +1035,9 @@ virDomainXMLNamespace virQEMUDriverDomainXMLNamespace = {
static int
qemuDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
void *opaque)
qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps)
{
virQEMUDriverPtr driver = opaque;
virQEMUCapsPtr qemuCaps = NULL;
bool addDefaultUSB = true;
bool addImplicitSATA = false;
bool addPCIRoot = false;
@ -1051,20 +1048,6 @@ qemuDomainDefPostParse(virDomainDefPtr def,
bool addPanicDevice = false;
int ret = -1;
if (def->os.bootloader || def->os.bootloaderArgs) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("bootloader is not supported by QEMU"));
return ret;
}
/* check for emulator and create a default one if needed */
if (!def->emulator &&
!(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
return ret;
qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator);
/* Add implicit PCI root controller if the machine has one */
switch (def->os.arch) {
case VIR_ARCH_I686:
@ -1218,6 +1201,37 @@ qemuDomainDefPostParse(virDomainDefPtr def,
}
}
ret = 0;
cleanup:
return ret;
}
static int
qemuDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
void *opaque)
{
virQEMUDriverPtr driver = opaque;
virQEMUCapsPtr qemuCaps = NULL;
int ret = -1;
if (def->os.bootloader || def->os.bootloaderArgs) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("bootloader is not supported by QEMU"));
return ret;
}
/* check for emulator and create a default one if needed */
if (!def->emulator &&
!(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
return ret;
qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator);
if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0)
goto cleanup;
ret = 0;
cleanup:
virObjectUnref(qemuCaps);