This change add simiular support to VALE for netgraph switches. Switches
must be configured manually. Devices will be added using the bhyve
support of netgraph.
Link Num of a peer in the bridge is found by iterrating all devices
already setup in. (Similiar hack is found in jail example).
The "vm" script is responsible for executing shell script
functions found in other vm-bhyve scripts. It does this by
sourcing other vm-bhyve shell scripts, which automatically
execute code that handles the user's input.
One of the first actions "vm" takes is to check if the relative
file "./lib/vm-core" exists. If this file exists, it sets
the parent directory for sourcing scripts to "./lib",
resulting in all shell scripts being sourced from a path
relative to the user's current working directory.
This is unsafe because sourcing from a relative file path
may result in execution of untrusted code.
For example, imagine the user cloned a git repository that
contains malicious code stored at "<git-dir>/lib/". If the
user were to "cd" to this imaginary cloned repository and
execute the "vm" script, they would inadvertently source and
execute code from that directory.
This commit removes this behavior. The "vm" script now
sources scripts exclusively from "/usr/local/lib/vm-bhyve/".
Currently hostname passed to cloud-init is set to VM's name.
With this change it's possible to override this with additional field
in network config. Example:
vm create -t grub -c 4 -m 4096M -i focal-server-cloudimg-amd64.img -s 12G -C -k /tmp/.sshpk.68067 -n 'nameservers=1.1.1.1,8.8.8.8;gateway=185.17.43.97;ip=185.17.43.100/27;netmask=255.255.255.224;hostname=myhostname.example.com' my_virtual_machine
I believe some people did use this, but I had intermittent problems getting it to work reliably.
It has now been re-implemented as a single "migrate" command using ssh.
A guest can now be transferred completely from the source host using a single command.
See the man page for more details
vm migrate -s guest-name new-host
Ideally passwordless key-auth should be used, although not strictly necessary.