summaryrefslogtreecommitdiff
path: root/usr.sbin/vmctl/vmctl.8
blob: 71a0aa4e7f625c55ca5ce1c0250d32c671ab6a5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
.\"	$OpenBSD: vmctl.8,v 1.29 2017/04/19 15:38:32 reyk Exp $
.\"
.\" Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: April 19 2017 $
.Dt VMCTL 8
.Os
.Sh NAME
.Nm vmctl
.Nd control the virtual machine daemon
.Sh SYNOPSIS
.Nm
.Ar command
.Op Ar arg ...
.Sh DESCRIPTION
The
.Nm
utility is used to control the virtual machine monitor (VMM) subsystem.
A VMM manages virtual machines (VMs) on a host.
The VMM subsystem is responsible for creating, destroying, and executing
VMs.
.Pp
Within the commands,
the
.Ar size
argument can be specified with a human-readable scale,
using the format described in
.Xr scan_scaled 3 .
The
.Ar id
argument can be either a numeric, non-zero identifier or alternatively
the name of a virtual machine.
.Pp
The commands are as follows:
.Bl -tag -width Ds
.It Cm console Ar id
Using
.Xr cu 1
connect to the console of the VM with the specified
.Ar id .
.It Cm create Ar path Fl s Ar size
Creates a VM disk image file with the specified
.Ar path
and
.Ar size ,
rounded to megabytes.
.It Cm load Ar filename
Load additional configuration from the specified file.
.It Cm log brief
Disable verbose debug logging.
.It Cm log verbose
Enable verbose debug logging.
.It Cm reload
Remove all stopped VMs and reload the configuration from the default
configuration file.
.It Cm reset Op Cm all
Reset the running state.
.It Cm reset switches
Reset the configured switches.
.It Cm reset vms
Reset and terminate all VMs.
.It Xo Cm start Ar name
.Op Fl Lc
.Op Fl b Ar path
.Op Fl d Ar path
.Op Fl i Ar count
.Op Fl m Ar size
.Op Fl n Ar switch
.Xc
Starts a VM defined by the specified name and parameters:
.Bl -tag -width "-i count"
.It Fl b Ar path
Boot the VM with the specified kernel or BIOS image.
If not specified, the default is to boot using the BIOS image in
.Pa /etc/firmware/vmm-bios .
.It Fl c
Automatically connect to the VM console.
.It Fl d Ar path
Disk image file (may be specified multiple times to add multiple disk images).
.It Fl i Ar count
Number of network interfaces to add to the VM.
.It Fl L
Add a local network interface.
.Xr vmd 8
will auto-generate an IPv4 subnet for the interface,
configure a gateway address on the VM host side,
and run a simple DHCP (BOOTP) server for the VM.
.It Fl m Ar size
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 .
See
.Sx SWITCH CONFIGURATION
in
.Xr vm.conf 5
for more information.
.El
.It Cm status Op Ar id
Lists VMs running on the host, optionally listing just the selected VM
.Ar id .
.It Cm stop Ar id
Stops (terminates) a VM defined by the specified VM
.Ar id .
A graceful shutdown will be attempted if the VM supports the
.Xr vmmci 4
device.
Once stopped, if the VM was not defined in a configuration file, then it is
removed.
.El
.Pp
If the
.Fl i
option is specified during VM startup, a corresponding number
of host-side
.Xr tap 4
interfaces will be allocated and mapped to the
.Xr vio 4
interfaces inside the guest VM.
This tap/vio interface mapping
allows guest network traffic to be manipulated by the host.
Any valid host-side interface configuration may be performed on these
tap interfaces, such as bridging (via
.Xr bridge 4 ) ,
or using
.Xr pf 4
nat-to rules to create private or host-side NATed networks, as desired.
.Sh FILES
.Bl -tag -width "/etc/var/run/vmd.sockXX" -compact
.It Pa /etc/vm.conf
Default configuration file.
.It Pa /var/run/vmd.sock
.Ux Ns -domain
socket used for communication with
.Xr vmd 8 .
.El
.Sh EXIT STATUS
.Ex -std vmctl
.Nm
may fail due to one of the following reasons:
.Pp
.Bl -bullet -compact
.It
The VMM subsystem could not be enabled or disabled as requested.
.It
A requested VM-based operation could not be completed.
.El
.Sh EXAMPLES
Create a 4.5 Gigabyte disk image, disk.img:
.Bd -literal -offset indent
$ vmctl create disk.img -s 4.5G
.Ed
.Pp
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 1G -i 1 -b /bsd -d disk.img
.Ed
.Pp
.Xr vmd 8
will create a new
.Xr tap 4
network interface on the host side and set the description to indicate
the VM by ID, interface number, and name:
.Bd -literal -offset indent
# ifconfig tap0
tap0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	lladdr fe:e1:ba:d8:50:d1
	description: vm1-if0-myvm
	index 15 priority 0 llprio 3
	groups: tap
	status: active
.Ed
.Pp
Terminate VM number 1:
.Bd -literal -offset indent
# vmctl stop 1
.Ed
.Sh SEE ALSO
.Xr bridge 4 ,
.Xr pf 4 ,
.Xr tap 4 ,
.Xr vio 4 ,
.Xr vmm 4 ,
.Xr vm.conf 5 ,
.Xr rc.conf 8 ,
.Xr vmd 8
.Sh HISTORY
The
.Nm
command first appeared in
.Ox 5.9 .
.Sh AUTHORS
.An -nosplit
.An Mike Larkin Aq Mt mlarkin@openbsd.org
and
.An Reyk Floeter Aq Mt reyk@openbsd.org .