Commit Graph

56 Commits

Author SHA1 Message Date
Matt Churchyard
0d5905bd69 Reimplement the send/recv code as migrate
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.
2021-03-12 14:48:01 +00:00
Matt Churchyard
7fcf2c1d92 Provide a verbose list option to include cpu and memory usage from ps(1) 2020-01-29 14:45:26 +00:00
Mateusz kwiatkowski
3ffbb52d5c Initial support for cloud images
Ref. https://github.com/churchers/vm-bhyve/issues/256
2018-10-17 07:47:19 +02:00
Matt Churchyard
5df10f2408 Add a "vm restart guest" command
This causes a guest shutdown but then restarts the guest without requiring a full
reload or destroying/re-creating network devices.
2018-10-09 11:09:09 +01:00
Matt Churchyard
5a49ed3880 Wrong commands listed in cms::parse_image 2018-07-30 10:52:11 +01:00
Matt Churchyard
3deb348668 Various style changes 2018-07-02 13:53:35 +01:00
Matt Churchyard
b9c6008ecd Move all logic from vm into lib/vm-base
This makes it much easier to switch between versions or modify functionality
just by switching the library files. Very useful for development and also means
the version displayed by "vm version" is linked to the lib files being used, which
is far more appropriate than just the version of the vm executable you have in PATH.
2018-06-29 09:36:38 +00:00
Matt Churchyard
a8e3b1c5cc Change all option handling to be "vm subcommand <opts>"
To reduce code we originally parsed some options globally, such as "vm -f start ...".
However this was confusing and inconsistent, especially in relation to other commands
such as zfs(8).
2018-06-29 09:03:27 +00:00
Matt Churchyard
6ea3ad8af9 Fix #225 - no command specified 2018-06-25 13:24:19 +00:00
Matt Churchyard
7db395ff76 Exiting early on a bad command broke option handling 2018-06-22 12:13:49 +00:00
Matt Churchyard
1edf7155fa Don't output an entire screen of usage info for an invalid command 2018-06-22 08:33:43 +00:00
Matt Churchyard
769d030f26 remove defunct nmdm code 2018-06-22 08:00:21 +00:00
Matt Churchyard
8d11d35dce Add support for named nmdm consoles, and partial commands
It's now possible to run commands such as "vm l" or "vm conf <guest>"
Also named console ports allows us to not bother trying to find the next nmdm number
2018-06-22 07:41:53 +00:00
Matt Churchyard
b4c24b33e8 Finally address #110
Use the -f option to force commands such as reset/destroy/poweroff.
Unfortunately this same option is used for foreground mode when running a vm,
but -f ties up with the force option for many other commands.
2018-06-20 11:59:09 +00:00
Matt Churchyard
2c77228708 Add ability to configure standard switch address 2018-06-18 08:22:17 +00:00
Matt Churchyard
40f1b9ebe1 Add ability to configure private mode on existing switches
Note that we don't bother reconfiguring running guests, so changing
the setting only affects guests started from cold-boot afterwards.
2016-11-18 09:48:19 +00:00
Matt Churchyard
d988e52d2d Rework switch support while getting some SDN on
We already had 3 types of switch (although you could only test vale manually),
with fairly ugly code to handle the differences. Now that a fourth has been added,
split each type into their own 'module'. This adds test vxlan support which can
create arbitrary virtual L2 networks by tunneling traffic over UDP L3.
2016-11-10 11:16:43 +00:00
Matt Churchyard
b1d4a73b33 Add datastore option to vm recv 2016-08-03 18:48:27 +01:00
Matt Churchyard
6cbaa4b01b Few improvements to send/recv & tmux support
*Show tmux in console-ports info output
*Look for an available port for recv operation
The recieve command will output the port it is waiting on.
Send should be run as "vm send guestname remotehost:port"
2016-08-03 10:10:44 +01:00
Matt Churchyard
d7687ddfae Trial some send/recv commands
This allows a guest to be sent between two ZFS based systems with minimal downtime.
Just a toy atm but shows promise as a pretty nifty feature.
2016-08-02 22:11:11 +01:00
Matt Churchyard
42289f5ca8 Add "media" datastores and extend iso handling
If you have a directory (or network mount) containing iso files, you
can configure vm-bhyve to look there by adding it as
a media datastore. (vm datastore iso my-media /path/to/iso/dir).
Also we now look in the current dir for iso files, and accept full paths.
2016-08-01 16:02:57 +01:00
Matt Churchyard
48d2836b4f Allow multiple guests in start command 2016-07-28 10:17:23 -04:00
Matt Churchyard
b88b41381a Add a way to manage global configuration settings.
So far we only have a "console" setting, but there may be more
in the future. This change provides 'vm get' & 'vm set' commands,
that can view or change these config settings.
2016-07-19 15:05:03 +01:00
Matt Churchyard
4ced0019e7 Add an 'interactive' mode (vm -i start|install guest)
This is supported when using tmux for the guest console.
The guest is started on a tmux session, but the session is not
detached so you are immediately placed inside the guest. Similar to
foreground mode, but you can leave the guest running and return to host
using the tmux detach keys (Ctrl+b d)
2016-07-18 13:56:50 +01:00
Matt Churchyard
7036138bdd Small tidy up 2016-06-13 14:02:31 +01:00
Matt Churchyard
e1bedb5be5 Fix some more function names 2016-06-09 15:13:20 +01:00
Matt Churchyard
52b9f2eb8b Follow some Google shell scripting advice
I already do pretty much everything they advise anyway
Grouping functions together by using "prefix::" is quite a nice feature though.
Nothing too clever, just makes use of the fact that a colon appears
to be a valid character in a shell function.
2016-06-09 10:47:47 +01:00
Matt Churchyard
d80bb4fee4 Add check for virt cpu features
Makes sense to display obvious error if host doesn't support bhyve
Also, apparently only FreeBSD guests work on Intel without unrestricted guest, so
display an error if any other guests are started, and limit to 1 vcpu
Gotta keep up with the competition... :)
2016-05-04 14:31:14 +01:00
Matt Churchyard
4ce7e20f16 Few more fixes and remove guest setting 2016-04-19 11:18:25 +01:00
Matt Churchyard
76fe3a5c00 Add ability to remove datastore 2016-04-18 19:25:11 +01:00
Matt Churchyard
1b04706a8b Initial work on multiple datastores 2016-04-18 19:02:37 +01:00
Matt Churchyard
fc3ed2fd3e Go for 1.0-beta
Reduce main version number to maj.min
Add a seperate integer build number that is MNNRRR (M = Major, N = Minor, R = Revision)
We may write this int to .config directory in future versions (poss even 1.0-rel) and
use this to perform automated upgrades when there are changes required between versions.
2016-04-15 19:13:14 +01:00
Matt Churchyard
7d029757a4 Add a default option to __config_get so we don't have to set defaults seperately 2016-04-11 23:00:37 +01:00
Matt Churchyard
9105d7ba4c Add -f foreground option and document it 2016-04-08 21:26:09 +01:00
Matt Churchyard
8db4c18972 Add simple passthru command
This lists PCI devices and shows the B/S/F string to add
to /boot/loader.conf. It also detects if a device has been
picked up by the ppt driver, at which point it should be available
for bhyve.
2016-03-26 12:50:28 +00:00
Matt Churchyard
68c4b0b477 Support global vm options
The first available option is "-d /path", which allows you to specify
a different directory than $vm_dir from /etc/rc.conf.
E.g: vm -d /path start myvm
2016-03-23 13:13:50 +00:00
Matt Churchyard
af2a664d02 Standardise on spaces instead of tabs
Case statements were unncessarily spacious
2015-11-14 14:04:19 +00:00
Matt Churchyard
5fa71fd5a6 vm info & vm switch info
Output pretty much all the useful info we can get our hands
on about guests or switches (if_bridges).
2015-11-11 15:22:56 +00:00
Matt Churchyard
3688894954 Work on #25 - allow custom bridge interfaces 2015-11-09 10:11:28 +00:00
Matt Churchyard
944f645a75 Various new features
We now have snapshot and rollback commands for ZFS. See the man page for
details. Also, there's a new 'debug' configuration option for guests, that
writes the STDOUT & STDERR of the bhyve process to $vm_dir/guest/bhyve.log.
This allows you to see any error output from bhyve itself if a guest fails
when run using the normal 'vm start guest' command.
2015-10-22 11:17:16 +01:00
Matt Churchyard
39dfa7c1a0 Add 'vm rename' function
Also do proper checking of new guest name in this and 'vm create'
2015-10-21 10:51:38 +01:00
Matt Churchyard
b4f0854a3b Code documentation
Add some (admittedly php style) comments to each function to explain what they
do, arguments, and what they output. Useful for anyone who's trying to figure
out how things work and why certain things are done.
2015-10-19 13:27:55 +01:00
Matt Churchyard
aeef3b859b Why not have an add command for disk/network devices 2015-10-16 10:57:48 +01:00
Matt Churchyard
6d6ecb6a34 clone command for ZFS users
makes it easy to duplicate an existing guest
2015-10-15 14:55:48 +01:00
Matt Churchyard
7d84196845 Seperate out bhyve device logic to simplify __vm_run
There are now separate functions which handle base devices, disks & networking
I've also added a new function which adds ppt devices to the bhyve command.
Any modifications can now be made by altering these functions or adding new ones,
rather than making __vm_run more and more extensive.
I've also cleaned up any remaining tab->space issues
2015-08-12 14:46:37 +01:00
Matt Churchyard
ef8544ba8e Force user visible 'vm start' command to only process one argument 2015-08-08 12:43:13 +01:00
Matt Churchyard
16f281a47d Various changes - see full commit message for details
Replace spaces with tabs
Change __nat_init function name to match other functions in the switch library
Completely rewrite guest support, making vm-core logic much cleaner
Guests are now supported via the lib/vm-guest library
Each guest has a function which unifies the install/run logic in once place rather than two.
Loaders now run in the background; Not 100% ideal in some cases but better for most.
This also fixes the small tap0 issue which will now only present itself if you start a guest
with no networking
All guests need more testing with these changes but should be functional.
2015-08-08 12:21:01 +01:00
Matt Churchyard
01687e55f2 Add some basic nat support, few quirks but fairly automated 2015-08-07 16:52:07 +01:00
Matt Churchyard
7e88de9ab9 Enhance and tidy up ZFS support
Also load libs first so __err function is available before we try and use it
2015-08-06 19:31:08 +01:00
Matt Churchyard
dc511083f5 Small tidy up 2015-08-04 16:17:11 +01:00