[libvirt] [PATCH] lxc: Fix failure on starting a domain that has multiple network interfaces

Ryota Ozaki ozaki.ryota at gmail.com
Sun May 2 21:54:56 UTC 2010


[Error message]
error: Failed to start domain lxc_test1
error: internal error Failed to create veth device pair: 512

The reason of the failure is that lxc driver unexpectedly re-uses
an auto-assigned veth name and tries to create the created veth
again. The failure will happen when a domain has multiple network
interfaces and the names of those are not specified in XML.

The patch fixes the problem by resetting buffers of veth names
in every iteration of creating veth.

* src/lxc/lxc_driver.c: prevent re-using auto-assigned veth name
Reported by Kumar L Srikanth-B22348.
---
 src/lxc/lxc_driver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 409b1cf..554bf66 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -786,14 +786,15 @@ static int lxcSetupInterfaces(virConnectPtr conn,
 {
     int rc = -1, i;
     char *bridge = NULL;
-    char parentVeth[PATH_MAX] = "";
-    char containerVeth[PATH_MAX] = "";
     brControl *brctl = NULL;
 
     if (brInit(&brctl) != 0)
         return -1;
 
     for (i = 0 ; i < def->nnets ; i++) {
+        char parentVeth[PATH_MAX] = "";
+        char containerVeth[PATH_MAX] = "";
+
         switch (def->nets[i]->type) {
         case VIR_DOMAIN_NET_TYPE_NETWORK:
         {
-- 
1.6.5.2




More information about the libvir-list mailing list