[libvirt] [PATCH] hotplug: Fix libvirtd crash on qemu-attached guest

John Ferlan jferlan at redhat.com
Mon Sep 22 20:49:42 UTC 2014


https://bugzilla.redhat.com/show_bug.cgi?id=1141621

Using qemu-attach to attach to a qemu created process and then
attempting to virsh detach-interface caused a libvirtd crash
since the assumption was that device aliases were in place and
that assumption is not necessarily true for the qemu-attach environment.

Add some more verbiage to the virsh man page.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
Notes:
 * The bz also mentions a failure for the hotplug/virsh attach-interface,
   but that has been resolved by commit id 'ba7468db'
 * For the bz, the attempt to attach-interface/hotplug still is not
   successful, since device aliases are not set for the PCI controller.
   * I did try adding a call to qemuAssignDeviceAliases() during the qemu-
     attach code; however, that failed as well (perhaps for a different
     reason) as the attach to PCI slot 3 function 0 was not available
     for rtl8139 since it was being used by e1000
   * If it's desired to add the alias call in that's fine, then that could
     be added in qemuDomainQemuAttach prior to the qemuDomainAssignAddresses 
     call similar to qemuConnectDomainXMLToNative.

 src/qemu/qemu_hotplug.c | 3 ++-
 tools/virsh.pod         | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7bc19cd..b7514ce 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3520,7 +3520,8 @@ qemuDomainDetachNetDevice(virConnectPtr conn,
     qemuDomainMarkDeviceForRemoval(vm, &detach->info);
 
     qemuDomainObjEnterMonitor(driver, vm);
-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+        detach->info.alias) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9919f92..947adaf 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -3686,8 +3686,9 @@ using the UNIX driver. Ideally the process will also have had the
 
 Not all functions of libvirt are expected to work reliably after
 attaching to an externally launched QEMU process. There may be
-issues with the guest ABI changing upon migration, and hotunplug
-may not work.
+issues with the guest ABI changing upon migration and device hotplug
+or hotunplug may not work. The attached environment should be considered
+primarily read-only.
 
 =item B<qemu-monitor-command> I<domain> { [I<--hmp>] | [I<--pretty>] }
 I<command>...
-- 
1.9.3




More information about the libvir-list mailing list