[PATCH 4/6] bhyve: auto-assign addresses when <address type='pci'/> is specified

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

 



Rather than only assigning a PCI address when no address is given at
all, also do it when the config says that the address type is 'pci',
but it gives no address.
---
 src/bhyve/bhyve_device.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c
index 3eb2956..8373a5f 100644
--- a/src/bhyve/bhyve_device.c
+++ b/src/bhyve/bhyve_device.c
@@ -98,7 +98,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
         goto error;
 
     for (i = 0; i < def->nnets; i++) {
-        if (def->nets[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
+        if (!virDeviceInfoPCIAddressWanted(&def->nets[i]->info))
             continue;
         if (virDomainPCIAddressReserveNextSlot(addrs,
                                                &def->nets[i]->info,
@@ -107,8 +107,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
     }
 
     for (i = 0; i < def->ndisks; i++) {
-        if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
-            def->disks[i]->info.addr.pci.slot != 0)
+        if (!virDeviceInfoPCIAddressWanted(&def->disks[i]->info))
             continue;
         if (virDomainPCIAddressReserveNextSlot(addrs,
                                                &def->disks[i]->info,
@@ -118,9 +117,8 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
 
     for (i = 0; i < def->ncontrollers; i++) {
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
-            if (def->controllers[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
-                continue;
-            if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT)
+            if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
+                !virDeviceInfoPCIAddressWanted(&def->controllers[i]->info))
                 continue;
 
             if (virDomainPCIAddressReserveNextSlot(addrs,
-- 
2.5.5

--
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]