summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd/vmd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* The VMD parent process didn't handle the case of a VM exitingmlarkin2017-10-241-6/+9
| | | | | | with a non 0 return properly (i.e. EIO). From: Carlos Cardenas, thanks!
* vmd: retain ownership on vm rebootmlarkin2017-10-071-4/+5
| | | | from Jesper Wallin, thanks!
* vmd: add more explanatory log_debug messagesmlarkin2017-09-081-4/+29
| | | | From Carlos Cardenas, many thanks!
* vmd: Allow only upward migrationpd2017-08-201-4/+125
| | | | | | | | | | This restricts receiving vms from hosts with more cpu features. Tested on broadwell -> skylake (works) skylake -> broadwell (don't work) ok mlarkin@
* vmd: fix vm id displayed by vmctl when receiving a vmpd2017-08-151-4/+4
| | | | Also fix two debug messages and an IMSG type.
* validate vm names before creating them; a valid name contains alphanumericjasper2017-08-141-1/+14
| | | | | | | characters, including '.', '_' and '-'. but does not start with the latter three. ok mlarkin@ pd@
* don't issue a termination command to an already stopped vmjasper2017-08-131-1/+5
| | | | ok mlarkin@
* Add vmctl send and vmctl receivepd2017-07-151-2/+91
| | | | ok reyk@ and mlarkin@
* vmd/vmctl: Add ability to pause / unpause vmspd2017-07-091-1/+42
| | | | | | With help from Ashwin Agrawal ok reyk@ mlarkin@
* vmd(8): prevent crashing when presented with a vm name argument tomlarkin2017-05-291-3/+6
| | | | | | "vmctl stop" that doesn't exist. Diff from Pratik Vyas, thanks!
* Report command failure back to vmctl reload, reset, load, log verbose.reyk2017-05-041-8/+18
| | | | OK mlarkin@
* Add support for rdomains.reyk2017-05-041-1/+5
| | | | | | This allows to configure VM interfaces and switches in individual rdomains. OK mlarkin@
* Generate randomized MAC addresses earlier to keep them across reboots.reyk2017-04-251-1/+21
| | | | OK deraadt@
* Add global configuration option "local prefix" to change prefix for -L.reyk2017-04-211-1/+9
| | | | | | | The default prefix is 100.64.0.0/10 from RFC6598. Requested by sthen@ chris@ OK mlarkin@
* Add support for dynamic "NAT" interfaces (-L/local interface).reyk2017-04-191-1/+13
| | | | | | | | | | | | | When a local interface is configured, vmd configures a /31 address on the tap(4) interface of the host and provides another IP in the same subnet via DHCP (BOOTP) to the VM. vmd runs an internal BOOTP server that replies with IP, gateway, and DNS addresses to the VM. The built-in server only ever responds to the VM on the inside and cannot leak its DHCP responses to the outside. Thanks to Uwe Werler, Josh Grosse, and some others for testing! OK deraadt@
* Do not expose vmm(4) VM IDs to the user, use vmd(8)'s IDs instead.reyk2017-04-061-9/+37
| | | | | | | | | | | | | Each VM has two IDs: one from the kernel (vmm) and a different one from userland (vmd). The vmm ID is not consistent and incremented on every boot during runtimg of the host system. The vmd ID remains the same during the lifetime of a configured VM, even after reboots. Configured VMs will even get and keep their IDs when the configuration is loaded. This is more what users expect. Pointed out and tested by otto@ OK deraadt@
* More fixes for starting and stopping VMs, fixing fallout from vm_running.reyk2017-03-151-8/+17
| | | | | | | | | | | | | - Don't start a VM that is already running - Keep the VM as running until it is powered off (and not stopping) - Don't fatal in the parent if the vmm process referenced an unknown VM - Don't stop a VM that is already stopping - Indicate that a VM is stopping in "vmctl status" The previous "vmctl stop; vmctl stop" to force-shutdown is not supported anymore - the shutdown timeout should make sure that the VM is really terminated. To force-shutdown, reference the VM by ID. We might add a flag to vmctl stop to just turn the VM off.
* Close the tty if the VM was powered down.reyk2017-03-151-6/+9
| | | | | | | The parent keeps a copy of each VM's tty fd to reuse it on reboot. Close this tty if the VM was stopped, and not rebooted, by calling vm_stop(vm, 0) instead of just setting vm_running to 0. Also make sure that vm_ttyname is not used after free'ing it.
* Add "locked lladdr" option to prevent VMs from spoofing MAC addresses.reyk2017-03-021-2/+10
| | | | | | | This is especially useful when multiple VMs share a switch, the implementation is independent from the underlying switch or bridge. no objections mlarkin@
* Add "owner" option to set a user/group ownership for pre-configured VMsreyk2017-03-011-8/+128
| | | | | | | This allows matching users to start or stop VMs that they "own" and to access the console accordingly. OK mlarkin@
* Replace openpty(3) with local function that uses pre-opened /dev/ptm fdreyk2017-02-271-13/+49
| | | | | | | | This allows more flexibility for upcoming changes and better pledge. We also didn't use half of the features of libutil's openpty function. Additionally, make sure that the ttys are closed correctly on shutdown. OK gilles@
* Make it possible to remove VMs from vmd(8)'s internal queue.edd2017-01-131-8/+29
| | | | | | | | | The semantics agreed with reyk@ are: * ad-hoc created vms, created with `vmctl start`, are removed once stopped. * Stopped VMs defined in a config file are flushed before a `vmctl reload`. OK reyk@
* Add imsg communication channel between vmd and invividual VMs.reyk2017-01-111-2/+15
| | | | | | | For now, this is only used to forward "log verbose|brief" requests, but it will be used for better things later. OK mlarkin@
* Stop accessing verbose and debug variables from log.c directly.reyk2017-01-091-2/+2
| | | | | | | | This replaces log_verbose() and "extern int verbose" with the two functions log_setverbose() and log_getverbose(). Pointed out by benno@ OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)
* Allow to start disabled and pre-configured VMs by name, "vmctl start foo".reyk2016-12-141-3/+18
| | | | | | With testing from Jon Bernard OK mlarkin@
* If a VM terminates with the result EAGAIN, close all fds except thereyk2016-12-141-11/+48
| | | | | | | | pty and re-send it to the vmm monitor process. With additional changes in vmm.c, this will allow perform a cold reboot of VM. With testing and feedback from Jon Bernard OK mlarkin@
* Implement basic support for boot.conf(8) on the disk image.reyk2016-11-261-6/+3
| | | | | | | | | | | | | | | | Like the real boot loader, load and parse hd0a:/etc/boot.conf from the first disk and fall back to /bsd. Not all boot loader options are supported, but it at least does set device, set image, and boot -acds (eg. for booting single-user). For example, it can now boot install60.fs that includes a boot.conf with "set image /6.0/amd64/bsd.rd": vmctl start install -c -d install60.fs -d OpenBSD.img This pseudo-bootloader is only needed without BIOS and could potentially be replaced in the future. OK mlarkin@
* If -m/memory is not specified, use 512M by default.reyk2016-11-261-1/+3
| | | | | | Default value picked with mlarkin - not too small and not too large. OK mlarkin@
* Add support for booting the kernel from the disk image.reyk2016-11-241-6/+12
| | | | | | | | | | | | | | This make the kernel/-k argument optional and, if not specified, tries to find the /bsd kernel in the primary hd0a partition of the first disk image itself. It doesn't support hd0a:/etc/boot.conf yet, and it is no BIOS or full boot loader, but it makes booting and handling of VMs a bit easier - booting an external kernel is still supported. The UFS file system code ufs.c is directly from libsa which is also used by the real boot loader. The code compiles with a few signedness warning which will be fixed separately. OK mlarkin@
* Fix error path of config_setvm() and its callers. This unbreaksreyk2016-11-221-28/+10
| | | | | | | loading of invalid kernel files. Reported by mlarkin@ OK mlarkin@
* There is no need for res when there is already ret.reyk2016-11-221-5/+4
|
* Insert disabled VMs into vmd(8)'s queues and allow vmctl(8) to display them.edd2016-11-221-1/+38
| | | | | | | | Tested by Jon Bernard and reyk@. OK reyk@, no objections mlarkin@. Thanks
* Pass the internal vmid or 0 to vm_register() instead of changing itreyk2016-11-041-4/+7
| | | | | | once again after setting the next available id. Suggested by edd@
* Update the config/register/get VM methods to match the config_set/getreyk2016-11-041-5/+62
| | | | | | style that is used in other places. Also keep the vmid from the parent. OK edd@
* Separate parsing vms and switches from starting them in vmd(8).edd2016-10-291-7/+70
| | | | | | | Brings us one step closer to having disabled by default vms is vm.conf(5), which can be started with vmctl(8). Input, testing and OK reyk@. Thanks.
* Add the option to specify an interface group per virtual switch as well;reyk2016-10-171-1/+2
| | | | | | this group will be added to all VM tap(4) interfaces in the switch. Tested by martijn@
* Allow to add an interface to an interface group; with the group keyword.reyk2016-10-151-1/+2
| | | | Requested and tested by martijn@
* Fix functionality and semantics of vmctl load/reload/reset.reyk2016-10-121-16/+25
| | | | OK rzalamena@
* Terminate VMs on shutdown of vmd instead of leaving them running asreyk2016-10-061-3/+2
| | | | | | undead VM processes. OK mlarkin@
* Add support for enhanced networking configuration and virtual switches.reyk2016-10-051-8/+47
| | | | | | See vm.conf(5) for more details. OK mlarkin@
* Add a new "priv" process that is responsible for ioctls and restrictedreyk2016-10-041-8/+31
| | | | | | | | | | | operations that aren't allowed under pledge. This is a companion to the "vmd" process that runs as root but with pledge. With the "priv" process, each new tap(4) interface now gets a description to indicate the vm, eg. "vm1-if0-myvm". For network configuration will be done by vmd/priv later. OK mlarkin@
* Implement fork+exec for vmd, using the same framework from httpd etc.reyk2016-09-291-63/+39
| | | | No objections from mlarkin@ sunil@
* small bits of header cleanup; ok mlarkinderaadt2016-08-171-2/+2
|
* Allow starting a VM again after it was terminatedstefan2016-07-291-2/+18
| | | | | | | | | | | If a VM exits, terminate it and remove it from the list of available VMs. That allows a VM with name `foo' to be restarted after it has exited. This changes structures shared between vmd and vmctl. You need to rebuild vmctl also. ok mlarkin@
* Fix a possible use-after-free in vmd, forward the result to thereyk2016-02-051-16/+23
| | | | | | control socket before free'ing the vm. Found by and OK jsg@
* Remove setproctitle() for the parent process. Because rc.d(8) uses processsthen2016-02-021-2/+1
| | | | | | titles (including flags) to distinguish between daemons, this makes it possible to manage multiple copies of a daemon using the normal infrastructure by symlinking rc.d scripts to a new name. ok jung@ ajacoutot@, smtpd ok gilles@
* The vmctl "id" argument can now be a number of or a vm name, eg.reyk2015-12-111-9/+45
| | | | | vmctl stop 3 vmctl stop "openbsd.vm"
* when checking the config file with -n don't open /dev/vmm or require rootjsg2015-12-081-6/+10
| | | | ok reyk@
* make the -f option work as intendedjsg2015-12-081-2/+2
| | | | ok reyk@
* tweak initial error loggingreyk2015-12-071-4/+4
|