domain: Add virDomainDefAddImplicitDevices

It's just a combination of AddImplicitControllers, and AddConsoleCompat.
Every caller that wants ImplicitControllers also wants the ConsoleCompat
AFAICT, so lump them together. We also need it for future patches.
This commit is contained in:
Cole Robinson 2016-01-07 22:49:58 -05:00
parent ae33a7b336
commit 9a423d1826
6 changed files with 21 additions and 12 deletions

View File

@ -3902,9 +3902,6 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
if (virDomainDefPostParseMemory(def, parseFlags) < 0) if (virDomainDefPostParseMemory(def, parseFlags) < 0)
return -1; return -1;
if (virDomainDefAddConsoleCompat(def) < 0)
return -1;
if (virDomainDefRejectDuplicateControllers(def) < 0) if (virDomainDefRejectDuplicateControllers(def) < 0)
return -1; return -1;
@ -3914,7 +3911,7 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
if (virDomainDefPostParseTimer(def) < 0) if (virDomainDefPostParseTimer(def) < 0)
return -1; return -1;
if (virDomainDefAddImplicitControllers(def) < 0) if (virDomainDefAddImplicitDevices(def) < 0)
return -1; return -1;
/* clean up possibly duplicated metadata entries */ /* clean up possibly duplicated metadata entries */
@ -18428,7 +18425,7 @@ virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
* in the XML. This is for compat with existing apps which will * in the XML. This is for compat with existing apps which will
* not know/care about <controller> info in the XML * not know/care about <controller> info in the XML
*/ */
int static int
virDomainDefAddImplicitControllers(virDomainDefPtr def) virDomainDefAddImplicitControllers(virDomainDefPtr def)
{ {
if (virDomainDefAddDiskControllersForType(def, if (virDomainDefAddDiskControllersForType(def,
@ -18463,6 +18460,18 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def)
return 0; return 0;
} }
int
virDomainDefAddImplicitDevices(virDomainDefPtr def)
{
if (virDomainDefAddConsoleCompat(def) < 0)
return -1;
if (virDomainDefAddImplicitControllers(def) < 0)
return -1;
return 0;
}
virDomainIOThreadIDDefPtr virDomainIOThreadIDDefPtr
virDomainIOThreadIDFind(const virDomainDef *def, virDomainIOThreadIDFind(const virDomainDef *def,
unsigned int iothread_id) unsigned int iothread_id)

View File

@ -2703,7 +2703,7 @@ virDomainObjPtr virDomainObjParseFile(const char *filename,
bool virDomainDefCheckABIStability(virDomainDefPtr src, bool virDomainDefCheckABIStability(virDomainDefPtr src,
virDomainDefPtr dst); virDomainDefPtr dst);
int virDomainDefAddImplicitControllers(virDomainDefPtr def); int virDomainDefAddImplicitDevices(virDomainDefPtr def);
virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(const virDomainDef *def, virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(const virDomainDef *def,
unsigned int iothread_id); unsigned int iothread_id);

View File

@ -200,7 +200,7 @@ virDomainControllerRemove;
virDomainControllerTypeToString; virDomainControllerTypeToString;
virDomainCpuPlacementModeTypeFromString; virDomainCpuPlacementModeTypeFromString;
virDomainCpuPlacementModeTypeToString; virDomainCpuPlacementModeTypeToString;
virDomainDefAddImplicitControllers; virDomainDefAddImplicitDevices;
virDomainDefAddUSBController; virDomainDefAddUSBController;
virDomainDefCheckABIStability; virDomainDefCheckABIStability;
virDomainDefCheckDuplicateDiskInfo; virDomainDefCheckDuplicateDiskInfo;

View File

@ -7870,7 +7870,7 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
/* vmdef has the pointer. Generic codes for vmdef will do all jobs */ /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
dev->data.disk = NULL; dev->data.disk = NULL;
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
if (virDomainDefAddImplicitControllers(vmdef) < 0) if (virDomainDefAddImplicitDevices(vmdef) < 0)
return -1; return -1;
if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
return -1; return -1;
@ -7895,7 +7895,7 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
if (virDomainHostdevInsert(vmdef, hostdev)) if (virDomainHostdevInsert(vmdef, hostdev))
return -1; return -1;
dev->data.hostdev = NULL; dev->data.hostdev = NULL;
if (virDomainDefAddImplicitControllers(vmdef) < 0) if (virDomainDefAddImplicitDevices(vmdef) < 0)
return -1; return -1;
if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
return -1; return -1;
@ -7937,7 +7937,7 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
if (qemuDomainChrInsert(vmdef, dev->data.chr) < 0) if (qemuDomainChrInsert(vmdef, dev->data.chr) < 0)
return -1; return -1;
dev->data.chr = NULL; dev->data.chr = NULL;
if (virDomainDefAddImplicitControllers(vmdef) < 0) if (virDomainDefAddImplicitDevices(vmdef) < 0)
return -1; return -1;
if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
return -1; return -1;

View File

@ -1687,7 +1687,7 @@ virVMXParseConfig(virVMXContext *ctx,
} }
/* def:controllers */ /* def:controllers */
if (virDomainDefAddImplicitControllers(def) < 0) { if (virDomainDefAddImplicitDevices(def) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers")); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers"));
goto cleanup; goto cleanup;
} }

View File

@ -1356,7 +1356,7 @@ prlsdkLoadDomain(vzConnPtr privconn, virDomainObjPtr dom)
if (prlsdkGetDomainState(sdkdom, &domainState) < 0) if (prlsdkGetDomainState(sdkdom, &domainState) < 0)
goto error; goto error;
if (virDomainDefAddImplicitControllers(def) < 0) if (virDomainDefAddImplicitDevices(def) < 0)
goto error; goto error;
if (def->ngraphics > 0) { if (def->ngraphics > 0) {