summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-05-14 06:05:45 +0000
committeranton <anton@openbsd.org>2019-05-14 06:05:45 +0000
commitc5ee7fb353b1bd1209f5c610e7ad596c8202fee4 (patch)
treed06ac3089a40b677c157f8fa14cd40e45b568190 /usr.sbin/vmd
parentEnable TLSv1.0 and TLSv1.1 (diff)
downloadwireguard-openbsd-c5ee7fb353b1bd1209f5c610e7ad596c8202fee4.tar.xz
wireguard-openbsd-c5ee7fb353b1bd1209f5c610e7ad596c8202fee4.zip
Add support for `boot device' to vm.conf grammar which is the `-B device'
counterpart from vmctl. ok mlarkin@
Diffstat (limited to 'usr.sbin/vmd')
-rw-r--r--usr.sbin/vmd/parse.y19
-rw-r--r--usr.sbin/vmd/vm.conf.535
2 files changed, 48 insertions, 6 deletions
diff --git a/usr.sbin/vmd/parse.y b/usr.sbin/vmd/parse.y
index 70ebf2b9b74..81cfa04d466 100644
--- a/usr.sbin/vmd/parse.y
+++ b/usr.sbin/vmd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.51 2019/05/11 19:55:14 jasper Exp $ */
+/* $OpenBSD: parse.y,v 1.52 2019/05/14 06:05:45 anton Exp $ */
/*
* Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org>
@@ -120,12 +120,13 @@ typedef struct {
%token INCLUDE ERROR
-%token ADD ALLOW BOOT CDROM DISABLE DISK DOWN ENABLE FORMAT GROUP INET6
-%token INSTANCE INTERFACE LLADDR LOCAL LOCKED MEMORY NIFS OWNER PATH PREFIX
-%token RDOMAIN SIZE SOCKET SWITCH UP VM VMID
+%token ADD ALLOW BOOT CDROM DEVICE DISABLE DISK DOWN ENABLE FORMAT GROUP
+%token INET6 INSTANCE INTERFACE LLADDR LOCAL LOCKED MEMORY NET NIFS OWNER
+%token PATH PREFIX RDOMAIN SIZE SOCKET SWITCH UP VM VMID
%token <v.number> NUMBER
%token <v.string> STRING
%type <v.lladdr> lladdr
+%type <v.number> bootdevice
%type <v.number> disable
%type <v.number> image_format
%type <v.number> local
@@ -457,6 +458,9 @@ vm_opts : disable {
}
vmc.vmc_flags |= VMOP_CREATE_KERNEL;
}
+ | BOOT DEVICE bootdevice {
+ vmc.vmc_bootdevice = $3;
+ }
| CDROM string {
if (vcp->vcp_cdrom[0] != '\0') {
yyerror("cdrom specified more than once");
@@ -704,6 +708,11 @@ disable : ENABLE { $$ = 0; }
| DISABLE { $$ = 1; }
;
+bootdevice : CDROM { $$ = VMBOOTDEV_CDROM; }
+ | DISK { $$ = VMBOOTDEV_DISK; }
+ | NET { $$ = VMBOOTDEV_NET; }
+ ;
+
optcomma : ','
|
;
@@ -757,6 +766,7 @@ lookup(char *s)
{ "allow", ALLOW },
{ "boot", BOOT },
{ "cdrom", CDROM },
+ { "device", DEVICE },
{ "disable", DISABLE },
{ "disk", DISK },
{ "down", DOWN },
@@ -773,6 +783,7 @@ lookup(char *s)
{ "local", LOCAL },
{ "locked", LOCKED },
{ "memory", MEMORY },
+ { "net", NET },
{ "owner", OWNER },
{ "prefix", PREFIX },
{ "rdomain", RDOMAIN },
diff --git a/usr.sbin/vmd/vm.conf.5 b/usr.sbin/vmd/vm.conf.5
index 54eb9ed5efa..a90e78678ee 100644
--- a/usr.sbin/vmd/vm.conf.5
+++ b/usr.sbin/vmd/vm.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: vm.conf.5,v 1.42 2019/03/07 18:54:06 kn Exp $
+.\" $OpenBSD: vm.conf.5,v 1.43 2019/05/14 06:05:45 anton Exp $
.\"
.\" Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
.\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 7 2019 $
+.Dd $Mdocdate: May 14 2019 $
.Dt VM.CONF 5
.Os
.Sh NAME
@@ -144,6 +144,37 @@ See
Kernel or BIOS image to load when booting the VM.
If not specified, the default is to boot using the BIOS image in
.Pa /etc/firmware/vmm-bios .
+.It Cm boot device Ar device
+Force VM to boot from
+.Ar device .
+Valid values are:
+.Bl -tag -width "cdrom"
+.It Ar cdrom
+Boot the ISO image file specified using the
+.Ic cdrom
+parameter.
+.It Ar disk
+Boot from the disk image file specified using the
+.Ic disk
+parameter.
+.It Ar net
+Boot the kernel specified using the
+.Ic boot
+parameter as if the VM was network booted.
+In addition, the DHCP lease will advertise
+.Dq auto_install
+in the bootfile option making it suitable for use with
+.Xr autoinstall 8 .
+Note, this is not to be confused with
+.Xr pxeboot 8
+but rather a simulated network boot.
+.El
+.Pp
+Currently
+.Ar disk
+and
+.Ar cdrom
+only work with VMs booted using BIOS.
.It Cm cdrom Ar path
ISO image file.
.It Cm enable