[PATCH 5/6] qemu: Prepare to cater for more general address assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Ellerman <michael@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
 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 17cc972..32ee8d8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -811,6 +811,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 c76f83a..de61cf3 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 1e5ed9a..10a289e 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,
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]