[PATCH] qemuProcess: update hostdevs before connectting qemu monitor

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

 



In a following case:

    virsh start $domain
    service libvirtd stop
    <shutdown> the guest from within the $domain
    service libvirtd start

Notice that PCI devices which have been assigned to the $domain will
still be bound to stub drivers instead rebound to host drivers.
In that case the call stack is like below:

    libvirtd start
        qemuProcessReconnect
            qemuProcessStop
                qemuHostdevReAttachDomainDevices
                    qemuHostdevReAttachPCIDevices
                        virHostdevReAttachPCIDevices

qemuHostdevUpdateActiveDomainDevices won't be called because the monitor
channel is closed. So host devices in $domain will not be added to either
activePCIHostdevs list or inactivePCIHostdev list. And therefore,
virHostdevReAttachPCIDevices just neglects these host PCI devices which
are bound to stub drivers and don't rebind them to host drivers.

This patch fixs that by moving qemuHostdevUpdateActiveDomainDevices before
qemuConnectMonitor.

Signed-off-by: Wu Zongyong <cordius.wu@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f9a01da..d187271 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7783,6 +7783,9 @@ qemuProcessReconnect(void *opaque)
      * allowReboot in status XML and we need to initialize it. */
     qemuProcessPrepareAllowReboot(obj);
 
+    if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0)
+        goto error;
+
     if (priv->qemuCaps &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS))
         retry = false;
@@ -7794,9 +7797,6 @@ qemuProcessReconnect(void *opaque)
     if (qemuConnectMonitor(driver, obj, QEMU_ASYNC_JOB_NONE, retry, NULL) < 0)
         goto error;
 
-    if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0)
-        goto error;
-
     priv->machineName = qemuDomainGetMachineName(obj);
     if (!priv->machineName)
         goto error;
-- 
1.9.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]

  Powered by Linux