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

[libvirt] [PATCH 17/22] qemu: implement virNodeDeviceReAttachFlags



The only difference from virNodeDeviceReAttach() is that the
attach_group bool is set in the virPCIDevice object if appropriate.
---
 src/qemu/qemu_driver.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dc6f2cd..16b8805 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10321,8 +10321,10 @@ qemuNodeDeviceDettach(virNodeDevicePtr dev)
     return qemuNodeDeviceDetachFlags(dev, NULL, 0);
 }
 
+
 static int
-qemuNodeDeviceReAttach(virNodeDevicePtr dev)
+qemuNodeDeviceReAttachFlags(virNodeDevicePtr dev,
+                            unsigned int flags)
 {
     virQEMUDriverPtr driver = dev->conn->privateData;
     virPCIDevicePtr pci;
@@ -10330,6 +10332,8 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
     unsigned domain, bus, slot, function;
     int ret = -1;
 
+    virCheckFlags(VIR_NODE_DEVICE_REATTACH_GROUP, -1);
+
     if (qemuNodeDeviceGetPciInfo(dev, &domain, &bus, &slot, &function) < 0)
         return -1;
 
@@ -10337,6 +10341,8 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
     if (!pci)
         return -1;
 
+    virPCIDeviceSetAttachGroup(pci, !!(flags & VIR_NODE_DEVICE_REATTACH_GROUP));
+
     virObjectLock(driver->activePciHostdevs);
     virObjectLock(driver->inactivePciHostdevs);
     other = virPCIDeviceListFind(driver->activePciHostdevs, pci);
@@ -10366,6 +10372,14 @@ out:
     return ret;
 }
 
+
+static int
+qemuNodeDeviceReAttach(virNodeDevicePtr dev)
+{
+    return qemuNodeDeviceReAttachFlags(dev, 0);
+}
+
+
 static int
 qemuNodeDeviceReset(virNodeDevicePtr dev)
 {
@@ -15312,6 +15326,7 @@ static virDriver qemuDriver = {
     .nodeDeviceDettach = qemuNodeDeviceDettach, /* 0.6.1 */
     .nodeDeviceDetachFlags = qemuNodeDeviceDetachFlags, /* 1.0.5 */
     .nodeDeviceReAttach = qemuNodeDeviceReAttach, /* 0.6.1 */
+    .nodeDeviceReAttachFlags = qemuNodeDeviceReAttachFlags, /* 1.0.7 */
     .nodeDeviceReset = qemuNodeDeviceReset, /* 0.6.1 */
     .domainMigratePrepareTunnel = qemuDomainMigratePrepareTunnel, /* 0.7.2 */
     .connectIsEncrypted = qemuConnectIsEncrypted, /* 0.7.3 */
-- 
1.7.11.7


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