Roman Bogorodskiy wrote:

>   Craig Rodrigues wrote:
> 
> > On Wed, Jun 11, 2014 at 11:21 AM, Roman Bogorodskiy <[email protected]> 
> > wrote:
> > >
> > > Thanks for the analysis! I'll think what would be a proper fix for that
> > > problem.
> > >
> > > Also, while thinking how to reproduce it, I did 'kldunload if_bridge'
> > > and started to see the same problem. So, as a temporary fix, could you
> > > check if you have bridge support available (in kernel or via module)?
> > >
> > > Bridges are needed to get networking anyway.
> > 
> > 
> > Hi,
> > 
> > My output of kldstat is:
> > 
> >  1   29 0xffffffff80200000 19d6218  kernel
> >  2    1 0xffffffff81bd7000 2e44b0   zfs.ko
> >  3    2 0xffffffff81ebc000 8208     opensolaris.ko
> >  4    1 0xffffffff81ec5000 4d68     nmdm.ko
> >  5    1 0xffffffff81eca000 1a2110   vmm.ko
> >  6    1 0xffffffff82211000 53e7     fdescfs.ko
> >  7    1 0xffffffff82217000 9aff     if_bridge.ko
> >  8    1 0xffffffff82221000 5851     bridgestp.ko
> >  9    1 0xffffffff82227000 5673     if_tap.ko
> > 10    1 0xffffffff8222d000 2a94     uhid.ko
> > 11    1 0xffffffff82230000 3592     ums.ko
> > 
> > 
> > so I do have if_bridge.ko loaded.
> 
> I've attached a patch which should fix the segfault. Could you please
> let me know if it fixes the problem?
> 
> However, we still need to figure out why networking is not being
> enabled. The root cause of that is that libvirt should start the default
> network when the daemon starts up. This network should create a bridge
> device (virbr0).
> 
> Later on, when one starts a guest, it should create tap device and add
> it to the bridge. Obviously, it fails at this step as there's no bridge
> device.
> 
> Could you please send me config.log file and also a port directory with
> your fixes so I could test it as well?
> 
> As for your previous question on my setup, I'm using master branch of the
> libvirt git repo and my configure args are:
> 
> $ ./configure --with-bhyve --without-polkit --with-hal \
>   CFLAGS="-g -O0 -I/usr/local/include" LDFLAGS=-L/usr/local/lib \
>   --with-xml-catalog-file=/usr/local/share/xml/catalog
> 
> I'm working on 10-STABLE.
> 
> However, it's really bad if it works only this way. :-( I would love to
> fix the port.
> 
> > If you are doing development on CURRENT, make sure that you have
> > WITH_LLDB=yes in /etc/src.conf when you rebuild the system.
> > Looks like gdb in base cannot debug the cores.
> 
> Thanks for the hint!

Sorry, forgot the actual attachment. :-(


Roman Bogorodskiy
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 91a8731..ba7a7ec 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -44,7 +44,7 @@ bhyveBuildNetArgStr(const virDomainDef *def, virCommandPtr cmd, bool dryRun)
     virDomainNetDefPtr net = NULL;
     char *brname = NULL;
     char *realifname = NULL;
-    int *tapfd = NULL;
+    int tapfd = -1;
     char macaddr[VIR_MAC_STRING_BUFLEN];
 
     if (def->nnets != 1) {
@@ -80,7 +80,7 @@ bhyveBuildNetArgStr(const virDomainDef *def, virCommandPtr cmd, bool dryRun)
 
         if (!dryRun)
             if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
-                                               def->uuid, tapfd, 1,
+                                               def->uuid, &tapfd, 1,
                                                virDomainNetGetActualVirtPortProfile(net),
                                                virDomainNetGetActualVlan(net),
                                                VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST) < 0) {
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 9f02a49..5e7d603 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -77,10 +77,12 @@ bhyveNetCleanup(virDomainObjPtr vm)
         int actualType = virDomainNetGetActualType(net);
 
         if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
-            ignore_value(virNetDevBridgeRemovePort(
-                            virDomainNetGetActualBridgeName(net),
-                            net->ifname));
-            ignore_value(virNetDevTapDelete(net->ifname));
+            if (net->ifname) {
+                ignore_value(virNetDevBridgeRemovePort(
+                                virDomainNetGetActualBridgeName(net),
+                                net->ifname));
+                ignore_value(virNetDevTapDelete(net->ifname));
+            }
         }
     }
 }

Attachment: pgpPU2Nos0uqM.pgp
Description: PGP signature

Reply via email to