From 9f406c58385203cb0dd07c430d713bd0e2cea49b Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 8 Dec 2011 17:41:26 +1100 Subject: [PATCH] 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 --- src/qemu/qemu_command.c | 4 ++++ src/qemu/qemu_command.h | 2 ++ src/qemu/qemu_driver.c | 12 ++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 14bcd9d909..d33d7c86da 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -810,6 +810,10 @@ cleanup: return ret; } +int qemuDomainAssignAddresses(virDomainDefPtr def) +{ + return qemuDomainAssignPCIAddresses(def); +} static void qemuDomainPCIAddressSetFreeEntry(void *payload, diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index c76f83ac1c..de61cf30de 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -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, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1e5ed9a986..10a289e08f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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, -- GitLab