qemu: Prepare to cater for more general address assignment

Currently qemuDomainAssignPCIAddresses() is called to assign addresses
to PCI devices.

We need to do something similar for devices with spapr-vio addresses.
So create one place where address assignment will be done, that is
qemuDomainAssignAddresses().

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
This commit is contained in:
Michael Ellerman 2011-12-08 17:41:26 +11:00 committed by Eric Blake
parent 2a994a3b1e
commit 9f406c5838
3 changed files with 12 additions and 6 deletions

View File

@ -810,6 +810,10 @@ cleanup:
return ret;
}
int qemuDomainAssignAddresses(virDomainDefPtr def)
{
return qemuDomainAssignPCIAddresses(def);
}
static void
qemuDomainPCIAddressSetFreeEntry(void *payload,

View File

@ -174,6 +174,8 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps,
virDomainChrSourceDefPtr *monConfig,
bool *monJSON);
int qemuDomainAssignAddresses(virDomainDefPtr def);
int qemuDomainAssignPCIAddresses(virDomainDefPtr def);
qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def);
int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs,

View File

@ -1317,7 +1317,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (qemudCanonicalizeMachine(driver, def) < 0)
goto cleanup;
if (qemuDomainAssignPCIAddresses(def) < 0)
if (qemuDomainAssignAddresses(def) < 0)
goto cleanup;
if (!(vm = virDomainAssignDef(driver->caps,
@ -4903,7 +4903,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
if (qemudCanonicalizeMachine(driver, def) < 0)
goto cleanup;
if (qemuDomainAssignPCIAddresses(def) < 0)
if (qemuDomainAssignAddresses(def) < 0)
goto cleanup;
if (!(vm = virDomainAssignDef(driver->caps,
@ -5372,7 +5372,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
if (virDomainDefAddImplicitControllers(vmdef) < 0)
return -1;
if (qemuDomainAssignPCIAddresses(vmdef) < 0)
if (qemuDomainAssignAddresses(vmdef) < 0)
return -1;
break;
@ -5390,7 +5390,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
return -1;
}
dev->data.net = NULL;
if (qemuDomainAssignPCIAddresses(vmdef) < 0)
if (qemuDomainAssignAddresses(vmdef) < 0)
return -1;
break;
@ -5526,7 +5526,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
vmdef->nets[pos] = net;
dev->data.net = NULL;
if (qemuDomainAssignPCIAddresses(vmdef) < 0)
if (qemuDomainAssignAddresses(vmdef) < 0)
return -1;
break;
@ -10794,7 +10794,7 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn,
if (qemudCanonicalizeMachine(driver, def) < 0)
goto cleanup;
if (qemuDomainAssignPCIAddresses(def) < 0)
if (qemuDomainAssignAddresses(def) < 0)
goto cleanup;
if (!(vm = virDomainAssignDef(driver->caps,