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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "VIRSH.POD.1 1"
.TH VIRSH.POD.1 1 "2006-04-06" "perl v5.8.6" "User Contributed Perl Documentation"
.SH "NAME"
virsh \- management user interface
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
virsh <subcommand> [args]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBvirsh\fR program is the main interface for managing virsh guest
domains. The program can be used to create, pause, and shutdown
domains. It can also be used to list current domains. Libvirt is a C toolkit to interract with the virtualization capabilities of recent versions of Linux (and other OSes). It is free software available under the \s-1GNU\s0 Lesser General Public License. Virtualization of the Linux Operating System means the ability to run multiple instances of Operating Systems concurently on a single hardware system where the basic resources are driven by a Linux instance. The library aim at providing long term stable C \s-1API\s0 initially for the Xen paravirtualization but should be able to integrate other virtualization mechanisms if needed.
.PP
The basic structure of every virsh command is almost always:
.PP
.Vb 1
\& virsh <subcommand> <domain-id> [OPTIONS]
.Ve
.PP
Where \fIsubcommand\fR is one of the sub commands listed below, \fIdomain-id\fR
is the numeric domain id, or the domain name (which will be internally
translated to domain id), and \fI\s-1OPTIONS\s0\fR are sub command specific
options. There are a few exceptions to this rule in the cases where
the sub command in question acts on all domains, the entire machine,
or directly on the xen hypervisor. Those exceptions will be clear for
each of those sub commands.
.SH "NOTES"
.IX Header "NOTES"
All \fBvirsh\fR opperations rely upon the libvirt library.
For any virsh commands to run xend/qemu, or what ever virtual library that libvirt suports. For this reason you should start xend/qemu as a service when your system first boots using xen/qemu.
.PP
Most \fBvirsh\fR commands require root privledges to run due to the
communications channels used to talk to the hypervisor. Running as
non root will return an error.
.PP
Most \fBvirsh\fR commands act asynchronously, so just because the \fBvirsh\fR
command returned, doesn't mean the action is complete. This is
important, as many operations on domains, like create and shutdown,
can take considerable time (30 seconds or more) to bring the machine
into a fully compliant state. If you want to know when one of these
actions has finished you must poll through virsh list periodically.
.SH "DOMAIN SUBCOMMANDS"
.IX Header "DOMAIN SUBCOMMANDS"
The following sub commands manipulate domains directly, as stated
previously most commands take domain-id as the first parameter.
.IP "\fBconnect\fR optional \fI\-\-readonly\fR" 4
.IX Item "connect optional --readonly"
Connect to local hypervisor. This is build-in command after shell start up.
.Sp
The \fI\-\-readonly\fR option read-only connection
.IP "\fBcreate\fR \fI\s-1FILE\s0\fR" 4
.IX Item "create FILE"
Create a domain from an \s-1XML\s0 <file> an easy way to create one if you have a pre-existing xen guest created via \fBxm\fR create <\s-1XMLFILE\s0>.
.Sp
\&\fBExample\fR
.Sp
virsh dumpxml <domain\-name or id> to a file.
.IP "\fBdinfo\fR \fIdomain-name or id\fR" 4
.IX Item "dinfo domain-name or id"
Returns basic information about the domain.
.IP "\fBdumpxml\fR \fIdomain-name or id\fR" 4
.IX Item "dumpxml domain-name or id"
Ouput the domain informations as an \s-1XML\s0 dump to stdout, this format can be used by the create sub command.
.IP "\fBdestroy\fR \fIdomain-name or id\fR" 4
.IX Item "destroy domain-name or id"
Immediately terminate the domain domain\-id. This doesn't give the domain
\&\s-1OS\s0 any chance to react, and it the equivalent of ripping the power
cord out on a physical machine. In most cases you will want to use
the \fBshutdown\fR command instead.
.IP "\fBdomid\fR \fIdomain-name\fR" 4
.IX Item "domid domain-name"
Converts a domain name to a domain id using xend's internal mapping.
.IP "\fBdominfo\fR \fIdomain-name or id\fR" 4
.IX Item "dominfo domain-name or id"
Returns basic information about the domain.
.IP "\fBdomname\fR \fIdomain-id\fR" 4
.IX Item "domname domain-id"
convert a domain Id to domain name
.IP "\fBdomstate\fR \fIdomain-name or id\fR" 4
.IX Item "domstate domain-name or id"
Returns state about a running domain.
.IP "\fBhelp\fR optional \fIsubcommand\fR" 4
.IX Item "help optional subcommand"
Displays the short help message (i.e. common commands).
.Sp
\&\fBhelp\fR \fIsubcommand\fR will print out a detailed help message on that sub command
.IP "\fBlist\fR" 4
.IX Item "list"
Prints information about one or more domains. If no domains are
specified it prints out information about all domains.
.Sp
An example format for the list is as follows:
.Sp
\&\fBvirsh\fR list
Id Name State
.Sp
\&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.Sp
.Vb 2
\& 0 Domain-0 running
\& 2 fedora paused
.Ve
.Sp
Name is the name of the domain. \s-1ID\s0 the domain numeric id.
State is the run state (see below).
.RS 4
.Sp
.RS 4
\&\fB\s-1STATES\s0\fR
.Sp
The State field lists 6 states for a Xen Domain, and which ones the
current Domain is in.
=back
.RE
.IP "\fBr \- running\fR" 4
.IX Item "r - running"
The domain is currently running on a \s-1CPU\s0
.IP "\fBb \- blocked\fR" 4
.IX Item "b - blocked"
The domain is blocked, and not running or runable. This can be caused
because the domain is waiting on \s-1IO\s0 (a traditional wait state) or has
gone to sleep because there was nothing else for it to do.
.IP "\fBp \- paused\fR" 4
.IX Item "p - paused"
The domain has been paused, usually occurring through the administrator
running \fBxm pause\fR. When in a paused state the domain will still
consume allocated resources like memory, but will not be eligible for
scheduling by the Xen hypervisor.
.IP "\fBs \- shutdown\fR" 4
.IX Item "s - shutdown"
\&\s-1FIXME:\s0 Why would you ever see this state?
.IP "\fBc \- crashed\fR" 4
.IX Item "c - crashed"
The domain has crashed, which is always a violent ending. Usually
this state can only occur if the domain has been configured not to
restart on crash. See xmdomain.cfg for more info.
.IP "\fBd \- dying\fR" 4
.IX Item "d - dying"
The domain is in process of dying, but hasn't completely shutdown or
crashed.
.Sp
\&\s-1FIXME:\s0 Is this right?
.RE
.RS 4
.RE
.IP "\fBnodeinfo\fR \fIdomain-name or id\fR" 4
.IX Item "nodeinfo domain-name or id"
Returns basic information about the node.
.IP "\fBquit\fR" 4
.IX Item "quit"
quit this interactive terminal
.IP "\fBreboot\fR \fIdomain-id\fR" 4
.IX Item "reboot domain-id"
Reboot a domain. This acts just as if the domain had the \fBreboot\fR
command run from the console. The command returns as soon as it has
executed the reboot action, which may be significantly before the
domain actually reboots.
.Sp
For xen vm the behavior of what happens to a domain when it reboots is set by the
\&\fIon_reboot\fR parameter of the xmdomain.cfg file when the domain was
created.
.IP "\fBrestore\fR \fIstate-file\fR" 4
.IX Item "restore state-file"
Restores a domain from an \fBvirsh save\fR state file. See \fIsave\fR for more info.
.IP "\fBsave\fR \fIdomain-id\fR \fIstate-file\fR" 4
.IX Item "save domain-id state-file"
Saves a running domain to a state file so that it can be restored
later. Once saved, the domain will no longer be running on the
system, thus the memory allocated for the domain will be free for
other domains to use. \fBvirsh restore\fR restores from this state file.
.Sp
This is roughly equivalent to doing a hibernate on a running computer,
with all the same limitations. Open network connections may be
severed upon restore, as \s-1TCP\s0 timeouts may have expired.
.IP "\fBshutdown\fR \fIdomain-id\fR" 4
.IX Item "shutdown domain-id"
Gracefully shuts down a domain. This coordinates with the domain \s-1OS\s0
to perform graceful shutdown, so there is no guaruntee that it will
succeed, and may take a variable length of time depending on what
services must be shutdown in the domain.
.Sp
For a xen guest vm the behavior of what happens to a domain when it reboots is set by the
\&\fIon_shutdown\fR parameter of the xmdomain.cfg file when the domain was
created.
.IP "\fBresume\fR \fIdomain-id\fR" 4
.IX Item "resume domain-id"
Moves a domain out of the paused state. This will allow a previously
paused domain to now be eligible for scheduling by the the under lying hypervisor.
.IP "\fBversion\fR" 4
.IX Item "version"
Will print out the major version info about what this built from.
.RS 4
.Sp
.RS 4
\&\fBvirsh\fR version
.Sp
Compiled against library: libvir 0.0.6
.Sp
Using library: libvir 0.0.6
.Sp
Using \s-1API:\s0 Xen 3.0.0
.Sp
Running hypervisor: Xen 3.0.0
.RE
.RE
.RS 4
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIxm\fR\|(1), \fIxmdomain.cfg\fR\|(5), \fIxentop\fR\|(1) , <http://www.libvirt.org<sol>>
.SH "AUTHOR"
.IX Header "AUTHOR"
.Vb 2
\& Andrew Puch <apuch @ redhat.com>
\& Daniel Veillard <veillard @ redhat.com>
.Ve
.Sp
.Vb 3
\& Based on the xm man paged by
\& Sean Dague <sean at dague dot net>
\& Daniel Stekloff <dsteklof at us dot ibm dot com>
.Ve
.SH "BUGS"
.IX Header "BUGS"
Can be seen on the RedHat buzilla page under the libvirt
<https://bugzilla.redhat.com/>
|