From owner-freebsd-virtualization@FreeBSD.ORG Wed Jun 11 19:28:26 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4FDA56CD; Wed, 11 Jun 2014 19:28:26 +0000 (UTC) Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com [IPv6:2a00:1450:4010:c04::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F5752BAC; Wed, 11 Jun 2014 19:28:25 +0000 (UTC) Received: by mail-lb0-f174.google.com with SMTP id n15so116493lbi.33 for ; Wed, 11 Jun 2014 12:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Dch8AmgtcJagUb5CBsQanX5oPCOCTV7Kqp0SjwF9/to=; b=mslAJMZBON3ABtLW3P0k0lrUd52pBdESMnw7UG6kCgdbZlCpkFjphiQOWv+grSHyyk uhsya2EJoIYFJSCJlr+h8L2qMiyQPR7GvV0tTqO7EJUmeicIojzA2ESnQlvx9NpDw+42 1AuZiLwBF7fszYLCpP3xNARj84EE6Ytet9EGs1THHKB0cSoxXigHrdKZhG1N4Bk2KSTS BKbER9conaz9kOJp/Ce3QDXD/l2qerwJIbBySYSubelRMuDv7krz96iCzIpPWMW9gnYw RXwwB+72pi34XiFS5PVJaanzTefFW2fVUeGko7sU7OwrxEvSneeEXE4a1pFM8JcEe9y6 zl6Q== X-Received: by 10.152.6.74 with SMTP id y10mr29012815lay.11.1402514903380; Wed, 11 Jun 2014 12:28:23 -0700 (PDT) Received: from kloomba ([95.104.132.28]) by mx.google.com with ESMTPSA id g3sm22329057lam.18.2014.06.11.12.28.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jun 2014 12:28:21 -0700 (PDT) Sender: Roman Bogorodskiy Date: Wed, 11 Jun 2014 23:26:13 +0400 From: Roman Bogorodskiy To: Craig Rodrigues Subject: Re: libvirt and bhyve problems Message-ID: <20140611192611.GF2855@kloomba> References: <20140610175420.GC61743@kloomba> <20140610191439.GA220@kloomba> <20140611182101.GD2855@kloomba> <20140611192514.GE2855@kloomba> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pE2VAHO2njSJCslu" Content-Disposition: inline In-Reply-To: <20140611192514.GE2855@kloomba> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "freebsd-testing@freebsd.org" , Roman Bogorodskiy , "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jun 2014 19:28:26 -0000 --pE2VAHO2njSJCslu Content-Type: multipart/mixed; boundary="JcvBIhDvR6w3jUPA" Content-Disposition: inline --JcvBIhDvR6w3jUPA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Roman Bogorodskiy wrote: > Craig Rodrigues wrote: >=20 > > On Wed, Jun 11, 2014 at 11:21 AM, Roman Bogorodskiy = wrote: > > > > > > Thanks for the analysis! I'll think what would be a proper fix for th= at > > > 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. > >=20 > >=20 > > Hi, > >=20 > > My output of kldstat is: > >=20 > > 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 > >=20 > >=20 > > so I do have if_bridge.ko loaded. >=20 > I've attached a patch which should fix the segfault. Could you please > let me know if it fixes the problem? >=20 > 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). >=20 > 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. >=20 > Could you please send me config.log file and also a port directory with > your fixes so I could test it as well? >=20 > As for your previous question on my setup, I'm using master branch of the > libvirt git repo and my configure args are: >=20 > $ ./configure --with-bhyve --without-polkit --with-hal \ > CFLAGS=3D"-g -O0 -I/usr/local/include" LDFLAGS=3D-L/usr/local/lib \ > --with-xml-catalog-file=3D/usr/local/share/xml/catalog >=20 > I'm working on 10-STABLE. >=20 > However, it's really bad if it works only this way. :-( I would love to > fix the port. >=20 > > If you are doing development on CURRENT, make sure that you have > > WITH_LLDB=3Dyes in /etc/src.conf when you rebuild the system. > > Looks like gdb in base cannot debug the cores. >=20 > Thanks for the hint! Sorry, forgot the actual attachment. :-( Roman Bogorodskiy --JcvBIhDvR6w3jUPA Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="libvirt_no_bridge.diff" Content-Transfer-Encoding: quoted-printable 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, virCommandPt= r cmd, bool dryRun) virDomainNetDefPtr net =3D NULL; char *brname =3D NULL; char *realifname =3D NULL; - int *tapfd =3D NULL; + int tapfd =3D -1; char macaddr[VIR_MAC_STRING_BUFLEN]; =20 if (def->nnets !=3D 1) { @@ -80,7 +80,7 @@ bhyveBuildNetArgStr(const virDomainDef *def, virCommandPt= r cmd, bool dryRun) =20 if (!dryRun) if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net-= >mac, - def->uuid, tapfd, 1, + def->uuid, &tapfd, 1, virDomainNetGetActualVirtPo= rtProfile(net), virDomainNetGetActualVlan(n= et), 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 =3D virDomainNetGetActualType(net); =20 if (actualType =3D=3D 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)); + } } } } --JcvBIhDvR6w3jUPA-- --pE2VAHO2njSJCslu Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iQEcBAEBAgAGBQJTmK1TAAoJEMltX/4IwiJqn8UIAIUivJv+T4xtI4WegKxiSITj oKCnk55jxrhO4maLg6mZcDNTp1U3zAFIpl1+YKMyk5D9Z4hJ1xTYUu6lyNxBZk/B H9eKiC51PO7Kn0RQE3/Bv79S3pLg5ltszbvWnemCLFX4v7+QLDXgL4+ldCN9+qLc AHZ3XlCqLIXg6NZ9C44pQbXYravoUdrTGCKHiYp4pEdRXRkUJwx/kbHXB0YBdLJH 9YZDcN7VhcC/o3ky33L2u3UjDnfl4+CnIvR6JSPGOurreyuhaHi906glZws2vQA+ 5fsdqSPeDXoaTnLRO+KlO8ECwl6x/VPZsFxXOMFNMq2K2pmIbkEBipQcOmH306c= =1S7U -----END PGP SIGNATURE----- --pE2VAHO2njSJCslu--