Fill out README

This commit is contained in:
churchers
2015-06-24 09:58:30 +01:00
parent b2a245047e
commit 6c2052f830

View File

@@ -1,2 +1,87 @@
# vm-bhyve
FreeBSD Bhyve VM Management
Bhyve manager with the following functionality
* Simple virtual switch management - no messing with manual tap devices or bridges
* Automatic ZFS dataset creation (if VM path matches dataset name)
* Startup and shutdown integration
* Automatic handling of reboot and shutdown events
* Dynamic console (nmdm device) creation
##Initial setup instructions
Create a directory for the virtual machines
# mkdir /path/to/my/vms
Update `/etc/rc.conf`
vm_enable="YES"
vm_dir="/path/to/my/vms"
vm_list="" # list to start automatically on boot
vm_delay="5" # seconds delay between starting machines
Initialise all kernel modules and finish creating the directory structure
This command needs to be run once after each host reboot (this is normally handled by the rc.d script included)
**vmm.ko should not be loaded at this point**
# vm init
Copy the sample templates to the folder `/path/to/my/vms/.templates/`
This completes the basic setup
##Virtual Switch Management
Create a new virtual switch and assign em0 to it:
# vm switch create public
# vm switch add public em0
We can also set a vlan number so all traffic heading out of em0 will be tagged:
# vm switch vlan public 10
List the configured switches and their associated bridge device
# vm switch list
##Virtual Machines
Create a new 20G virtual machine using the `default.conf` standard template, and a second 40G ubuntu machine using the `ubuntu.conf` template.
# vm create -s 20G vm1
# vm create -t ubuntu -s 40G vm2
Download an ISO file for installation
# vm iso ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso
Start the install
This will run the bootloader then start bhyve in the background. Connect to the console to complete the install
Once complete, if you reboot the machine at the end of the install process, the machine will reboot as expected and boot up normally. Reboots will work as expected and the machine can be shutdown from the guest in the normal way.
# vm install vm1 FreeBSD-10.1-RELEASE-amd64-disc1.iso
# vm console vm1
To stop a single virtual machine, or all virtual machines from the host:
# vm stop vm1
# vm stopall
To start all virtual machines listed in /etc/rc.conf from the host. To account for the possibility of shared storage being used that contains other machines we don't want running on this host, the list of machines to start is set via the `vm_list=""` variable in `/etc/rc.conf`
# vm startall
All network interfaces and nmdm console devices are created dynamically as the guest is started. The entire time the guest is running, vm sits in the background waiting to handle the bhyve shutdown/reboot. Once a guest is shutdown or exits for any other non-reboot reason, all interfaces and nmdm devices are cleaned up.
As an additional example, a private switch to allow two guests to communicate can be created as follows:
# vm switch create private
Then add the following to the `/path/to/my/vms/vmname/vmname.conf` file for each guest and shutdown/restart.
network1_type="virtio-net"
network1_switch="private"