churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
800 stars 168 forks source link

Freebsd 14.1 out with suspend resume #549

Open syleishere opened 1 week ago

syleishere commented 1 week ago

Support needs to be added for bhyvectl --suspend and bhyve -r

yaroslav-gwit commented 1 week ago

Can't see anything in the release notes. Could you please link to the info?

EDIT: Plus it looks like you have to use the checkpoint instead of suspend:

       --checkpoint=<filename>
            Save a snapshot of a virtual machine.   The  guest  memory
            contents  are  saved in the file given in <filename>.  The
            guest  device  and  vCPU  state  are  saved  in  the  file
            <filename>.kern.

       --suspend=<filename>
            Save   a   snapshot   of  a  virtual  machine  similar  to
            --checkpoint.  The virtual machine  will  terminate  after
            the snapshot has been saved.
syleishere commented 6 days ago

I saw the options in the man page in FreeBSD 14.1, I assumed they were working without patching kernel with BHYVE_SNAPSHOT. Trying from command line, options are not recognized, so I guess it has not officially been added yet.

For anyone that wants it working procedure is as follows:

cd /usr/src/sys/amd64/conf
cp GENERIC MYKERNEL
(edit MYKERNEL)  (add: options         BHYVE_SNAPSHOT)
cd /usr/src
make -j$(sysctl -n hw.ncpu) buildworld -DWITH_BHYVE_SNAPSHOT
make -j$(sysctl -n hw.ncpu) buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
shutdown -r now
etcupdate -p
cd /usr/src; make installworld
shutdown -r now
etcupdate -B
shutdown -r now
yaroslav-gwit commented 6 days ago

Just checked the FreeBSD VMs, and the feature is still hidden behind a build flag on the 14-STABLE and 15-CURRENT. Looks like we're not gonna get it any time soon (at least by default that is).

syleishere commented 4 days ago

yaroslav, checked your github repo, haven't tried it but I noticed it says on your hoster page OpenBSD etc not supported. I have had no issues at all running OpenBSD, NetBSD, home assistant etc. Here is link to blog to help you make your project better :) https://blog.sunsaturn.com/freebsd/create-virtual-machines-with-freebsd-vm-bhyve/

Good job on doing all that in GO :) Personally I would have done it on flet framework with a fastapi server, that way it would support all OS's including google tv :) Be nice to see interface on the TV, its 2024 :) Plus if you like working with python, when mojo hits full release status be easy transition to a language faster than C and rust.

yaroslav-gwit commented 3 days ago

I know OpenBSD works under Bhyve, but it threw some bootloader errors when I first tried it in the UEFI mode. Unfortunately, fixing it is not a priority right now (and I personally haven't had a use-case for it, yet).

vm-bhyve has been a huge inspiration for me, that's why I stick around here and help other users, whenever I can :smile:

1st iteration of Hoster was written in Python, but it wasn't cutting it:

So I've learned Go (and JS, eventually, for the front) and never looked back. The project is far from being ready for the prime time, but it's getting there (at least I've got few paying customers, who additionally sponsor my small dev lab). So in the end, I hope to create a virtualisation WebUI (+ backend + CLI, but hey, who is counting?) for the FreeBSD community. The one they want and like (hopefully? lol) :sweat_smile:

(written using Go+VueJS): image image

antranigv commented 3 days ago

@yaroslav-gwit that's pretty impressive! I mean I won't use it personally, but I can see this deployed for customers who want a GUI for management.

Just to be clear, are you automating bhyve, or vm-bhyve under the hood?

yaroslav-gwit commented 3 days ago

I used to automate the vm-bhyve in the beginning, but it became a complete rewrite in the end (because I had to write my own VM process daemon, etc etc). It also has a REST API interface and a "modern feel" CLI, with the autocomplete, pretty tables and whatnot (checkout the repo, it's all there).