summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/vmctl/vmctl.87
-rw-r--r--usr.sbin/vmctl/vmctl.c4
-rw-r--r--usr.sbin/vmd/vm.conf.59
-rw-r--r--usr.sbin/vmd/vmd.c4
-rw-r--r--usr.sbin/vmd/vmd.h3
5 files changed, 16 insertions, 11 deletions
diff --git a/usr.sbin/vmctl/vmctl.8 b/usr.sbin/vmctl/vmctl.8
index 4a1bd54410f..dd100cdf2ee 100644
--- a/usr.sbin/vmctl/vmctl.8
+++ b/usr.sbin/vmctl/vmctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: vmctl.8,v 1.19 2016/11/26 19:23:27 jmc Exp $
+.\" $OpenBSD: vmctl.8,v 1.20 2016/11/26 19:49:11 reyk Exp $
.\"
.\" Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
.\"
@@ -88,6 +88,7 @@ Kernel to load when booting the VM.
Memory
.Ar size
of the VM, rounded to megabytes.
+The default is 512M.
.It Fl n Ar switch
Add a network interface that is attached to the specified virtual
.Ar switch .
@@ -147,10 +148,10 @@ Create a 4.5 Gigabyte disk image, disk.img:
$ vmctl create disk.img -s 4.5G
.Ed
.Pp
-Create a new VM with 512MB memory, one network interface, one disk image
+Create a new VM with 1GB memory, one network interface, one disk image
('disk.img') and boot from kernel '/bsd':
.Bd -literal -offset indent
-# vmctl start "myvm" -m 512M -i 1 -d disk.img -k /bsd
+# vmctl start "myvm" -m 1G -i 1 -d disk.img -k /bsd
.Ed
.Pp
.Xr vmd 8
diff --git a/usr.sbin/vmctl/vmctl.c b/usr.sbin/vmctl/vmctl.c
index 79eadc2ff73..3e845563979 100644
--- a/usr.sbin/vmctl/vmctl.c
+++ b/usr.sbin/vmctl/vmctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmctl.c,v 1.19 2016/11/26 18:37:32 reyk Exp $ */
+/* $OpenBSD: vmctl.c,v 1.20 2016/11/26 19:49:11 reyk Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
@@ -70,7 +70,7 @@ start_vm(const char *name, int memsize, int nnics, char **nics,
int i;
if (memsize < 1)
- errx(1, "specified memory size too small");
+ memsize = VM_DEFAULT_MEMORY;
if (ndisks > VMM_MAX_DISKS_PER_VM)
errx(1, "too many disks");
else if (ndisks == 0)
diff --git a/usr.sbin/vmd/vm.conf.5 b/usr.sbin/vmd/vm.conf.5
index fef894d2047..ccb59e74e03 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.11 2016/10/20 19:44:09 jmc Exp $
+.\" $OpenBSD: vm.conf.5,v 1.12 2016/11/26 19:49:11 reyk 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: October 20 2016 $
+.Dd $Mdocdate: November 26 2016 $
.Dt VM.CONF 5
.Os
.Sh NAME
@@ -112,6 +112,7 @@ Disk image file (may be specified multiple times to add multiple disk images).
Kernel to load when booting the VM.
.It Cm memory Ar bytes
Memory size of the VM, in bytes, rounded to megabytes.
+The default is 512M.
.It Cm interface Oo name Oc Op Brq ...
Network interface to add to the VM.
The optional
@@ -247,7 +248,7 @@ This is the default.
Stop the switch from forwarding packets.
.El
.Sh EXAMPLES
-Create a new VM with 512MB memory, 1 network interface connected to
+Create a new VM with 1GB memory, 1 network interface connected to
.Dq uplink ,
one disk image
.Sq disk.img
@@ -255,7 +256,7 @@ and boot from kernel
.Sq /bsd :
.Bd -literal -offset indent
vm "vm2.example.com" {
- memory 512M
+ memory 1G
disk "/var/vmm/vm2-disk.img"
kernel "/bsd"
interface { switch "uplink" }
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 857976e3e0b..a9693a64852 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.43 2016/11/24 07:58:55 reyk Exp $ */
+/* $OpenBSD: vmd.c,v 1.44 2016/11/26 19:49:11 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -666,6 +666,8 @@ vm_register(struct privsep *ps, struct vmop_create_params *vmc,
if (vcp->vcp_ncpus == 0)
vcp->vcp_ncpus = 1;
+ if (vcp->vcp_memranges[0].vmr_size == 0)
+ vcp->vcp_memranges[0].vmr_size = VM_DEFAULT_MEMORY;
if (vcp->vcp_ncpus > VMM_MAX_VCPUS_PER_VM) {
log_warnx("invalid number of CPUs");
goto fail;
diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h
index 8ec1b1c1c1b..042cfa82b7f 100644
--- a/usr.sbin/vmd/vmd.h
+++ b/usr.sbin/vmd/vmd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.h,v 1.36 2016/11/24 07:58:55 reyk Exp $ */
+/* $OpenBSD: vmd.h,v 1.37 2016/11/26 19:49:11 reyk Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -43,6 +43,7 @@
#define MAX_TAP 256
#define NR_BACKLOG 5
#define VMD_SWITCH_TYPE "bridge"
+#define VM_DEFAULT_MEMORY 512
#ifdef VMD_DEBUG
#define dprintf(x...) do { log_debug(x); } while(0)