[PATCH] conf: fix set the wrong fromconfig when specify addr in config

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=1238338#c6

If the user already specify address in xml, we will set the
wrong $fromConfig, which will make libvirt output a wrong error
message and make hot-plug fail when hot-plug a pci device (see
commit 1e15be1 and 9a12b6c).

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
---
 src/conf/domain_addr.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index ca5803e..49769f7 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -376,6 +376,14 @@ virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs,
     return virDomainPCIAddressReserveAddr(addrs, addr, flags, true, false);
 }
 
+static int
+virDomainPCIAddressReserveSlotFromConfig(virDomainPCIAddressSetPtr addrs,
+                                         virDevicePCIAddressPtr addr,
+                                         virDomainPCIConnectFlags flags)
+{
+    return virDomainPCIAddressReserveAddr(addrs, addr, flags, true, true);
+}
+
 int
 virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
                               virDomainDeviceInfoPtr dev)
@@ -408,7 +416,8 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
                                          addrStr, flags, true))
             goto cleanup;
 
-        ret = virDomainPCIAddressReserveSlot(addrs, &dev->addr.pci, flags);
+        ret = virDomainPCIAddressReserveSlotFromConfig(addrs,
+                                                       &dev->addr.pci, flags);
     } else {
         ret = virDomainPCIAddressReserveNextSlot(addrs, dev, flags);
     }
-- 
1.8.3.1

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