[libvirt] KVM/qemu: problems with autostart of vms with non-bridged nets

Gerd v. Egidy lists at egidy.de
Mon Dec 1 11:23:12 UTC 2008


Hi Daniel,

> > This patch alone not, but this patch + the one in my first mail
> > (see
> > https://www.redhat.com/archives/libvir-list/2008-November/msg00457.html)
> > together make it work for me. The first patch fixes the autostart order,
> > the second one adds the necessary conn structure.
>
> Oh yes, I totally missed the patch in your first mail. The first patch
> is definitely correct and I'll apply that shortly.

I just added some documentation (same as in virInitialize) to make sure this 
bug does not get introduced again. New version attached.

> While your second 
> patch is also functionally OK, I'm not entirely happy with creating a
> connection object deep inside the QEMU driver code.

Yeah, that was exactly my thought too.

> So I'm going to 
> think about whether there's a better way todo that bit.

I looked through the rest of the qemu-initialization and it looks like this is 
the only point where the conn-object is needed. So a solution would be to 
directly access the network driver functions. But on the other hand these 
functions seem all to imply that there is a valid conn available. So we would 
have to change that, at least for the lookup-by-name case.

But I'm feeling too new in libvirt to actually do design decisions, so it's 
your call...

Kind regards,

Gerd

diff -r -u libvirt-0.5.0.orig/qemud/qemud.c libvirt-0.5.0/qemud/qemud.c
--- libvirt-0.5.0.orig/qemud/qemud.c	2008-11-21 13:47:32.000000000 +0100
+++ libvirt-0.5.0/qemud/qemud.c	2008-12-01 12:21:37.000000000 +0100
@@ -755,28 +755,23 @@
 
     virInitialize();
 
+    /*
+     * Note that the order is important: the first ones have a higher
+     * priority when calling virStateInitialize.
+     */
 #ifdef WITH_DRIVER_MODULES
     /* We don't care if any of these fail, because the whole point
      * is to allow users to only install modules they want to use.
      * If they try to use a open a connection for a module that
      * is not loaded they'll get a suitable error at that point
      */
-    virDriverLoadModule("qemu");
-    virDriverLoadModule("lxc");
-    virDriverLoadModule("uml");
     virDriverLoadModule("network");
     virDriverLoadModule("storage");
     virDriverLoadModule("nodedev");
+    virDriverLoadModule("qemu");
+    virDriverLoadModule("lxc");
+    virDriverLoadModule("uml");
 #else
-#ifdef WITH_QEMU
-    qemuRegister();
-#endif
-#ifdef WITH_LXC
-    lxcRegister();
-#endif
-#ifdef WITH_UML
-    umlRegister();
-#endif
 #ifdef WITH_NETWORK
     networkRegister();
 #endif
@@ -786,6 +781,15 @@
 #if defined(HAVE_HAL) || defined(HAVE_DEVKIT)
     nodedevRegister();
 #endif
+#ifdef WITH_QEMU
+    qemuRegister();
+#endif
+#ifdef WITH_LXC
+    lxcRegister();
+#endif
+#ifdef WITH_UML
+    umlRegister();
+#endif
 #endif
 
     virEventRegisterImpl(virEventAddHandleImpl,

-- 
Address (better: trap) for people I really don't want to get mail from:
james at cactusamerica.com




More information about the libvir-list mailing list