OpenBSD CVS

CVS log for src/usr.sbin/vmctl/main.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.78 / (download) - annotate - [select for diffs], Sat May 18 06:45:00 2024 UTC (3 weeks ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.77: +1 -3 lines
Diff to previous 1.77 (colored)

remove prototypes with no matching function

Revision 1.77 / (download) - annotate - [select for diffs], Thu May 2 15:46:10 2024 UTC (5 weeks, 2 days ago) by mlarkin
Branch: MAIN
Changes since 1.76: +22 -6 lines
Diff to previous 1.76 (colored)

vmctl(8): Add 'vmctl status -r'

The -r option can be used to limit the output of 'vmctl status' to only
running VMs. This is useful for machines that have a large number of
stopped VMs, as the running ones are printed at the top by default and
previously required scrolling back to see the list of running VMs, and/or
using 'grep RUNNING'.

There is no change for users not using -r.

ok dv

Revision 1.76 / (download) - annotate - [select for diffs], Wed Apr 10 13:03:41 2024 UTC (8 weeks, 3 days ago) by dv
Branch: MAIN
Changes since 1.75: +1 -3 lines
Diff to previous 1.75 (colored)

vmctl: fix incorrect scaling when converting disk images.

ctl_convert still had old logic assuming disk sizes were in MiB and
not bytes, causing an attempt to create a new disk using the '-i'
argument to generate impossibly large output disk images (e.g. 1 MiB
ends up 1 TiB).

Reported by and diff from Jesper Wallin.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Apr 28 19:46:41 2023 UTC (13 months, 1 week ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.74: +6 -2 lines
Diff to previous 1.74 (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.74 / (download) - annotate - [select for diffs], Tue Apr 25 12:51:07 2023 UTC (13 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.73: +1 -3 lines
Diff to previous 1.73 (colored)

vmctl(8): no longer needs vmmvar.h

Finally! We can remove kernel headers from vmctl.

ok mlarkin@

Revision 1.73 / (download) - annotate - [select for diffs], Thu Sep 1 15:43:07 2022 UTC (21 months, 1 week ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

fix unveil(2) in vmctl(8), unix socket needs :w:
ok mestre@ martijn@

Revision 1.72 / (download) - annotate - [select for diffs], Sat Jul 30 14:17:42 2022 UTC (22 months, 1 week ago) by kn
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

vmctl create accepts exactly one argument

Make "vmctl create -s3G 1.img 2.img" fail instead of just creating 1.img
and ignoring 2.img.

OK dv cheloha

Revision 1.71 / (download) - annotate - [select for diffs], Fri May 13 00:17:20 2022 UTC (2 years ago) by yasuoka
Branch: MAIN
Changes since 1.70: +3 -4 lines
Diff to previous 1.70 (colored)

Follow the recent change that the unit of `imgsize' argument of
create_imagefile() became MB.  Also change the arguement's type from
long to uint64_t that is preferred.

ok dv

Revision 1.70 / (download) - annotate - [select for diffs], Wed May 4 23:17:25 2022 UTC (2 years, 1 month ago) by dv
Branch: MAIN
Changes since 1.69: +14 -23 lines
Diff to previous 1.69 (colored)

vmctl(8)/vmd(8): convert disk sizes from MB to bytes

Continue converting other parts to storing data in bytes instead
of MB. In this case, the logic for disk sizes was being scaled.

This fixes issues reported by Martin Vahlensieck where vmctl could
no longer create disks larger than 7 MiB after previous commits to
change storing memory sizes as bytes.

While this keeps the vm memory limit check in vmctl's size parser,
it skips the limit check for disks. The error messages adjust
accordingly and this removes the double error message logging.

Update comments and function types accordingly.

ok marlkin@

Revision 1.69 / (download) - annotate - [select for diffs], Tue May 3 21:39:18 2022 UTC (2 years, 1 month ago) by dv
Branch: MAIN
Changes since 1.68: +23 -8 lines
Diff to previous 1.68 (colored)

vmm/vmd/vmctl: standardize memory units to bytes

At different points in the vm lifecycle vmm(4), vmctl(8), and vmd(8)
refer to a vm's memory range sizes in either bytes or megabytes.
This is needlessly complex.

Switch to using bytes everywhere and adjust types and constants
accordingly. While this makes it possible to specify vm's with
memory in fractions of megabytes, the logic requiring whole
megabyte values remains.

Feedback from deraadt@, mlarkin@, and Matthew Martin.

ok mlarkin@

Revision 1.68 / (download) - annotate - [select for diffs], Mon Jul 12 15:09:22 2021 UTC (2 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.67: +3 -3 lines
Diff to previous 1.67 (colored)

Change the error reporting pattern throughout the tree when unveil
fails to report the path that the failure occured on. Suggested by
deraadt@ after some tech discussion.

Work done and verified by Ashton Fagg <ashton@fagg.id.au>

ok deraadt@ semarie@ claudio@

Revision 1.67 / (download) - annotate - [select for diffs], Mon Jun 28 14:01:38 2021 UTC (2 years, 11 months ago) by tb
Branch: MAIN
Changes since 1.66: +2 -4 lines
Diff to previous 1.66 (colored)

Garbage collect loop index i which is no longer used after usage tweak.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jun 26 18:03:45 2021 UTC (2 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.65: +2 -5 lines
Diff to previous 1.65 (colored)

make usage less chatty; ok mlarkin

Revision 1.65 / (download) - annotate - [select for diffs], Wed May 12 20:13:00 2021 UTC (3 years ago) by dv
Branch: MAIN
Changes since 1.64: +2 -15 lines
Diff to previous 1.64 (colored)

vmctl(8): remove unveil from disk image creation routines

James Cook reported an issue creating images from qcow2 disks that
contained base images. Initial approach suggested was to replace the
use of realpath(3), but since this is common code used in vmd(8) the
better option is to just remove the use of unveil(1) in vmctl. (It was
added very early in vmctl's development before support for disk
conversion was added.)

This does not change existing unveil usage in vmctl for things like the
control socket or the serial console. There's no change to vmd either.

Discussed with and OK from mlarkin@

Revision 1.64 / (download) - annotate - [select for diffs], Fri Apr 2 19:07:18 2021 UTC (3 years, 2 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.63: +1 -2 lines
Diff to previous 1.63 (colored)

Remove superflouus mmcpy()

Reported by Preben Guldberg. ok mlarkin@

Revision 1.63 / (download) - annotate - [select for diffs], Fri Mar 26 16:28:15 2021 UTC (3 years, 2 months ago) by tb
Branch: MAIN
Changes since 1.62: +10 -15 lines
Diff to previous 1.62 (colored)

Simplify argument parsing of vmctl stop

The previous argument parsing logic had at least three bugs:
a copy-paste error led to an off-by-one and a printf "%s" NULL,
as reported by Preben Guldberg.  A previous commit led to a dead
else branch and a use of uninitialized.  This can all be avoided
by reworking the logic so as to be readable.

Prompted by a diff from Preben

ok dv

Revision 1.62 / (download) - annotate - [select for diffs], Fri Jan 3 05:32:00 2020 UTC (4 years, 5 months ago) by pd
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (colored)

vmctl(8): fix vmctl send exit code

vmctl send always returned exit code 1

Patch by Benjamin Baier
ok kn@

Revision 1.61 / (download) - annotate - [select for diffs], Sat Dec 28 18:36:01 2019 UTC (4 years, 5 months ago) by kn
Branch: MAIN
Changes since 1.60: +3 -2 lines
Diff to previous 1.60 (colored)

Run cu(1) in restricted mode

Users must not not be able to transfer files from the local hypervisor
filesystem to VMs/LDOMs, especially since the "vmctl/ldomctl console ..."
might be run as root.

Disable all relevant escape sequences and cause cu to run under "stdio tty"
pledge by using -r.

OK deraadt mlarkin

Revision 1.60 / (download) - annotate - [select for diffs], Tue Dec 17 09:43:00 2019 UTC (4 years, 5 months ago) by kn
Branch: MAIN
Changes since 1.59: +6 -4 lines
Diff to previous 1.59 (colored)

Use local variable isntead of function parameter

The parse_size() wrapper around scan_scaled(3) writes its intermediate
result to the function argument which is always passed as literal zero.

This seems odd, the function parameter has no meaning but merely serves
as storage, so let's use a proper function scoped variable instead.

OK pd

Revision 1.59 / (download) - annotate - [select for diffs], Sun Oct 27 08:59:48 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored)

Require at least one interface with -i

Either a positive count is given or -i is omitted entirely;  vm.conf(5) does
not allow interface configuration that results in zero interfaces either.

Raise the minimium count value to one and tell more about invalid counts
with the usual strtonum(3) idiom.

OK reyk

Revision 1.58 / (download) - annotate - [select for diffs], Fri Aug 23 07:55:20 2019 UTC (4 years, 9 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.57: +5 -2 lines
Diff to previous 1.57 (colored)

vmctl(8): fix wrong output when using 'vmctl stop'

Fix a wrong output when using 'vmctl stop' without any further arguments.

Patch from Caspar Schutijser, thanks!

ok deraadt

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jul 5 22:22:40 2019 UTC (4 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored)

zap an extra space in usage();
from alessandro gallo

Revision 1.56 / (download) - annotate - [select for diffs], Wed May 29 21:32:43 2019 UTC (5 years ago) by reyk
Branch: MAIN
Changes since 1.55: +23 -40 lines
Diff to previous 1.55 (colored)

Change vmctl(8) syntax: command options before the disk/name/id argument.

vmctl had a CLI-style syntax (bgpctl-style) for a short time but I
changed it back to a more suitable getopt syntax. I replaced the CLI
tokens to getopts flags but didn't consider swapping the order of
command options and arguments to be more UNIX-like again ("vmctl
create disk.img size 10G" simply became "vmctl create disk.img -s 10G").

This changes "create", "start", and "stop" commands to the commonly
expected syntax like "vmctl create -s 10G disk.img".

Requested by many

OK mlarkin@ kn@ solene@

Revision 1.55 / (download) - annotate - [select for diffs], Mon Mar 18 20:27:12 2019 UTC (5 years, 2 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

An existing VM may be started by referencing its ID

Document `vmctl start id ...' again but be clear about the difference
between starting new and existing VMs by name and ID respectively.  This
completes what I started with vmctl.8 revision 1.61.

Feedback and OK jmc

Revision 1.54 / (download) - annotate - [select for diffs], Fri Mar 1 12:47:36 2019 UTC (5 years, 3 months ago) by kn
Branch: MAIN
Changes since 1.53: +7 -1 lines
Diff to previous 1.53 (colored)

Fix previous extra arguments commit

I blatantly missed the argc/argv adjustments after getopt(3), resulting in
valid commands like `vmctl create a -s 1G' to fail.

Noticed by ajacoutot the hard way.

OK ajacoutot jca

Revision 1.53 / (download) - annotate - [select for diffs], Fri Mar 1 10:34:14 2019 UTC (5 years, 3 months ago) by kn
Branch: MAIN
Changes since 1.52: +10 -1 lines
Diff to previous 1.52 (colored)

Print usage on extra create, start and stop arguments

OK mlarkin

Revision 1.52 / (download) - annotate - [select for diffs], Fri Dec 14 07:56:17 2018 UTC (5 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.51: +13 -13 lines
Diff to previous 1.51 (colored)

sync usage(); also, stop enclosing arg names in quotes, since it was
applied inconsistently, and applied consistently would make it
look like spaghetti;

ok mlarkin

Revision 1.51 / (download) - annotate - [select for diffs], Tue Dec 11 07:44:25 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.50: +8 -2 lines
Diff to previous 1.50 (colored)

Extend vmctl start -B argument to work for disk, cdrom and net.
Currently SeaBIOS will respect disk and cdrom and our kernel will
understand net.
OK ccardenas@, reyk@, mlarkin@

Revision 1.50 / (download) - annotate - [select for diffs], Thu Dec 6 09:23:15 2018 UTC (5 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.49: +10 -4 lines
Diff to previous 1.49 (colored)

Add a new argument -B device to vmctl start. It allows to set the boot device.
At the moment only 'net' is supported and all other values are silently ignored.
This allows to kick of an OpenBSD autoinstall by using:
	vmctl start "installer" -Lc -B net -b bsd.rd -d disk.img
OK ccardenas@

Revision 1.49 / (download) - annotate - [select for diffs], Tue Dec 4 08:17:17 2018 UTC (5 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.48: +26 -3 lines
Diff to previous 1.48 (colored)

Add 'vmctl wait <VM>' a command that waits until the specified VM is
stopped/terminates. Useful in scripts when waiting until a vm has finished
its work.
Ok ccardenas@, reyk@

Revision 1.48 / (download) - annotate - [select for diffs], Mon Nov 26 10:39:30 2018 UTC (5 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

Move the {qcow2,raw} create functions from vmctl into vmd/vio{qcow2,raw}.c

This way they are in the appropriate place and code can be shared with vmd.

Ok ori@ mlarkin@ ccardenas@

Revision 1.47 / (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.46: +168 -22 lines
Diff to previous 1.46 (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.46 / (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.45: +23 -14 lines
Diff to previous 1.45 (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.45 / (download) - annotate - [select for diffs], Fri Oct 5 12:54:57 2018 UTC (5 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.44: +2 -1 lines
Diff to previous 1.44 (colored)

Setting getopt optreset to 1 needs an additional reset of optind to 1.

OK millert@

Revision 1.44 / (download) - annotate - [select for diffs], Mon Oct 1 09:31:15 2018 UTC (5 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.43: +67 -30 lines
Diff to previous 1.43 (colored)

Try to derive the qcow2 file format from an image file automatically.

This makes the "-d qcow2:" and "format qcow" arguments optional as vmctl
and vmd will read the magic bytes at the beginning of a file to guess if
it is a raw or a qcow image file.

The "vmctl create" command has been changed by removing the -f qcow2 option
and replacing it with the same syntax as -d: "vmctl create qcow2:foo.img".
In a slightly ununixy but intended way, the create command now also
considers the file extension for the format as "vmctl create foo.qcow2"
creates a qcow2 disk and not a raw image file.

Ok mlarkin@ (and ccardenas@ on an earlier version of the diff)

Revision 1.43 / (download) - annotate - [select for diffs], Thu Sep 27 17:15:36 2018 UTC (5 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.42: +24 -13 lines
Diff to previous 1.42 (colored)

Add vmctl stop -a [-fw] option to stop or terminate all running VMs.

This is also be used to simplify the vmd rc stop script.

OK mlarkin@ ccardenas@

Revision 1.42 / (download) - annotate - [select for diffs], Thu Sep 13 03:53:33 2018 UTC (5 years, 8 months ago) by ccardenas
Branch: MAIN
Changes since 1.41: +12 -4 lines
Diff to previous 1.41 (colored)

Add initial set of unveil's to vmctl.

Was in snaps for a while.

Ok mlarkin@ and reyk@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Sep 11 04:03:16 2018 UTC (5 years, 8 months ago) by ccardenas
Branch: MAIN
Changes since 1.40: +15 -5 lines
Diff to previous 1.40 (colored)

Add ability to create qcow2 disk.

vmctl create now takes an optional disk format parameter: raw or qcow2.
If format is omitted, raw is used.

Many thanks to Ori Bernstein.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Sep 9 04:09:32 2018 UTC (5 years, 9 months ago) by ccardenas
Branch: MAIN
Changes since 1.39: +36 -8 lines
Diff to previous 1.39 (colored)

Add initial qcow2 image support.

Users are able to declare disk images as 'raw' or 'qcow2' using either
vmctl and vm.conf.  The default disk image format is 'raw' if not specified.

Examples of using disk format:

vmctl start bsd -Lc -r cd64.iso -d qcow2:current.qc2
or
vmctl start bsd -Lc -r cd64.iso -d raw:current.raw
is equivalent to
vmctl start bsd -Lc -r cd64.iso -d current.raw

in vm.conf
vm "current" {
    disable
    memory 2G
    disk "/home/user/vmm/current.qc2" format "qcow2"
    interface { switch "external" }
}

or

vm "current" {
    disable
    memory 2G
    disk "/home/user/vmm/current.raw" format "raw"
    interface { switch "external" }
}

is equivlanet to

vm "current" {
    disable
    memory 2G
    disk "/home/user/vmm/current.raw"
    interface { switch "external" }
}

Tested by many.

Big Thanks to Ori Bernstein.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Jul 12 14:53:37 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.38: +7 -7 lines
Diff to previous 1.38 (colored)

The vmctl start -I option was changed to -t.

I committed the manpage but accidentally forgot the main.c part.

OK ccardenas@

Revision 1.38 / (download) - annotate - [select for diffs], Thu Jul 12 12:04:49 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.37: +23 -4 lines
Diff to previous 1.37 (colored)

Allow to use configured/running VMs as templates for other VM instances.

This introduces new grammar and the -t optional in vmctl start.

(For now, only root can create VM instances; but it is planned to allow
users to create their own VMs based on permissions and quota.)

OK ccardenas@ mlarkin@ jmc@

Revision 1.37 / (download) - annotate - [select for diffs], Wed Jul 11 13:19:47 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.36: +12 -6 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Wed Jul 11 09:35:44 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.35: +23 -7 lines
Diff to previous 1.35 (colored)

Add -f option to vmctl stop to forcefully kill a VM.

This also fixes a bug in vmm_sighdlr where it might have missed
forwarding the TERMINATE_EVENT to the vmd parent after a VM child
died, leading to an abandoned VM in the vmd parent process.

OK ccardenas@ mlarkin@ benno@ kn@

Revision 1.35 / (download) - annotate - [select for diffs], Sat Feb 24 10:39:35 2018 UTC (6 years, 3 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)

add an alias for vmctl show, matches finger memory and the rest of the
*ctl programs

OK mlarkin@ benno@ deraadt@

Revision 1.34 / (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.33: +14 -4 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Sat Oct 7 19:48:30 2017 UTC (6 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

Prefer memset() over bzero()

ok deraadt@ mlarkin@

Revision 1.32 / (download) - annotate - [select for diffs], Tue Aug 15 15:51:54 2017 UTC (6 years, 9 months ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.31: +15 -37 lines
Diff to previous 1.31 (colored)

merge parse_vmid() and parse_vmname()

ok mlarkin@ pd@

Revision 1.31 / (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.30: +70 -1 lines
Diff to previous 1.30 (colored)

Add vmctl send and vmctl receive

ok reyk@ and mlarkin@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Jul 9 00:51:40 2017 UTC (6 years, 11 months ago) by pd
Branch: MAIN
Changes since 1.29: +41 -1 lines
Diff to previous 1.29 (colored)

vmd/vmctl: Add ability to pause / unpause vms

With help from Ashwin Agrawal

ok reyk@ mlarkin@

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jun 7 23:15:49 2017 UTC (7 years ago) by mlarkin
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

vmctl: change default "vmctl console" (cu) baud rate to 115200. Not
strictly needed but matches the previous baudrate diff committed earlier
to vmd.

ok deraadt, phessler

Revision 1.28 / (download) - annotate - [select for diffs], Thu May 4 19:41:58 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.27: +6 -2 lines
Diff to previous 1.27 (colored)

Report command failure back to vmctl reload, reset, load, log verbose.

OK mlarkin@

Revision 1.27 / (download) - annotate - [select for diffs], Thu May 4 16:54:41 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.26: +4 -11 lines
Diff to previous 1.26 (colored)

Report error for vmctl commands that need root privileges.

specifically: vmctl (load|reload|reset|log)

Reported by Christian Barthel

Revision 1.26 / (download) - annotate - [select for diffs], Wed Apr 19 15:38:32 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.25: +7 -3 lines
Diff to previous 1.25 (colored)

Add support for dynamic "NAT" interfaces (-L/local interface).

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@

Revision 1.25 / (download) - annotate - [select for diffs], Thu Apr 6 18:07:13 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
Changes since 1.24: +6 -5 lines
Diff to previous 1.24 (colored)

Do not expose vmm(4) VM IDs to the user, use vmd(8)'s IDs instead.

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@

Revision 1.24 / (download) - annotate - [select for diffs], Sat Mar 25 16:28:25 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.23: +9 -9 lines
Diff to previous 1.23 (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.23 / (download) - annotate - [select for diffs], Wed Mar 1 21:22:57 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Rename start_vm_complete to vm_start_complete for consistency.

Revision 1.22 / (download) - annotate - [select for diffs], Wed Mar 1 21:15:26 2017 UTC (7 years, 3 months ago) by mlarkin
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

unbreak vmctl build by renaming a function that now conflicts with
something from vmd.h . Temporary fix until the original committer can
fix it the way he desires.

Revision 1.21 / (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.20: +2 -2 lines
Diff to previous 1.20 (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.20 / (download) - annotate - [select for diffs], Wed Jan 11 22:38:10 2017 UTC (7 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.19: +24 -1 lines
Diff to previous 1.19 (colored)

Add imsg communication channel between vmd and invividual VMs.
For now, this is only used to forward "log verbose|brief" requests,
but it will be used for better things later.

OK mlarkin@

Revision 1.19 / (download) - annotate - [select for diffs], Sat Nov 26 18:37:32 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.18: +41 -5 lines
Diff to previous 1.18 (colored)

Add the vmctl start -n option to specify add a network interface to
the specified virtual switch from the command line.

OK mlarkin@

Revision 1.18 / (download) - annotate - [select for diffs], Wed Oct 12 19:10:03 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.17: +47 -15 lines
Diff to previous 1.17 (colored)

Fix functionality and semantics of vmctl load/reload/reset.

OK rzalamena@

Revision 1.17 / (download) - annotate - [select for diffs], Tue May 10 11:00:54 2016 UTC (8 years, 1 month ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.16: +1 -15 lines
Diff to previous 1.16 (colored)


move some argument checking from vmmaction() to start_vm()

from a diff posted to tech@ by Fabien Siron, thanks.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Apr 25 15:14:34 2016 UTC (8 years, 1 month ago) by mlarkin
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)


make vmctl 'create' usage description match the man page

Revision 1.15 / (download) - annotate - [select for diffs], Thu Mar 17 19:40:43 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Last parameter to execl[e]() functions *must* be cast to a pointer.
Just NULL is not good practise as NULL is theoretically allowed to
be an integer rather than a pointer.

Use (char *)NULL consistently instead of scattering a few (char *)0
and (void *)NULL into the mix.

Prompted by and probably ok deraadt@ millert@ kettenis@

Definitely ok mestre@ ratchov@

Revision 1.14 / (download) - annotate - [select for diffs], Tue Jan 26 07:55:47 2016 UTC (8 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.13: +1 -4 lines
Diff to previous 1.13 (colored)

The division "res->size /= 1024 / 1024" is a no-op: 1024 / 1024 is
evaluated first, resulting in res->size /= 1.  Remove the division and
the following check, as it can never fail; it is a left-over from
previous code that didn't check the size in the caller.

From Martin Natano
OK mlarkin@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Jan 5 16:25:34 2016 UTC (8 years, 5 months ago) by semarie
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

don't use the second argument of pledge(2) as the whitelist is not stabilized
for now.

ok reyk@

Revision 1.12 / (download) - annotate - [select for diffs], Fri Dec 11 10:16:53 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.11: +15 -8 lines
Diff to previous 1.11 (colored)

The vmctl "id" argument can now be a number of or a vm name, eg.
vmctl stop 3
vmctl stop "openbsd.vm"

Revision 1.11 / (download) - annotate - [select for diffs], Fri Dec 11 09:24:10 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.10: +14 -11 lines
Diff to previous 1.10 (colored)

Remove unused argument in parse_vmid()

Revision 1.10 / (download) - annotate - [select for diffs], Fri Dec 11 09:08:05 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.9: +10 -5 lines
Diff to previous 1.9 (colored)

Allow to specify relative pathnames on the command line (eg. -k ./bsd).

Revision 1.9 / (download) - annotate - [select for diffs], Tue Dec 8 13:15:09 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

style(9) says that is OK to not include sys/cdefs.h directly, as it
comes from sys/types.h (include-what-you-use doesn't know this policy).

Pointed out by Jan Schreiber

Revision 1.8 / (download) - annotate - [select for diffs], Tue Dec 8 08:02:15 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

vmctl console - id is not optional

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

Add "vmctl console" to connect to a specified VM console by id.

Requested by mlarkin@

Revision 1.6 / (download) - annotate - [select for diffs], Sat Dec 5 22:34:31 2015 UTC (8 years, 6 months ago) by sobrado
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

use argument names consistently.

ok reyk@

Revision 1.5 / (download) - annotate - [select for diffs], Sat Dec 5 17:30:34 2015 UTC (8 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Another imsg_read user I did miss in my EAGAIN rampage.

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

vmctl has no need to change the socket that talks to vmd.
discussed with reyk

Revision 1.3 / (download) - annotate - [select for diffs], Fri Dec 4 15:40:17 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.2: +18 -11 lines
Diff to previous 1.2 (colored)

Add -c option to "vmctl start" to automatically connect to the VM
console after startup.  This calls 'cu -l $TTY -s 9600' internally -
a "safe mode" for cu is proposed by tedu@.

Requested by mlarkin@
OK tedu@ on the execl/cu chunk

Revision 1.2 / (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.1: +19 -6 lines
Diff to previous 1.1 (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.1 / (download) - annotate - [select for diffs], Thu Dec 3 21:45:45 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN

Replace vmmctl with vmctl.  Also remove parse.y from the "new" vmctl.

As discussed with mlarkin@ and deraadt@

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.