OpenBSD CVS

CVS log for src/usr.sbin/vmd/config.c


[BACK] Up to [local] / src / usr.sbin / vmd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.75 / (download) - annotate - [select for diffs], Mon Feb 5 21:58:09 2024 UTC (4 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.74: +18 -9 lines
Diff to previous 1.74 (colored)

Cleanup fcntl(3) usage and fd lifetimes in vmd(8).

Remove extraneous fcntl(3) usage for setting fd features that can
be set at time of open(2), pipe2(2), or socketpair(2). Also cleans
up pty creation switching to using functions from libutil instead
of direct ioctl(2) calls.

ok mlarkin@, original diff ok claudio@ as well.

Revision 1.74 / (download) - annotate - [select for diffs], Thu Jan 18 14:49:59 2024 UTC (4 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.73: +22 -17 lines
Diff to previous 1.73 (colored)

Use imsg_get_fd() in vmd.

vmd uses a lot of fd passing and does it sometimes via extra abstraction
so this just tries to convert the code without any optimisations.

ok dv@

Revision 1.73 / (download) - annotate - [select for diffs], Wed Jan 3 22:34:39 2024 UTC (5 months ago) by dv
Branch: MAIN
Changes since 1.72: +3 -2 lines
Diff to previous 1.72 (colored)

vmd(8): improve error messages when out of tap devices.

The logging and the (lack of) errno don't describe the actual reason
a vm fails to start when there are not enough tap(4) special files
in /dev. Improve the log message to specify the tap file in question
and set ENOENT so vmctl(8) gets something other than an undefined
errno value to report.

ok bluhm@

Revision 1.72 / (download) - annotate - [select for diffs], Thu Jul 13 18:31:59 2023 UTC (10 months, 4 weeks ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.71: +5 -7 lines
Diff to previous 1.71 (colored)

vmd(8): pull validation into local prefix parser.

Validation for local prefixes, both inet and inet6, was scattered
around. To make it even more confusing, vmd was using generic address
parsing logic from prior network daemons. vmd doesn't need to parse
addresses other than when parsing the local prefix settings in
vm.conf and no runtime parsing is needed.

This change merges parsing and validation based on vmd's specific
needs for local prefixes (e.g. reserving enough bits for vm id and
network interface id encoding in an ipv4 address). In addition, it
simplifies the struct from a generic address struct to one focused
on just storing the v4 and v6 prefixes and masks. This cleans up an
unused TAILQ struct member that isn't used by vmd and was leftover
copy-pasta from those prior daemons.

The address parsing that vmd uses is also updated to using the
latest logic in bgpd(8).

ok mlarkin@

Revision 1.71 / (download) - annotate - [select for diffs], Fri Apr 28 19:46:42 2023 UTC (13 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.70: +24 -20 lines
Diff to previous 1.70 (colored)

vmd(8)/vmctl(8): allow vm owners to override boot kernel.

vmd allows non-root users to "own" a vm defined in vm.conf(5). While
the user can start/stop the vm, if they break their filesystem they
have no means of booting recovery media like a ramdisk kernel.

This change opens the provided boot kernel via vmctl and passes the
file descriptor through the control channel to vmd. The next boot
of the vm will use the provided file descriptor as boot kernel/bios.
Subsequent boots (e.g. a reboot) will return to using behavior
defined in vm.conf or the default bios image.

ok mlarkin@

Revision 1.70 / (download) - annotate - [select for diffs], Tue Apr 25 12:46:13 2023 UTC (13 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.69: +24 -24 lines
Diff to previous 1.69 (colored)

vmm(4)/vmd(8): pull struct members out of vmm ioctl create struct.

The object sent to vmm(4) contained file paths and details the
kernel does not need for cpu virtualization as device emulation is
in userland. Effectively, "pull up" the struct members from the
vm_create_params struct to the parent vmop_create_params struct.

This allows us to clean up some of vmd(8) and simplify things for
switching to having vmctl(8) open the "kernel" file (SeaBIOS, bsd.rd,
etc.) to allow users to boot recovery ramdisk kernels.

ok mlarkin@

Revision 1.69 / (download) - annotate - [select for diffs], Sun Apr 2 02:04:10 2023 UTC (14 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (colored)

vmd(8): migrate vmd_vm.vm_ttyname to char array.

Other structs use a fixed length array already. This allows a vmd_vm
object to be transmitted over an ipc channel, too.

Additionally, solves a segfault caused by a strlcpy(3) in an error
path.

ok mlarkin@

Revision 1.68 / (download) - annotate - [select for diffs], Wed Feb 22 10:04:45 2023 UTC (15 months, 2 weeks ago) by mbuhl
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (colored)

Explicitly initialize vmd_vm pointer with NULL before calling vm_register.
Found by codechecker.
ok dv@

Revision 1.67 / (download) - annotate - [select for diffs], Sat Jan 28 14:40:53 2023 UTC (16 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.66: +3 -3 lines
Diff to previous 1.66 (colored)

Move some header definitions from vmm(4) to vmd(8).

Part of an ongoing effort to move userland-specific information out
of a kernel header and directly into vmd(8). No functional change.

ok mlarkin@

Revision 1.66 / (download) - annotate - [select for diffs], Mon Oct 31 14:02:11 2022 UTC (19 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.65: +1 -14 lines
Diff to previous 1.65 (colored)

vmd(8): remove unfinished user accounting.

User accounting and enforcement was never finished. tedu the thing
until someone wants to pick it up and finish it.

Originally found by Matthew Martin.

ok mlarkin@, kn@. input from tb@.

Revision 1.65 / (download) - annotate - [select for diffs], Sun May 8 14:44:54 2022 UTC (2 years, 1 month ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.64: +10 -1 lines
Diff to previous 1.64 (colored)

vmd: fix rebooting a received vm

Rebooting a received vm resulted in vmd(8) exiting as a result of
flawed state tracking in the parent process.

When stopping a vm, clear the VM_RECEIVE_STATE flag. When starting
a vm, make sure the parent process collapses any existing memory
ranges after the vm is sent to the vmm process (responsible for
launching the vm).

ok mlarkin@

Revision 1.64 / (download) - annotate - [select for diffs], Wed Nov 10 20:49:04 2021 UTC (2 years, 6 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

Remove switch(4) pieces, feedback/missing piece millert@ ok claudio@ mlarkin@

Revision 1.63 / (download) - annotate - [select for diffs], Sun Jul 18 11:55:45 2021 UTC (2 years, 10 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.62: +32 -31 lines
Diff to previous 1.62 (colored)

vmd(8): remove invalid errno values from config_setvm

Refactor config_setvm to directly return error code on failure
instead of returning -1 and setting errno. It was setting unsupported
values not defined in <errno.h>.

OK mlarkin@

Revision 1.62 / (download) - annotate - [select for diffs], Wed May 12 02:24:56 2021 UTC (3 years, 1 month ago) by mlarkin
Branch: MAIN
Changes since 1.61: +3 -3 lines
Diff to previous 1.61 (colored)

vmd(8): omit a possibly uninitialized var in a log_warnx

Don't print 'base' since it might not be initialized in all code paths.

From James Cook

Revision 1.61 / (download) - annotate - [select for diffs], Mon Mar 29 23:37:01 2021 UTC (3 years, 2 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.60: +8 -1 lines
Diff to previous 1.60 (colored)

Propagate host-side tap(4) lladdr to guest vm process to allow unicast dhcp
and bootp renewals with vmd(8)'s built-in dhcp server. Previous behavior
ignored did not intercept these packets and instead transmitted them.

This should make vmd(8)'s dhcp behave more as a true dhcp server should and
allows it to work properly with the new dhcpleased(8) attempting a renewal.

OK mlarkin@

Revision 1.60 / (download) - annotate - [select for diffs], Fri Mar 19 09:29:33 2021 UTC (3 years, 2 months ago) by kn
Branch: MAIN
Changes since 1.59: +5 -13 lines
Diff to previous 1.59 (colored)

Remove booting from kernels in raw/qcow2 images

Diff and (slightly tweaked) text below from
Dave Voutila < dave at sisu dot io >, thanks!

--
Since 6.7 switched to FFS2 as the default filesystem for new installs,
the ability for vmd(8) to load a kernel and boot.conf from a disk image
directly (without SeaBIOS) has been broken.

A diff from tb to add FFS2 support never mdae it into the tree.

On 5th Jan 2021, new ramdisks for amd64 have started shipping gzipped,
breaking the ability to load the bsd.rd directly as a kernel image for a vmd
guest without first uncompressing the image.

Using BIOS works, the FFS2 change happend ten months ago and few if any have
complained about the breakage.  vmctl(8) is still vague about supporting it
per its man page and one still has to pass the disk image twice as a "-b"
and "-d" argument to boot an OpenBSD guest *without* BIOS.

Josh Rickmar reported the gzip issue on bugs@ and provided patches to add
support for compressed ramdisks and kernel images.  The easiest way to do so
is to drop support for FFS images since they require a call to fmemopen(3)
while all the other logic uses fopen(3)/fdopen(3) calls and a file
descriptor.  It is much easier to get thsoe patches merged if they don't
have to account for extracting files from disk images.
--

No objections anyone
"Removing it makes sense" reyk (who wrote the FFS module)
OK mlarkin

Revision 1.59 / (download) - annotate - [select for diffs], Sun Feb 28 22:56:09 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

add veb(4) to the list of supported bridges/switches you can configure.

tested by josh rickmar
ok kn@

Revision 1.58 / (download) - annotate - [select for diffs], Sat May 11 19:55:14 2019 UTC (5 years, 1 month ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.57: +7 -7 lines
Diff to previous 1.57 (colored)

track the state of the vm (running, paused, etc) using a single bitfield instead of
a handful of separate variables. this will makes it easier for vmd to report
and check on the individual vm states

no functional change intended

ok ccardenas@ mlarkin@

Revision 1.57 / (download) - annotate - [select for diffs], Mon Nov 26 05:44:46 2018 UTC (5 years, 6 months ago) by ori
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.56: +9 -1 lines
Diff to previous 1.56 (colored)

Keep a list of known vms, and reuse the VM IDs.

This means that when using '-L', the IP addresses of the VMs are stable.

ok reyk@

Revision 1.56 / (download) - annotate - [select for diffs], Sat Nov 24 04:51:55 2018 UTC (5 years, 6 months ago) by ori
Branch: MAIN
Changes since 1.55: +6 -8 lines
Diff to previous 1.55 (colored)

Improve error handling and logging in qcow2

This turns most warn + returns that should never happen into hard failures,
and improves the user directed error messages.

ok @mlarkin, @reyk

Revision 1.55 / (download) - annotate - [select for diffs], Wed Nov 21 12:31:47 2018 UTC (5 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.54: +32 -5 lines
Diff to previous 1.54 (colored)

Add support for "local inet6" interfaces.

ok & test ccardenas@, additional review from kn@

Revision 1.54 / (download) - annotate - [select for diffs], Fri Oct 26 11:24:45 2018 UTC (5 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.53: +3 -2 lines
Diff to previous 1.53 (colored)

I broke base images with my previous commit by missing a line.

The disk path wasn't updated so vmd tried to open the derived disk
image for each base over and over again.

OK ori@ mlarkin@

Revision 1.53 / (download) - annotate - [select for diffs], Fri Oct 19 10:12:39 2018 UTC (5 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.52: +2 -28 lines
Diff to previous 1.52 (colored)

Add support to create and convert disk images from existing images

The -i option to vmctl create (eg. vmctl create output.qcow2 -i input.img)
lets you create a new image from an input file and convert it if it is a
different format.  This allows to convert qcow2 images from raw images,
raw from qcow2, or even qcow2 from qcow2 and raw from raw to re-optimize
the disk.

This re-uses Ori's vioqcow2.c from vmd by reaching into it and
compiling it in.  The API has been adjust to be used from both vmctl
and vmd accordingly.

OK mlarkin@

Revision 1.52 / (download) - annotate - [select for diffs], Mon Oct 15 10:35:41 2018 UTC (5 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.51: +35 -1 lines
Diff to previous 1.51 (colored)

Prevent VM reboot loops by rate-limiting the interval a VM can reboot.

This looping has been experienced by people who run VMs with a broken
kernel or boot loader that trigger a very fast reboot loop (triple
fault) of a VM that ends up using a lot of CPU and resources on the
host.  Some fixes in vmm(4) and vmd(8) helped to avoid such conditions
but it can still occur if something is wrong in the guest VM itself.

If the VM restarts after less than VM_START_RATE_SEC (6) seconds, we
increment the limit counter.  After VM_START_RATE_LIMIT (3) of suchs
fast reboots the VM is stopped.

There are only very few people who intentionally want to reboot-loop a
VM very quickly (many times within a second); mostly for fuzzing.
They will have to recompile and adjust the stated #defines in the code
as we don't have a config option to disable it.

OK mlarkin@

Revision 1.51 / (download) - annotate - [select for diffs], Mon Oct 8 16:32:01 2018 UTC (5 years, 8 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.50: +96 -39 lines
Diff to previous 1.50 (colored)

Add support for qcow2 base images (external snapshots).

This works is from Ori Bernstein, committing on his behalf:

Add support to vmd for external snapshots. That is, snapshots that are
derived from a base image. Data lookups start in the derived image,
and if the derived image does not contain some data, the search
proceeds ot the base image.  Multiple derived images may exist off of
a single base image.

A limitation of this format is that modifying the base image will
corrupt the derived image.

This change also adds support for creating disk derived disk images to
vmctl.  To use it:

	vmctl create derived.qcow2 -s 16G -b base.qcow2

From Ori Bernstein
OK mlarkin@ reyk@

Revision 1.50 / (download) - annotate - [select for diffs], Tue Aug 7 14:49:05 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

Post-g2k18 fix: unbreak the optional vmd-internal vmboot loader.

The new vm_checkaccess() call didn't account for the vmboot case.

OK ccardenas@ mikeb@

Revision 1.49 / (download) - annotate - [select for diffs], Tue Aug 7 11:28:29 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.48: +5 -5 lines
Diff to previous 1.48 (colored)

Fix paste error in "no read access to" debug message, tweak messages.

Found by mikeb@

Revision 1.48 / (download) - annotate - [select for diffs], Sun Jul 15 14:36:54 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.47: +17 -2 lines
Diff to previous 1.47 (colored)

Track resources and enforce cpu/memory/interface limits for non-root users.

The limits are currently hard-coded and undocumented (4 CPUs/VMs, 2G
memory, 8 interfaces) but will be configurable in an upcoming diff.
These limits are tracked in total usage; for example, a user will be
able to run up to 4 VMs with 512M of memory or a single VM with 2G.

OK ccardenas@ mlarkin@

Revision 1.47 / (download) - annotate - [select for diffs], Fri Jul 13 10:26:57 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.46: +24 -22 lines
Diff to previous 1.46 (colored)

Check the disk/kernel/cdrom file permissions after openening the fd.

This prevents time of TOCTOU attacks for instances.

OK mlarkin@

Revision 1.46 / (download) - annotate - [select for diffs], Wed Jul 11 13:19:47 2018 UTC (5 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.45: +2 -1 lines
Diff to previous 1.45 (colored)

Add -w option to vmctl stop to wait for completion of VM termination.

Use it in /etc/rc.d/vmd accordingly.

OK sthen@

Revision 1.45 / (download) - annotate - [select for diffs], Tue Jul 10 16:15:51 2018 UTC (5 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.44: +16 -17 lines
Diff to previous 1.44 (colored)

Tweak debug log messages

- Turn tracing messages into DPRINTF (only compiled with DEBUG).

- Pass __func__ to vm_stop and vm_remove: this way we can track who
called the function in the async context.  It replaces the manual
log_debug in front of each vm_stop/vm_remove.  This debug logging
trick can be removed in the future once we are more confident about
it.

OK ccardenas@ mlarkin@

Revision 1.44 / (download) - annotate - [select for diffs], Tue Jun 19 18:15:01 2018 UTC (5 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.43: +11 -5 lines
Diff to previous 1.43 (colored)

print process name in debug message

Revision 1.43 / (download) - annotate - [select for diffs], Tue Jun 19 17:12:34 2018 UTC (5 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.42: +5 -6 lines
Diff to previous 1.42 (colored)

knf

Revision 1.42 / (download) - annotate - [select for diffs], Wed Mar 14 07:29:34 2018 UTC (6 years, 2 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.41: +3 -2 lines
Diff to previous 1.41 (colored)

block two VMs from using the same disk image file at the same time.
Also changes an error message in vmctl to reflect same.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Jan 26 05:34:41 2018 UTC (6 years, 4 months ago) by ccardenas
Branch: MAIN
Changes since 1.40: +8 -3 lines
Diff to previous 1.40 (colored)

Fix Failure on Start

When attempting to start a vm from vm.conf that fails due to inadequate
resources and such, do not remote vm entry from vm list.

Reported by mpi@

ok mpi@

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jan 5 13:34:52 2018 UTC (6 years, 5 months ago) by jca
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

Use log_warnx() in places where errno is irrelevant.

ok mlarkin@ ccardenas@

Revision 1.39 / (download) - annotate - [select for diffs], Thu Jan 4 15:19:56 2018 UTC (6 years, 5 months ago) by ccardenas
Branch: MAIN
Changes since 1.38: +8 -8 lines
Diff to previous 1.38 (colored)

Address TOCTOU issue with checking to ensure disks are regular files.

Reported by jca@.

Ok mlarkin@ and deraadt@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jan 3 05:39:56 2018 UTC (6 years, 5 months ago) by ccardenas
Branch: MAIN
Changes since 1.37: +59 -1 lines
Diff to previous 1.37 (colored)

Add initial CD-ROM support to VMD via vioscsi.

* Adds 'cdrom' keyword to vm.conf(5) and '-r' to vmctl(8)
* Support various sized ISOs (Limitation of 4G ISOs on Linux guests)
* Known working guests: OpenBSD (primary), Alpine Linux (primary),
  CentOS 6 (secondary), Ubuntu 17.10 (secondary).
  NOTE: Secondary indicates some issue(s) preventing full/reliable
  functionality outside the scope of the vioscsi work.
* If the attached disks are non-bootable (i.e. empty), SeaBIOS (vmd's
  default BIOS) will boot from CD-ROM.

ok mlarkin@, jca@

Revision 1.37 / (download) - annotate - [select for diffs], Sat Nov 4 07:57:14 2017 UTC (6 years, 7 months ago) by mlarkin
Branch: MAIN
Changes since 1.36: +1 -2 lines
Diff to previous 1.36 (colored)

whitespace

Revision 1.36 / (download) - annotate - [select for diffs], Thu Sep 14 10:07:17 2017 UTC (6 years, 8 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.35: +14 -12 lines
Diff to previous 1.35 (colored)

spacing

Revision 1.35 / (download) - annotate - [select for diffs], Fri Sep 8 06:24:31 2017 UTC (6 years, 9 months ago) by mlarkin
Branch: MAIN
Changes since 1.34: +12 -2 lines
Diff to previous 1.34 (colored)

vmd: add more explanatory log_debug messages

From Carlos Cardenas, many thanks!

Revision 1.34 / (download) - annotate - [select for diffs], Thu Aug 31 06:23:37 2017 UTC (6 years, 9 months ago) by mlarkin
Branch: MAIN
Changes since 1.33: +16 -1 lines
Diff to previous 1.33 (colored)

vmd/vmctl: disallow use of block or character devices as disks in VMs.

These don't work today and present the user with a confusing error
message if an attempt is made to use them. This commit detects attempts
to use block or character devices and if detected, presents the user with
a better message.

ok jasper

From Carlos Cardenas, thanks!

Revision 1.33 / (download) - annotate - [select for diffs], Fri Aug 18 07:01:29 2017 UTC (6 years, 9 months ago) by mlarkin
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

distinguish errors during vm launch and return different error codes to
vmctl so that it can display proper errors for "disk missing" and "bios
missing" situations. Expands on an earlier idea/diff from jasper.

ok jasper@, pd@, tedu@

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jul 15 05:05:36 2017 UTC (6 years, 10 months ago) by pd
Branch: MAIN
Changes since 1.31: +39 -27 lines
Diff to previous 1.31 (colored)

Add vmctl send and vmctl receive

ok reyk@ and mlarkin@

Revision 1.31 / (download) - annotate - [select for diffs], Thu May 4 08:26:06 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.30: +4 -1 lines
Diff to previous 1.30 (colored)

Add support for rdomains.

This allows to configure VM interfaces and switches in individual rdomains.

OK mlarkin@

Revision 1.30 / (download) - annotate - [select for diffs], Fri Apr 21 07:03:26 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.29: +33 -2 lines
Diff to previous 1.29 (colored)

Add global configuration option "local prefix" to change prefix for -L.

The default prefix is 100.64.0.0/10 from RFC6598.

Requested by sthen@ chris@
OK mlarkin@

Revision 1.29 / (download) - annotate - [select for diffs], Sun Mar 26 18:32:39 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.28: +12 -12 lines
Diff to previous 1.28 (colored)

Don't compare kernel and root disk name if both strings are empty.

This avoids jumping into vmboot in some edge conditions.

OK mlarkin@

Revision 1.28 / (download) - annotate - [select for diffs], Sun Mar 26 00:46:00 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
Changes since 1.27: +9 -4 lines
Diff to previous 1.27 (colored)

Use the pseudo-bootloader if the boot image path matches the root disk path.

This allows to use the non-BIOS on-disk bootloader for testing.  It
might go away after release when we feel more confident about BIOS.

OK mlarkin@

Revision 1.27 / (download) - annotate - [select for diffs], Sat Mar 25 16:28:25 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
Changes since 1.26: +14 -3 lines
Diff to previous 1.26 (colored)

Boot using BIOS from /etc/firmware/vmm-bios by default.

Instead of using the internal "vmboot", VMs will now be booted using
the external BIOS firmware in /etc/firmware/vmm-bios (which is subject
to a LGPLv3 license).  Direct booting of OpenBSD kernels or
non-default BIOS images is still supported for now using the -b/boot
option that is replacing the -k/kernel option.

As requested by Theo, vmd(8) fails if neither the default BIOS is
found nor a kernel has been specified in the VM configuration.  The
"vmm" BIOS has to be installed using fw_update(1), which will be done
automatically in most cases where the OpenBSD can fetch it after
install/upgrade.

OK mlarkin@

Revision 1.26 / (download) - annotate - [select for diffs], Thu Mar 2 07:33:37 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.25: +3 -2 lines
Diff to previous 1.25 (colored)

Add "locked lladdr" option to prevent VMs from spoofing MAC addresses.

This is especially useful when multiple VMs share a switch, the
implementation is independent from the underlying switch or bridge.

no objections mlarkin@

Revision 1.25 / (download) - annotate - [select for diffs], Wed Mar 1 07:43:33 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.24: +4 -3 lines
Diff to previous 1.24 (colored)

Add "owner" option to set a user/group ownership for pre-configured VMs

This allows matching users to start or stop VMs that they "own" and to
access the console accordingly.

OK mlarkin@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Feb 27 14:37:58 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.23: +5 -7 lines
Diff to previous 1.23 (colored)

Replace openpty(3) with local function that uses pre-opened /dev/ptm fd

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@

Revision 1.23 / (download) - annotate - [select for diffs], Tue Jan 17 21:51:01 2017 UTC (7 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Nuke some whitespace that keeps poking me in the eye as I try to
steal code.

Revision 1.22 / (download) - annotate - [select for diffs], Wed Dec 14 06:59:12 2016 UTC (7 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.21: +12 -6 lines
Diff to previous 1.21 (colored)

If a VM terminates with the result EAGAIN, close all fds except the
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@

Revision 1.21 / (download) - annotate - [select for diffs], Thu Nov 24 07:58:55 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.20: +6 -8 lines
Diff to previous 1.20 (colored)

Add support for booting the kernel from the disk image.

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@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Nov 22 21:55:54 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.19: +21 -24 lines
Diff to previous 1.19 (colored)

Fix error path of config_setvm() and its callers.  This unbreaks
loading of invalid kernel files.

Reported by mlarkin@
OK mlarkin@

Revision 1.19 / (download) - annotate - [select for diffs], Fri Nov 4 15:16:44 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.18: +2 -3 lines
Diff to previous 1.18 (colored)

Pass the internal vmid or 0 to vm_register() instead of changing it
once again after setting the next available id.

Suggested by edd@

Revision 1.18 / (download) - annotate - [select for diffs], Fri Nov 4 15:07:26 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.17: +143 -178 lines
Diff to previous 1.17 (colored)

Update the config/register/get VM methods to match the config_set/get
style that is used in other places.  Also keep the vmid from the parent.

OK edd@

Revision 1.17 / (download) - annotate - [select for diffs], Sat Oct 29 14:56:05 2016 UTC (7 years, 7 months ago) by edd
Branch: MAIN
Changes since 1.16: +40 -17 lines
Diff to previous 1.16 (colored)

Separate parsing vms and switches from starting them in vmd(8).

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.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Oct 15 14:02:11 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.15: +12 -1 lines
Diff to previous 1.15 (colored)

Allow to add an interface to an interface group; with the group keyword.

Requested and tested by martijn@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Oct 12 10:58:32 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

The error case checks for saved_errno, set it accordingly

Revision 1.14 / (download) - annotate - [select for diffs], Wed Oct 5 17:30:13 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.13: +71 -14 lines
Diff to previous 1.13 (colored)

Add support for enhanced networking configuration and virtual switches.
See vm.conf(5) for more details.

OK mlarkin@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Oct 4 17:17:30 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.12: +31 -10 lines
Diff to previous 1.12 (colored)

Add a new "priv" process that is responsible for ioctls and restricted
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@

Revision 1.12 / (download) - annotate - [select for diffs], Thu Sep 29 22:42:04 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.11: +3 -5 lines
Diff to previous 1.11 (colored)

Implement fork+exec for vmd, using the same framework from httpd etc.

No objections from mlarkin@ sunil@

Revision 1.11 / (download) - annotate - [select for diffs], Sat Sep 3 10:20:06 2016 UTC (7 years, 9 months ago) by stefan
Branch: MAIN
Changes since 1.10: +62 -15 lines
Diff to previous 1.10 (colored)

Make error handling in config_getvm() more robust

Open all fds first before sending messages to the vmm process.
This prevents some intermediate state from being generated that
will confuse vmm if it gets further messages.

Also make sure that vmctl gets the right error reason later by saving
errno upon a failure.

ok reyk@ mlarkin@

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jul 29 16:36:51 2016 UTC (7 years, 10 months ago) by stefan
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored)

Allow starting a VM again after it was terminated

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@

Revision 1.9 / (download) - annotate - [select for diffs], Mon Dec 7 15:57:53 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.8: +3 -2 lines
Diff to previous 1.8 (colored)

Only increment the vm counter after successfully adding a new vm; the
counter has to be in sync in the parent and vmm processes.  This fixes
reload after a previous load error.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Dec 7 14:43:24 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.7: +12 -4 lines
Diff to previous 1.7 (colored)

Fix error handling in a few cases: some function return (-1) on error,
while others return (errno) on error.  We probably have to agree on
something.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Dec 6 21:02:51 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.6: +6 -1 lines
Diff to previous 1.6 (colored)

Prevent running a VM with the same name multiple times - multiple
instances of the same configuration will be handled in a different way
later.  It is also not a good idea to use the same writeable disk
with multiple VMs at the same time.

As discussed with mlarkin@

Revision 1.6 / (download) - annotate - [select for diffs], Sun Dec 6 01:14:08 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.5: +11 -6 lines
Diff to previous 1.5 (colored)

Report errno from config_getvm() correctly

Revision 1.5 / (download) - annotate - [select for diffs], Fri Dec 4 10:54:21 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored)

A VM has to run with at least 1 CPU.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Dec 3 23:32:32 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.3: +5 -6 lines
Diff to previous 1.3 (colored)

Re-add the "load" and "reload" commands to vmctl: Instead of parsing
the configuration in vmctl directly, it now sends a (re)load request
to vmd.  The reload also resets the existing configuration status -
this doesn't do much difference yet but a future change will compare
if a specified VM is already running.  "load" will allow to add
configuration, while "reload" resets the state before loading.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Dec 3 16:11:32 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.2: +1 -3 lines
Diff to previous 1.2 (colored)

Add support for an optional vm.conf(5) file in vmd.  This will replace
vmm.conf(5) in vmmctl.  For a short time, both vmd and vmmctl will
support a configuration file, but vmmctl will be changed to send
"load" requests to vmd instead of loading and parsing the file
directly.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Dec 3 13:27:14 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.1: +21 -24 lines
Diff to previous 1.1 (colored)

prepare config_getvm() for parse.y

Revision 1.1 / (download) - annotate - [select for diffs], Wed Dec 2 22:19:11 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN

Split the fully privileged parent into two processes "parent" and
"vmm" with reduced privileges:
- the "parent" opens fds (disks, ifs, etc.) but runs as root but pledged as
  "stdio rpath wpath proc tty sendfd".
- the "vmm" process handles the creation and supervision of vm processes,
  and the primary communication with the vmm(4) subsystem.  It runs as _vmd
  in the chroot but does not use pledge, as the vmm ioctls are not allowed
  by any pledge model yet.
With this change, vmd starts to track the configuration state of VMs
in vmd and will allow other things later (like terminating a vm by
name, moving the configuration parser to vmd, ...).  More incremental
changes will follow.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.