Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Oct 2014 22:05:29 +0400
From:      Roman Bogorodskiy <novel@FreeBSD.org>
To:        Craig Rodrigues <rodrigc@freebsd.org>
Cc:        "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>
Subject:   Re: libvirt improvements for bhyve
Message-ID:  <20141011180528.GA26301@kloomba>
In-Reply-To: <CAG=rPVfsx_w60eFX1RnyJOoJMSQUfSv6E8k7dMV2k4weXGKvrg@mail.gmail.com>
References:  <CAG=rPVfsx_w60eFX1RnyJOoJMSQUfSv6E8k7dMV2k4weXGKvrg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

  Craig Rodrigues wrote:

> Roman,
>=20
> I am using bhyve a lot these days, but
> I find that I need to write scripts on top of
> bhyveload / bhyve in order to work with VM's.
>=20
> I would rather use libvirt, because there are many 3rd party
> programs to work with VM's that are written for libvirt (especially for
> KVM).
>=20
> How hard would it be to implement the following:
>=20
> (1)  The last time I tried libvirt 1.2.7, it did not seem to properly keep
> track
>        if a VM was powered on or shutdown.  If I started a VM with libvir=
t,
>       then did "shutdown -r now", I couldn't seem to restart the VM, unle=
ss
>       I destroyed the VM in libvirt, and restarted.
>       This is very inconvenient.
>=20
>       If you see the latest version of vmrun.sh (
> https://svnweb.freebsd.org/base/head/share/examples/bhyve/vmrun.sh?view=
=3Dmarkup
> )
>       you will see that I added some comments to tell when the VM has
>       been reset, powered off, etc. by looking at the exit status of bhyv=
e.
>=20
>       Can we add this logic to libvirt, so that it can properly tell if
>       a VM is up or not?

Frankly speaking, it's a hard topic for me and currently I don't have a
complete idea how to design that. The thing I'm worried about is that as
far as I understand that exit codes are sort of temporary solution and
will be dropped in the future. Also, it seems the behaviour is changing
already, e.g. IIRC on -CURRENT the bhyve proccess doesn't exit on
reboots (unlike in 10-R). My goal is to support 10-R and I'm not sure
how to probe if exit codes are available or not (and how to probe if
e.g. if new exit code will be added in some future version).

On the other hand, I think I need to check cases when bhyve process
vanishes away and probably set VM status to something like 'shutdown /
error' or something like that.

Also, I think I need to support 'bhyvectl --force-reset' if that's
available.

I guess that should be safe for all versions of bhyve and I'll add it to
my todo list.

> (2)  "bhyveload -e" allows specifying environment variables to loader.
>       Can we have a way to specify loader environment variables,
>       in the libvirt XML config?
>=20
> (3)  "grub-bhyve" is needed to boot VM's for Linux.
>       Can we specify an option to choose between "bhyveload" and
> "grub-bhyve"?

For 2-3 I think bootloader should be honored from the XML file:

http://libvirt.org/formatdomain.html#elementsOSBootloader

I'll add it to my todo list as well.

> (4)  bhyve has many options for specifying which PCI slots to use,
>       and also PCI passthru ( https://wiki.freebsd.org/bhyve/pci_passthru=
 )
>       Can this be specified in libvirt?

Currently you can specify PCI slot and function by using 'address' tag
in the device element (e.g. disk or interface), for example:

    <interface type=3D'bridge'>
      <mac address=3D'52:54:00:f6:41:4e'/>
      <source bridge=3D'virbr0'/>
      <model type=3D'virtio'/>
      <address type=3D'pci' domain=3D'0x0000' bus=3D'0x00' slot=3D'0x02' fu=
nction=3D'0x0'/>
    </interface>

PCI passthrough is not supported as I've never looked at that, will need
to take a look.

>=20
> For me, without (1), libvirt is mostly unusable for bhyve.  (2) - (4) wou=
ld
> be
> nice to have.  However, if we could fix libvirt with these things,
> then a lot of things I do now in scripts, I could do in libvirt.
> I would much rather use libvirt, because then I could take advantage of
> a lot of libvirt software targeted towards KVM.
>=20
> Thanks.
> --
> Craig

Roman Bogorodskiy

--envbJBWh7q8WU6mo
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (FreeBSD)

iQEcBAEBAgAGBQJUOXFoAAoJEMltX/4IwiJqRPwIAI1/NW7Hu6g8gd0vpGa6ojTo
n6HDslR0fj2WsqsxGmVghTL71trn1MFpyfrn9YoVpYN5Umjj8TXmaBO0BOcUEE4C
C++Dh7pe1xSZ+JAc47WC/1UfSCYta8Isuz9fpBlYGsyBVFtni7U0l1EyU5kOUUgT
6TMO7G4kOr1slMbRWtwHE0qn+yq6Ov+OMq5fHF5MNVV4sj9A+gzxIjZRkYncQky1
TBhdzsI4MQgnUXuuPV/CKT+ofVMPzwgAN6GXfUzRjMft+blDHuyyWIkejDhnSwpi
5M5dToNWeNypOKkps3FrEkjGNSzqiu76iVezy/NYVqEPd4C2+JzGnzHIE/P9KAc=
=PgDv
-----END PGP SIGNATURE-----

--envbJBWh7q8WU6mo--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141011180528.GA26301>