virt-admin.pod 10.7 KB
Newer Older
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
=head1 NAME

virt-admin - daemon administration interface

=head1 SYNOPSIS

B<virt-admin> [I<OPTION>]... [I<COMMAND_STRING>]

B<virt-admin> [I<OPTION>]... I<COMMAND> [I<ARG>]...

=head1 DESCRIPTION

The B<virt-admin> program is the main administration interface for modifying
the libvirt daemon configuration at runtime, changing daemon behaviour as well
as for monitoring and managing all clients connected to the daemon.

The basic structure of most virt-admin usage is:

  virt-admin [OPTION]... <command> [ARG]...

Where I<command> is one of the commands listed below.

The B<virt-admin> program can be used either to run one I<COMMAND> by giving the
command and its arguments on the shell command line, or a I<COMMAND_STRING>
which is a single shell argument consisting of multiple I<COMMAND> actions
and their arguments joined with whitespace, and separated by semicolons
between commands.  Within I<COMMAND_STRING>, virt-admin understands the
same single, double, and backslash escapes as the shell, although you must
add another layer of shell escaping in creating the single shell argument.
If no command is given in the command line, B<virt-admin> will then start a minimal
interpreter waiting for your commands, and the B<quit> command will then exit
the program.

The B<virt-admin> program understands the following I<OPTIONS>.

=over 4

=item B<-c>, B<--connect> I<URI>

Connect to the specified I<URI>, as if by the B<connect> command,
instead of the default connection.

=item B<-d>, B<--debug> I<LEVEL>

Enable debug messages at integer I<LEVEL> and above.  I<LEVEL> can
range from 0 to 4 (default).  See the documentation of B<VIRT_ADMIN_DEBUG>
environment variable below for the description of each I<LEVEL>.

=item B<-h>, B<--help>

Ignore all other arguments, and behave as if the B<help> command were
given instead.

=item B<-l>, B<--log> I<FILE>

Output logging details to I<FILE>.

=item B<-q>, B<--quiet>

Avoid extra informational messages.

=item B<-v>, B<--version[=short]>

Ignore all other arguments, and prints the version of the libvirt library
virt-admin is coming from

=item B<-V>, B<--version=long>

Ignore all other arguments, and prints the version of the libvirt library
virt-admin is coming from.

=back

=head1 NOTES

Running B<virt-admin> requires root privileges due to the
communications channels used to talk to the daemon. Consider changing the
I<unix_sock_group> ownership setting to grant access to specific set of users
or modifying I<unix_sock_rw_perms> permissions. Daemon configuration file
provides more information about setting permissions.

=head1 GENERIC COMMANDS

The following commands are generic.

=over 4

=item B<help> [I<command-or-group>]

This lists each of the virt-admin commands.  When used without options, all
commands are listed, one per line, grouped into related categories,
displaying the keyword for each group.

To display detailed information for a specific command, use its name as the
option.

=item B<quit>, B<exit>

quit this interactive terminal

=item B<version>

Will print out the version info about which libvirt library was this client
built from. As opposed to I<virsh> client, the output already includes
the version of the daemon.

B<Example>

 $ virt-admin version
 Compiled against library: libvirt 1.2.21
 Using library: libvirt 1.2.21
 Running against daemon: 1.2.20

=item B<cd> [I<directory>]

Will change current directory to I<directory>.  The default directory
for the B<cd> command is the home directory or, if there is no I<HOME>
variable in the environment, the root directory.

This command is only available in interactive mode.

=item B<pwd>

Will print the current directory.

=item B<connect> [I<URI>]

(Re)-Connect to a daemon's administrating server. The I<URI> parameter
specifies how to connect to the administrating server.
If I<LIBVIRT_ADMIN_DEFAULT_URI> or I<admin_uri_default> (see below) were set,
I<connect> is automatically issued every time a command that requires an
active connection is executed. Note that this only applies if there is no
connection at all or there is an inactive one.

To find the currently used URI, check the I<uri> command documented below.

For remote access see the documentation page at
L<http://libvirt.org/uri.html> on how to make URIs.

=item B<uri>

Prints the administrating server canonical URI, can be useful in shell mode. If
no I<uri> was specified, neither I<LIBVIRT_ADMIN_DEFAULT_URI> or
I<admin_uri_default> were set, libvirtd:///system is used.

=back

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
=head1 SERVER COMMANDS

Following commands manipulate daemon's server internal configuration.
The I<server> is specified by its name.

=over 4

=item B<srv-threadpool-info> I<server>

Retrieve server's threadpool attributes. These attributes include:

=over 4

=item I<minWorkers>
as the bottom limit to the number of active workers,

=item I<maxWorkers>
as the top limit to the number of active workers,

=item I<nWorkers>
as the current number of workers in the threadpool,

=item I<freeWorkers>
as the current number of workers available for a task,

=item I<prioWorkers>
as the current number of priority workers in the threadpool, and

=item I<jobQueueDepth>
as the current depth of threadpool's job queue.

=back

B<Background>

Each daemon server utilizes a threadpool to accomplish tasks requested by
clients connected to it. Every time a client request arrives to the server,
it checks whether there is a worker available to accomplish the given task or
it should create a new worker for the job (rather than being destroyed, the
worker becomes free once the task is finished). Creating new workers, however,
is only possible when the current number of workers is still below the
configured upper limit.

In addition to these 'standard' workers, a threadpool also contains a special
set of workers called I<priority> workers. Their purpose is to perform tasks
that, unlike tasks carried out by normal workers, are within libvirt's full
control and libvirt guarantees that such a task cannot hang, thus will always
finish. An example of such a task this would be destroying a domain:
    $ virsh destroy <domain>.

=item B<srv-threadpool-set> I<server> [I<--min-workers> B<count>]
[I<--max-workers> B<count>] [I<--priority-workers> B<count>]

Change threadpool attributes on a server. Only a fraction of all attributes as
described in I<srv-threadpool-info> is supported for the setter.

=over 4

=item I<--min-workers>

The bottom limit to number of active workers in a threadpool.

=item I<--max-workers>

The upper limit to number of active workers in a threadpool. If used in
combination with option I<--min-workers>, the value for the upper limit has to
be greater than the value for the bottom limit, otherwise the command results
in an error.

=item I<--priority-workers>

The current number of active priority workers in a threadpool.

=back

223 224 225 226 227 228 229
=item B<srv-clients-list> I<server>

Print a table showing the list of clients connected to <server>, also providing
information about transport type used on client's connection (supported
transports include B<unix>, B<tcp>, and B<tls>), as well as providing
information about client's connection time (system local time is used).

230 231
=back

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
=head1 CLIENT COMMANDS

Following commands provide management and monitoring of clients connected to
one of daemon's available servers. Clients are specified by their numeric ID
which is obtained by listing all clients connected to a specified server
(see command B<srv-clients-list>).

=over 4

=item B<client-info> I<server> I<client>

Retrieve identity information about I<client> from I<server>. The attributes
returned may vary depending on the connection transport used.
Transport-dependent attributes include local client process's pid, uid,
user name, and group name, as well as socket address of the remote peer, see
B<Examples> below.

On the other hand, transport-independent attributes include client's SELinux
context (if enabled on the host) and SASL username (if SASL authentication is
enabled within daemon).

B<Examples>

 # virt-admin client-info libvirtd 1
 id             : 1
 connection_time: 2016-05-03 13:27:04+0200
 transport      : unix
 readonly       : yes
 unix_user_id   : 0
 unix_user_name : root
 unix_group_id  : 0
 unix_group_name: root
 unix_process_id: 10201

 # virt-admin client-info libvirtd 2
 id             : 2
 connection_time: 2016-05-03 13:30:33+0200
 transport      : tcp
 readonly       : no
 sock_addr      : 127.0.0.1:57060

273 274 275 276 277
=item B<client-disconnect> I<server> I<client>

Close a connection originating from I<client>. The I<server> argument
specifies the name of the server I<client> is currently connected to.

278 279
=back

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
=head1 ENVIRONMENT

The following environment variables can be set to alter the behaviour
of C<virt-admin>

=over 4

=item VIRT_ADMIN_DEBUG=<0 to 4>

Turn on verbose debugging of virt-admin commands. Valid levels are

=over 4

=item * VIRT_ADMIN_DEBUG=0

DEBUG - Messages at ALL levels get logged

=item * VIRT_ADMIN_DEBUG=1

INFO - Logs messages at levels INFO, NOTICE, WARNING and ERROR

=item * VIRT_ADMIN_DEBUG=2

NOTICE - Logs messages at levels NOTICE, WARNING and ERROR

=item * VIRT_ADMIN_DEBUG=3

WARNING - Logs messages at levels WARNING and ERROR

=item * VIRT_ADMIN_DEBUG=4

ERROR - Messages at only ERROR level gets logged.

=back

=item VIRT_ADMIN_LOG_FILE=C<LOGFILE>

The file to log virt-admin debug messages.

=item LIBVIRT_ADMIN_DEFAULT_URI

The daemon whose admin server to connect to by default. Set this to a URI, in
the same format as accepted by the B<connect> option. This overrides the
default URI set in any client config file.

=item VIRT_ADMIN_HISTSIZE

The number of commands to remember in the command  history.  The
default value is 500.

=item LIBVIRT_DEBUG=LEVEL

Turn on verbose debugging of all libvirt API calls. Valid levels are

=over 4

=item * LIBVIRT_DEBUG=1

Messages at level DEBUG or above

=item * LIBVIRT_DEBUG=2

Messages at level INFO or above

=item * LIBVIRT_DEBUG=3

Messages at level WARNING or above

=item * LIBVIRT_DEBUG=4

Messages at level ERROR or above

=back

A
Andrea Bolognani 已提交
354 355
For further information about debugging options consult
L<http://libvirt.org/logging.html>
356 357 358 359 360 361

=back

=head1 BUGS

Report any bugs discovered to the libvirt community via the mailing
A
Andrea Bolognani 已提交
362 363
list L<http://libvirt.org/contact.html> or bug tracker
L<http://libvirt.org/bugs.html>.
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
Alternatively report bugs to your software distributor / vendor.

=head1 AUTHORS

  Please refer to the AUTHORS file distributed with libvirt.

  Based on the virsh man page.

=head1 COPYRIGHT

Copyright (C) 2015 Red Hat, Inc., and the authors listed in the
libvirt AUTHORS file.

=head1 LICENSE

virt-admin is distributed under the terms of the GNU LGPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE

=head1 SEE ALSO

L<virsh(1)>, L<virt-xml-validate(1)>, L<virt-host-validate(1)>,
L<http://www.libvirt.org/>

=cut