1VIRSH(1) Virtualization Support VIRSH(1)
2
3
4
6 virsh - management user interface
7
9 virsh [OPTION]... [COMMAND_STRING]
10
11 virsh [OPTION]... COMMAND [ARG]...
12
14 The virsh program is the main interface for managing virsh guest
15 domains. The program can be used to create, pause, and shutdown
16 domains. It can also be used to list current domains. Libvirt is a C
17 toolkit to interact with the virtualization capabilities of recent
18 versions of Linux (and other OSes). It is free software available under
19 the GNU Lesser General Public License. Virtualization of the Linux
20 Operating System means the ability to run multiple instances of
21 Operating Systems concurrently on a single hardware system where the
22 basic resources are driven by a Linux instance. The library aims at
23 providing a long term stable C API. It currently supports Xen, QEMU,
24 KVM, LXC, OpenVZ, VirtualBox and VMware ESX.
25
26 The basic structure of most virsh usage is:
27
28 virsh [OPTION]... <command> <domain> [ARG]...
29
30 Where command is one of the commands listed below; domain is the
31 numeric domain id, or the domain name, or the domain UUID; and ARGS are
32 command specific options. There are a few exceptions to this rule in
33 the cases where the command in question acts on all domains, the entire
34 machine, or directly on the xen hypervisor. Those exceptions will be
35 clear for each of those commands. Note: it is permissible to give
36 numeric names to domains, however, doing so will result in a domain
37 that can only be identified by domain id. In other words, if a numeric
38 value is supplied it will be interpreted as a domain id, not as a name.
39
40 The virsh program can be used either to run one COMMAND by giving the
41 command and its arguments on the shell command line, or a
42 COMMAND_STRING which is a single shell argument consisting of multiple
43 COMMAND actions and their arguments joined with whitespace and
44 separated by semicolons or newlines between commands, where unquoted
45 backslash-newline pairs are elided. Within COMMAND_STRING, virsh
46 understands the same single, double, and backslash escapes as the
47 shell, although you must add another layer of shell escaping in
48 creating the single shell argument. If no command is given in the
49 command line, virsh will then start a minimal interpreter waiting for
50 your commands, and the quit command will then exit the program.
51
52 The virsh program understands the following OPTIONS.
53
54 -c, --connect URI
55 Connect to the specified URI, as if by the connect command, instead
56 of the default connection.
57
58 -d, --debug LEVEL
59 Enable debug messages at integer LEVEL and above. LEVEL can range
60 from 0 to 4 (default). See the documentation of VIRSH_DEBUG
61 environment variable below for the description of each LEVEL.
62
63 -e, --escape string
64 Set alternative escape sequence for console command. By default,
65 telnet's ^] is used. Allowed characters when using hat notation
66 are: alphabetic character, @, [, ], \, ^, _.
67
68 -h, --help
69 Ignore all other arguments, and behave as if the help command were
70 given instead.
71
72 -k, --keepalive-interval INTERVAL
73 Set an INTERVAL (in seconds) for sending keepalive messages to
74 check whether connection to the server is still alive. Setting the
75 interval to 0 disables client keepalive mechanism.
76
77 -K, --keepalive-count COUNT
78 Set a number of times keepalive message can be sent without getting
79 an answer from the server without marking the connection dead.
80 There is no effect to this setting in case the INTERVAL is set to
81 0.
82
83 -l, --log FILE
84 Output logging details to FILE.
85
86 -q, --quiet
87 Avoid extra informational messages.
88
89 -r, --readonly
90 Make the initial connection read-only, as if by the --readonly
91 option of the connect command.
92
93 -t, --timing
94 Output elapsed time information for each command.
95
96 -v, --version[=short]
97 Ignore all other arguments, and prints the version of the libvirt
98 library virsh is coming from
99
100 -V, --version=long
101 Ignore all other arguments, and prints the version of the libvirt
102 library virsh is coming from and which options and driver are
103 compiled in.
104
106 Most virsh operations rely upon the libvirt library being able to
107 connect to an already running libvirtd service. This can usually be
108 done using the command service libvirtd start.
109
110 Most virsh commands require root privileges to run due to the
111 communications channels used to talk to the hypervisor. Running as non
112 root will return an error.
113
114 Most virsh commands act synchronously, except maybe shutdown, setvcpus
115 and setmem. In those cases the fact that the virsh program returned,
116 may not mean the action is complete and you must poll periodically to
117 detect that the guest completed the operation.
118
119 virsh strives for backward compatibility. Although the help command
120 only lists the preferred usage of a command, if an older version of
121 virsh supported an alternate spelling of a command or option (such as
122 --tunnelled instead of --tunneled), then scripts using that older
123 spelling will continue to work.
124
125 Several virsh commands take an optionally scaled integer; if no scale
126 is provided, then the default is listed in the command (for historical
127 reasons, some commands default to bytes, while other commands default
128 to kibibytes). The following case-insensitive suffixes can be used to
129 select a specific scale:
130 b, byte byte 1
131 KB kilobyte 1,000
132 k, KiB kibibyte 1,024
133 MB megabyte 1,000,000
134 M, MiB mebibyte 1,048,576
135 GB gigabyte 1,000,000,000
136 G, GiB gibibyte 1,073,741,824
137 TB terabyte 1,000,000,000,000
138 T, TiB tebibyte 1,099,511,627,776
139 PB petabyte 1,000,000,000,000,000
140 P, PiB pebibyte 1,125,899,906,842,624
141 EB exabyte 1,000,000,000,000,000,000
142 E, EiB exbibyte 1,152,921,504,606,846,976
143
145 The following commands are generic i.e. not specific to a domain.
146
147 help [command-or-group]
148 This lists each of the virsh commands. When used without options,
149 all commands are listed, one per line, grouped into related
150 categories, displaying the keyword for each group.
151
152 To display only commands for a specific group, give the keyword for
153 that group as an option. For example:
154
155 virsh # help host
156
157 Host and Hypervisor (help keyword 'host'):
158 capabilities capabilities
159 cpu-models show the CPU models for an architecture
160 connect (re)connect to hypervisor
161 freecell NUMA free memory
162 hostname print the hypervisor hostname
163 qemu-attach Attach to existing QEMU process
164 qemu-monitor-command QEMU Monitor Command
165 qemu-agent-command QEMU Guest Agent Command
166 sysinfo print the hypervisor sysinfo
167 uri print the hypervisor canonical URI
168
169 To display detailed information for a specific command, give its
170 name as the option instead. For example:
171
172 virsh # help list
173 NAME
174 list - list domains
175
176 SYNOPSIS
177 list [--inactive] [--all]
178
179 DESCRIPTION
180 Returns list of domains.
181
182 OPTIONS
183 --inactive list inactive domains
184 --all list inactive & active domains
185
186 quit, exit
187 quit this interactive terminal
188
189 version [--daemon]
190 Will print out the major version info about what this built from.
191 If --daemon is specified then the version of the libvirt daemon is
192 included in the output.
193
194 Example
195
196 $ virsh version
197 Compiled against library: libvirt 1.2.3
198 Using library: libvirt 1.2.3
199 Using API: QEMU 1.2.3
200 Running hypervisor: QEMU 2.0.50
201
202 $ virsh version --daemon
203 Compiled against library: libvirt 1.2.3
204 Using library: libvirt 1.2.3
205 Using API: QEMU 1.2.3
206 Running hypervisor: QEMU 2.0.50
207 Running against daemon: 1.2.6
208
209 cd [directory]
210 Will change current directory to directory. The default directory
211 for the cd command is the home directory or, if there is no HOME
212 variable in the environment, the root directory.
213
214 This command is only available in interactive mode.
215
216 pwd Will print the current directory.
217
218 connect [URI] [--readonly]
219 (Re)-Connect to the hypervisor. When the shell is first started,
220 this is automatically run with the URI parameter requested by the
221 "-c" option on the command line. The URI parameter specifies how to
222 connect to the hypervisor. The documentation page at
223 <https://libvirt.org/uri.html> list the values supported, but the
224 most common are:
225
226 xen:///system
227 this is used to connect to the local Xen hypervisor
228
229 qemu:///system
230 connect locally as root to the daemon supervising QEMU and KVM
231 domains
232
233 qemu:///session
234 connect locally as a normal user to his own set of QEMU and KVM
235 domains
236
237 lxc:///system
238 connect to a local linux container
239
240 To find the currently used URI, check the uri command documented
241 below.
242
243 For remote access see the documentation page at
244 <https://libvirt.org/uri.html> on how to make URIs. The --readonly
245 option allows for read-only connection
246
247 uri Prints the hypervisor canonical URI, can be useful in shell mode.
248
249 hostname
250 Print the hypervisor hostname.
251
252 sysinfo
253 Print the XML representation of the hypervisor sysinfo, if
254 available.
255
256 nodeinfo
257 Returns basic information about the node, like number and type of
258 CPU, and size of the physical memory. The output corresponds to
259 virNodeInfo structure. Specifically, the "CPU socket(s)" field
260 means number of CPU sockets per NUMA cell. The information libvirt
261 displays is dependent upon what each architecture may provide.
262
263 nodecpumap [--pretty]
264 Displays the node's total number of CPUs, the number of online CPUs
265 and the list of online CPUs.
266
267 With --pretty the online CPUs are printed as a range instead of a
268 list.
269
270 nodecpustats [cpu] [--percent]
271 Returns cpu stats of the node. If cpu is specified, this will
272 print the specified cpu statistics only. If --percent is
273 specified, this will print the percentage of each kind of cpu
274 statistics during 1 second.
275
276 nodememstats [cell]
277 Returns memory stats of the node. If cell is specified, this will
278 print the specified cell statistics only.
279
280 nodesuspend [target] [duration]
281 Puts the node (host machine) into a system-wide sleep state and
282 schedule the node's Real-Time-Clock interrupt to resume the node
283 after the time duration specified by duration is out. target
284 specifies the state to which the host will be suspended to, it can
285 be "mem" (suspend to RAM), "disk" (suspend to disk), or "hybrid"
286 (suspend to both RAM and disk). duration specifies the time
287 duration in seconds for which the host has to be suspended, it
288 should be at least 60 seconds.
289
290 node-memory-tune [shm-pages-to-scan] [shm-sleep-millisecs] [shm-merge-
291 across-nodes]
292 Allows you to display or set the node memory parameters. shm-
293 pages-to-scan can be used to set the number of pages to scan before
294 the shared memory service goes to sleep; shm-sleep-millisecs can be
295 used to set the number of millisecs the shared memory service
296 should sleep before next scan; shm-merge-across-nodes specifies if
297 pages from different numa nodes can be merged. When set to 0, only
298 pages which physically reside in the memory area of same NUMA node
299 can be merged. When set to 1, pages from all nodes can be merged.
300 Default to 1.
301
302 Note: Currently the "shared memory service" only means KSM (Kernel
303 Samepage Merging).
304
305 capabilities
306 Print an XML document describing the capabilities of the hypervisor
307 we are currently connected to. This includes a section on the host
308 capabilities in terms of CPU and features, and a set of description
309 for each kind of guest which can be virtualized. For a more
310 complete description see:
311 <https://libvirt.org/formatcaps.html> The XML also show the NUMA
312 topology information if available.
313
314 domcapabilities [virttype] [emulatorbin] [arch] [machine]
315 Print an XML document describing the domain capabilities for the
316 hypervisor we are connected to using information either sourced
317 from an existing domain or taken from the virsh capabilities
318 output. This may be useful if you intend to create a new domain and
319 are curious if for instance it could make use of VFIO by creating a
320 domain for the hypervisor with a specific emulator and
321 architecture.
322
323 Each hypervisor will have different requirements regarding which
324 options are required and which are optional. A hypervisor can
325 support providing a default value for any of the options.
326
327 The virttype option specifies the virtualization type used. The
328 value to be used is either from the 'type' attribute of the
329 <domain/> top level element from the domain XML or the 'type'
330 attribute found within each <guest/> element from the virsh
331 capabilities output. The emulatorbin option specifies the path to
332 the emulator. The value to be used is either the <emulator> element
333 in the domain XML or the virsh capabilities output. The arch option
334 specifies the architecture to be used for the domain. The value to
335 be used is either the "arch" attribute from the domain's XML <os/>
336 element and <type/> subelement or the "name" attribute of an
337 <arch/> element from the virsh capabililites output. The machine
338 specifies the machine type for the emulator. The value to be used
339 is either the "machine" attribute from the domain's XML <os/>
340 element and <type/> subelement or one from a list of machines from
341 the virsh capabilities output for a specific architecture and
342 domain type.
343
344 For the qemu hypervisor, a virttype of either 'qemu' or 'kvm' must
345 be supplied along with either the emulatorbin or arch in order to
346 generate output for the default machine. Supplying a machine value
347 will generate output for the specific machine.
348
349 inject-nmi domain
350 Inject NMI to the guest.
351
352 list [--inactive | --all] [--managed-save] [--title] { [--table] |
353 --name | --uuid } [--persistent] [--transient] [--with-managed-save]
354 [--without-managed-save] [--autostart] [--no-autostart]
355 [--with-snapshot] [--without-snapshot] [--state-running]
356 [--state-paused] [--state-shutoff] [--state-other]
357 Prints information about existing domains. If no options are
358 specified it prints out information about running domains.
359
360 An example format for the list is as follows:
361
362 virsh list
363 Id Name State
364 ----------------------------------------------------
365 0 Domain-0 running
366 2 fedora paused
367
368 Name is the name of the domain. ID the domain numeric id. State
369 is the run state (see below).
370
371 STATES
372
373 The State field lists what state each domain is currently in. A
374 domain can be in one of the following possible states:
375
376 running
377 The domain is currently running on a CPU
378
379 idle
380 The domain is idle, and not running or runnable. This can be
381 caused because the domain is waiting on IO (a traditional wait
382 state) or has gone to sleep because there was nothing else for
383 it to do.
384
385 paused
386 The domain has been paused, usually occurring through the
387 administrator running virsh suspend. When in a paused state
388 the domain will still consume allocated resources like memory,
389 but will not be eligible for scheduling by the hypervisor.
390
391 in shutdown
392 The domain is in the process of shutting down, i.e. the guest
393 operating system has been notified and should be in the process
394 of stopping its operations gracefully.
395
396 shut off
397 The domain is not running. Usually this indicates the domain
398 has been shut down completely, or has not been started.
399
400 crashed
401 The domain has crashed, which is always a violent ending.
402 Usually this state can only occur if the domain has been
403 configured not to restart on crash.
404
405 pmsuspended
406 The domain has been suspended by guest power management, e.g.
407 entered into s3 state.
408
409 Normally only active domains are listed. To list inactive domains
410 specify --inactive or --all to list both active and inactive
411 domains.
412
413 To further filter the list of domains you may specify one or more
414 of filtering flags supported by the list command. These flags are
415 grouped by function. Specifying one or more flags from a group
416 enables the filter group. Note that some combinations of flags may
417 yield no results. Supported filtering flags and groups:
418
419 Persistence
420 Flag --persistent is used to include persistent domains in the
421 returned list. To include transient domains specify
422 --transient.
423
424 Existence of managed save image
425 To list domains having a managed save image specify flag
426 --with-managed-save. For domains that don't have a managed save
427 image specify --without-managed-save.
428
429 Domain state
430 The following filter flags select a domain by its state:
431 --state-running for running domains, --state-paused for paused
432 domains, --state-shutoff for turned off domains and
433 --state-other for all other states as a fallback.
434
435 Autostarting domains
436 To list autostarting domains use the flag --autostart. To list
437 domains with this feature disabled use --no-autostart.
438
439 Snapshot existence
440 Domains that have snapshot images can be listed using flag
441 --with-snapshot, domains without a snapshot --without-snapshot.
442
443 When talking to older servers, this command is forced to use a
444 series of API calls with an inherent race, where a domain might not
445 be listed or might appear more than once if it changed state
446 between calls while the list was being collected. Newer servers do
447 not have this problem.
448
449 If --managed-save is specified, then domains that have managed save
450 state (only possible if they are in the shut off state, so you need
451 to specify --inactive or --all to actually list them) will instead
452 show as saved in the listing. This flag is usable only with the
453 default --table output. Note that this flag does not filter the
454 list of domains.
455
456 If --name is specified, domain names are printed instead of the
457 table formatted one per line. If --uuid is specified domain's
458 UUID's are printed instead of names. Flag --table specifies that
459 the legacy table-formatted output should be used. This is the
460 default.
461
462 If both --name and --uuid are specified, domain UUID's and names
463 are printed side by side without any header. Flag --table specifies
464 that the legacy table-formatted output should be used. This is the
465 default if neither --name nor --uuid are specified. Option --table
466 is mutually exclusive with options --uuid and --name.
467
468 If --title is specified, then the short domain description (title)
469 is printed in an extra column. This flag is usable only with the
470 default --table output.
471
472 Example:
473
474 virsh list --title
475 Id Name State Title
476 --------------------------------------------------------------------------
477 0 Domain-0 running Mailserver 1
478 2 fedora paused
479
480 freecell [{ [--cellno] cellno | --all }]
481 Prints the available amount of memory on the machine or within a
482 NUMA cell. The freecell command can provide one of three different
483 displays of available memory on the machine depending on the
484 options specified. With no options, it displays the total free
485 memory on the machine. With the --all option, it displays the free
486 memory in each cell and the total free memory on the machine.
487 Finally, with a numeric argument or with --cellno plus a cell
488 number it will display the free memory for the specified cell only.
489
490 freepages [{ [--cellno] cellno [--pagesize] pagesize | --all }]
491 Prints the available amount of pages within a NUMA cell. cellno
492 refers to the NUMA cell you're interested in. pagesize is a scaled
493 integer (see NOTES above). Alternatively, if --all is used, info
494 on each possible combination of NUMA cell and page size is printed
495 out.
496
497 allocpages [--pagesize] pagesize [--pagecount] pagecount [[--cellno]
498 cellno] [--add] [--all]
499 Change the size of pages pool of pagesize on the host. If --add is
500 specified, then pagecount pages are added into the pool. However,
501 if --add wasn't specified, then the pagecount is taken as the new
502 absolute size of the pool (this may be used to free some pages and
503 size the pool down). The cellno modifier can be used to narrow the
504 modification down to a single host NUMA cell. On the other end of
505 spectrum lies --all which executes the modification on all NUMA
506 cells.
507
508 cpu-baseline FILE [--features] [--migratable]
509 Compute baseline CPU which will be supported by all host CPUs given
510 in <file>. (See hypervisor-cpu-baseline command to get a CPU which
511 can be provided by a specific hypervisor.) The list of host CPUs is
512 built by extracting all <cpu> elements from the <file>. Thus, the
513 <file> can contain either a set of <cpu> elements separated by new
514 lines or even a set of complete <capabilities> elements printed by
515 capabilities command. If --features is specified, then the
516 resulting XML description will explicitly include all features that
517 make up the CPU, without this option features that are part of the
518 CPU model will not be listed in the XML description. If
519 --migratable is specified, features that block migration will not
520 be included in the resulting CPU.
521
522 cpu-compare FILE [--error]
523 Compare CPU definition from XML <file> with host CPU. (See
524 hypervisor-cpu-compare command for comparing the CPU definition
525 with the CPU which a specific hypervisor is able to provide on the
526 host.) The XML <file> may contain either host or guest CPU
527 definition. The host CPU definition is the <cpu> element and its
528 contents as printed by capabilities command. The guest CPU
529 definition is the <cpu> element and its contents from domain XML
530 definition or the CPU definition created from the host CPU model
531 found in domain capabilities XML (printed by domcapabilities
532 command). In addition to the <cpu> element itself, this command
533 accepts full domain XML, capabilities XML, or domain capabilities
534 XML containing the CPU definition. For more information on guest
535 CPU definition see:
536 <https://libvirt.org/formatdomain.html#elementsCPU>. If --error is
537 specified, the command will return an error when the given CPU is
538 incompatible with host CPU and a message providing more details
539 about the incompatibility will be printed out.
540
541 cpu-models arch
542 Print the list of CPU models known by libvirt for the specified
543 architecture. Whether a specific hypervisor is able to create a
544 domain which uses any of the printed CPU models is a separate
545 question which can be answered by looking at the domain
546 capabilities XML returned by domcapabilities command. Moreover,
547 for some architectures libvirt does not know any CPU models and the
548 usable CPU models are only limited by the hypervisor. This command
549 will print that all CPU models are accepted for these architectures
550 and the actual list of supported CPU models can be checked in the
551 domain capabilities XML.
552
553 echo [--shell] [--xml] [arg...]
554 Echo back each arg, separated by space. If --shell is specified,
555 then the output will be single-quoted where needed, so that it is
556 suitable for reuse in a shell context. If --xml is specified, then
557 the output will be escaped for use in XML.
558
559 hypervisor-cpu-compare FILE [virttype] [emulator] [arch] [machine]
560 [--error]
561 Compare CPU definition from XML <file> with the CPU the hypervisor
562 is able to provide on the host. (This is different from cpu-compare
563 which compares the CPU definition with the host CPU without
564 considering any specific hypervisor and its abilities.)
565
566 The XML FILE may contain either a host or guest CPU definition. The
567 host CPU definition is the <cpu> element and its contents as
568 printed by the capabilities command. The guest CPU definition is
569 the <cpu> element and its contents from the domain XML definition
570 or the CPU definition created from the host CPU model found in the
571 domain capabilities XML (printed by the domcapabilities command).
572 In addition to the <cpu> element itself, this command accepts full
573 domain XML, capabilities XML, or domain capabilities XML containing
574 the CPU definition. For more information on guest CPU definition
575 see: <https://libvirt.org/formatdomain.html#elementsCPU>.
576
577 The virttype option specifies the virtualization type (usable in
578 the 'type' attribute of the <domain> top level element from the
579 domain XML). emulator specifies the path to the emulator, arch
580 specifies the CPU architecture, and machine specifies the machine
581 type. If --error is specified, the command will return an error
582 when the given CPU is incompatible with the host CPU and a message
583 providing more details about the incompatibility will be printed
584 out.
585
586 hypervisor-cpu-baseline FILE [virttype] [emulator] [arch] [machine]
587 [--features] [--migratable]
588 Compute a baseline CPU which will be compatible with all CPUs
589 defined in an XML file and with the CPU the hypervisor is able to
590 provide on the host. (This is different from cpu-baseline which
591 does not consider any hypervisor abilities when computing the
592 baseline CPU.)
593
594 The XML FILE may contain either host or guest CPU definitions
595 describing the host CPU model. The host CPU definition is the <cpu>
596 element and its contents as printed by capabilities command. The
597 guest CPU definition may be created from the host CPU model found
598 in domain capabilities XML (printed by domcapabilities command). In
599 addition to the <cpu> elements, this command accepts full
600 capabilities XMLs, or domain capabilities XMLs containing the CPU
601 definitions. For best results, use only the CPU definitions from
602 domain capabilities.
603
604 When FILE contains only a single CPU definition, the command will
605 print the same CPU with restrictions imposed by the capabilities of
606 the hypervisor. Specifically, running th virsh hypervisor-cpu-
607 baseline command with no additional options on the result of virsh
608 domcapabilities will transform the host CPU model from domain
609 capabilities XML to a form directly usable in domain XML.
610
611 The virttype option specifies the virtualization type (usable in
612 the 'type' attribute of the <domain> top level element from the
613 domain XML). emulator specifies the path to the emulator, arch
614 specifies the CPU architecture, and machine specifies the machine
615 type. If --features is specified, then the resulting XML
616 description will explicitly include all features that make up the
617 CPU, without this option features that are part of the CPU model
618 will not be listed in the XML description. If --migratable is
619 specified, features that block migration will not be included in
620 the resulting CPU.
621
623 The following commands manipulate domains directly, as stated
624 previously most commands take domain as the first parameter. The domain
625 can be specified as a short integer, a name or a full UUID.
626
627 autostart [--disable] domain
628 Configure a domain to be automatically started at boot.
629
630 The option --disable disables autostarting.
631
632 console domain [devname] [--safe] [--force]
633 Connect the virtual serial console for the guest. The optional
634 devname parameter refers to the device alias of an alternate
635 console, serial or parallel device configured for the guest. If
636 omitted, the primary console will be opened.
637
638 If the flag --safe is specified, the connection is only attempted
639 if the driver supports safe console handling. This flag specifies
640 that the server has to ensure exclusive access to console devices.
641 Optionally the --force flag may be specified, requesting to
642 disconnect any existing sessions, such as in a case of a broken
643 connection.
644
645 create FILE [--console] [--paused] [--autodestroy] [--pass-fds N,M,...]
646 [--validate]
647 Create a domain from an XML <file>. Optionally, --validate option
648 can be passed to validate the format of the input XML file against
649 an internal RNG schema (identical to using virt-xml-validate(1)
650 tool). Domains created using this command are going to be either
651 transient (temporary ones that will vanish once destroyed) or
652 existing persistent domains that will run with one-time use
653 configuration, leaving the persistent XML untouched (this can come
654 handy during an automated testing of various configurations all
655 based on the original XML). See the Example section for usage
656 demonstration.
657
658 The domain will be paused if the --paused option is used and
659 supported by the driver; otherwise it will be running. If --console
660 is requested, attach to the console after creation. If
661 --autodestroy is requested, then the guest will be automatically
662 destroyed when virsh closes its connection to libvirt, or otherwise
663 exits.
664
665 If --pass-fds is specified, the argument is a comma separated list
666 of open file descriptors which should be pass on into the guest.
667 The file descriptors will be re-numbered in the guest, starting
668 from 3. This is only supported with container based virtualization.
669
670 Example
671
672 1) prepare a template from an existing domain (skip directly to 3a if writing
673 one from scratch)
674
675 # virsh dumpxml <domain> > domain.xml
676
677 2) edit the template using an editor of your choice and:
678 a) DO CHANGE! <name> and <uuid> (<uuid> can also be removed), or
679 b) DON'T CHANGE! either <name> or <uuid>
680
681 # $EDITOR domain.xml
682
683 3) create a domain from domain.xml, depending on whether following 2a or 2b
684 respectively:
685 a) the domain is going to be transient
686 b) an existing persistent domain will run with a modified one-time
687 configuration
688
689 # virsh create domain.xml
690
691 define FILE [--validate]
692 Define a domain from an XML <file>. Optionally, the format of the
693 input XML file can be validated against an internal RNG schema with
694 --validate (identical to using virt-xml-validate(1) tool). The
695 domain definition is registered but not started. If domain is
696 already running, the changes will take effect on the next boot.
697
698 desc domain [[--live] [--config] | [--current]] [--title] [--edit]
699 [--new-desc New description or title message]
700 Show or modify description and title of a domain. These values are
701 user fields that allow to store arbitrary textual data to allow
702 easy identification of domains. Title should be short, although
703 it's not enforced. (See also metadata that works with XML based
704 domain metadata.)
705
706 Flags --live or --config select whether this command works on live
707 or persistent definitions of the domain. If both --live and
708 --config are specified, the --config option takes precedence on
709 getting the current description and both live configuration and
710 config are updated while setting the description. --current is
711 exclusive and implied if none of these was specified.
712
713 Flag --edit specifies that an editor with the contents of current
714 description or title should be opened and the contents saved back
715 afterwards.
716
717 Flag --title selects operation on the title field instead of
718 description.
719
720 If neither of --edit and --new-desc are specified the note or
721 description is displayed instead of being modified.
722
723 destroy domain [--graceful]
724 Immediately terminate the domain domain. This doesn't give the
725 domain OS any chance to react, and it's the equivalent of ripping
726 the power cord out on a physical machine. In most cases you will
727 want to use the shutdown command instead. However, this does not
728 delete any storage volumes used by the guest, and if the domain is
729 persistent, it can be restarted later.
730
731 If domain is transient, then the metadata of any snapshots will be
732 lost once the guest stops running, but the snapshot contents still
733 exist, and a new domain with the same name and UUID can restore the
734 snapshot metadata with snapshot-create.
735
736 If --graceful is specified, don't resort to extreme measures (e.g.
737 SIGKILL) when the guest doesn't stop after a reasonable timeout;
738 return an error instead.
739
740 domblkstat domain [block-device] [--human]
741 Get device block stats for a running domain. A block-device
742 corresponds to a unique target name (<target dev='name'/>) or
743 source file (<source file='name'/>) for one of the disk devices
744 attached to domain (see also domblklist for listing these names).
745 On a lxc or qemu domain, omitting the block-device yields device
746 block stats summarily for the entire domain.
747
748 Use --human for a more human readable output.
749
750 Availability of these fields depends on hypervisor. Unsupported
751 fields are missing from the output. Other fields may appear if
752 communicating with a newer version of libvirtd.
753
754 Explanation of fields (fields appear in the following order):
755 rd_req - count of read operations
756 rd_bytes - count of read bytes
757 wr_req - count of write operations
758 wr_bytes - count of written bytes
759 errs - error count
760 flush_operations - count of flush operations
761 rd_total_times - total time read operations took (ns)
762 wr_total_times - total time write operations took (ns)
763 flush_total_times - total time flush operations took (ns)
764 <-- other fields provided by hypervisor -->
765
766 domifaddr domain [interface] [--full] [--source lease|agent|arp]
767 Get a list of interfaces of a running domain along with their IP
768 and MAC addresses, or limited output just for one interface if
769 interface is specified. Note that interface can be driver
770 dependent, it can be the name within guest OS or the name you would
771 see in domain XML. Moreover, the whole command may require a guest
772 agent to be configured for the queried domain under some
773 hypervisors, notably QEMU.
774
775 If --full is specified, the interface name and MAC address is
776 always displayed when the interface has multiple IP addresses or
777 aliases; otherwise, only the interface name and MAC address is
778 displayed for the first name and MAC address with "-" for the
779 others using the same name and MAC address.
780
781 The --source argument specifies what data source to use for the
782 addresses, currently 'lease' to read DHCP leases, 'agent' to query
783 the guest OS via an agent, or 'arp' to get IP from host's arp
784 tables. If unspecified, 'lease' is the default.
785
786 domifstat domain interface-device
787 Get network interface stats for a running domain. The network
788 interface stats are only available for interfaces that have a
789 physical source interface. This does not include, for example, a
790 'user' interface type since it is a virtual LAN with NAT to the
791 outside world. interface-device can be the interface target by name
792 or MAC address.
793
794 domif-setlink domain interface-device state [--config]
795 Modify link state of the domain's virtual interface. Possible
796 values for state are "up" and "down". If --config is specified,
797 only the persistent configuration of the domain is modified, for
798 compatibility purposes, --persistent is alias of --config.
799 interface-device can be the interface's target name or the MAC
800 address.
801
802 domif-getlink domain interface-device [--config]
803 Query link state of the domain's virtual interface. If --config is
804 specified, query the persistent configuration, for compatibility
805 purposes, --persistent is alias of --config.
806
807 interface-device can be the interface's target name or the MAC
808 address.
809
810 domiftune domain interface-device [[--config] [--live] | [--current]]
811 [--inbound average,peak,burst,floor] [--outbound average,peak,burst]
812 Set or query the domain's network interface's bandwidth parameters.
813 interface-device can be the interface's target name (<target
814 dev='name'/>), or the MAC address.
815
816 If no --inbound or --outbound is specified, this command will query
817 and show the bandwidth settings. Otherwise, it will set the inbound
818 or outbound bandwidth. average,peak,burst,floor is the same as in
819 command attach-interface. Values for average, peak and floor are
820 expressed in kilobytes per second, while burst is expressed in
821 kilobytes in a single burst at peak speed as described in the
822 Network XML documentation at
823 <https://libvirt.org/formatnetwork.html#elementQoS>.
824
825 To clear inbound or outbound settings, use --inbound or --outbound
826 respectfully with average value of zero.
827
828 If --live is specified, affect a running guest. If --config is
829 specified, affect the next boot of a persistent guest. If
830 --current is specified, affect the current guest state. Both
831 --live and --config flags may be given, but --current is exclusive.
832 If no flag is specified, behavior is different depending on
833 hypervisor.
834
835 dommemstat domain [--period seconds] [[--config] [--live] |
836 [--current]]
837 Get memory stats for a running domain.
838
839 Availability of these fields depends on hypervisor. Unsupported
840 fields are missing from the output. Other fields may appear if
841 communicating with a newer version of libvirtd.
842
843 Explanation of fields:
844 swap_in - The amount of data read from swap space (in
845 KiB)
846 swap_out - The amount of memory written out to swap
847 space (in KiB)
848 major_fault - The number of page faults where disk IO was
849 required
850 minor_fault - The number of other page faults
851 unused - The amount of memory left unused by the
852 system (in KiB)
853 available - The amount of usable memory as seen by the
854 domain (in KiB)
855 actual - Current balloon value (in KiB)
856 rss - Resident Set Size of the running domain's
857 process (in KiB)
858 usable - The amount of memory which can be reclaimed
859 by balloon without causing host swapping (in KiB)
860 last-update - Timestamp of the last update of statistics
861 (in seconds)
862 disk_caches - The amount of memory that can be reclaimed
863 without additional I/O, typically disk caches (in KiB)
864
865 For QEMU/KVM with a memory balloon, setting the optional --period
866 to a value larger than 0 in seconds will allow the balloon driver
867 to return additional statistics which will be displayed by
868 subsequent dommemstat commands. Setting the --period to 0 will stop
869 the balloon driver collection, but does not clear the statistics in
870 the balloon driver. Requires at least QEMU/KVM 1.5 to be running on
871 the host.
872
873 The --live, --config, and --current flags are only valid when using
874 the --period option in order to set the collection period for the
875 balloon driver. If --live is specified, only the running guest
876 collection period is affected. If --config is specified, affect the
877 next boot of a persistent guest. If --current is specified, affect
878 the current guest state.
879
880 Both --live and --config flags may be given, but --current is
881 exclusive. If no flag is specified, behavior is different depending
882 on the guest state.
883
884 domblkerror domain
885 Show errors on block devices. This command usually comes handy
886 when domstate command says that a domain was paused due to I/O
887 error. The domblkerror command lists all block devices in error
888 state and the error seen on each of them.
889
890 domblkinfo domain [block-device --all] [--human]
891 Get block device size info for a domain. A block-device
892 corresponds to a unique target name (<target dev='name'/>) or
893 source file (<source file='name'/>) for one of the disk devices
894 attached to domain (see also domblklist for listing these names).
895 If --human is set, the output will have a human readable output.
896 If --all is set, the output will be a table showing all block
897 devices size info associated with domain. The --all option takes
898 precedence of the others.
899
900 domblklist domain [--inactive] [--details]
901 Print a table showing the brief information of all block devices
902 associated with domain. If --inactive is specified, query the block
903 devices that will be used on the next boot, rather than those
904 currently in use by a running domain. If --details is specified,
905 disk type and device value will also be printed. Other contexts
906 that require a block device name (such as domblkinfo or snapshot-
907 create for disk snapshots) will accept either target or unique
908 source names printed by this command.
909
910 domstats [--raw] [--enforce] [--backing] [--nowait] [--state]
911 [--cpu-total] [--balloon] [--vcpu] [--interface] [--block] [--perf]
912 [--iothread] [[--list-active] [--list-inactive] [--list-persistent]
913 [--list-transient] [--list-running] [--list-paused] [--list-shutoff]
914 [--list-other]] | [domain ...]
915 Get statistics for multiple or all domains. Without any argument
916 this command prints all available statistics for all domains.
917
918 The list of domains to gather stats for can be either limited by
919 listing the domains as a space separated list, or by specifying one
920 of the filtering flags --list-*. (The approaches can't be
921 combined.)
922
923 By default some of the returned fields may be converted to more
924 human friendly values by a set of pretty-printers. To suppress this
925 behavior use the --raw flag.
926
927 The individual statistics groups are selectable via specific flags.
928 By default all supported statistics groups are returned. Supported
929 statistics groups flags are: --state, --cpu-total, --balloon,
930 --vcpu, --interface, --block, --perf, --iothread.
931
932 Note that - depending on the hypervisor type and version or the
933 domain state - not all of the following statistics may be returned.
934
935 When selecting the --state group the following fields are returned:
936
937 "state.state" - state of the VM, returned as number from
938 virDomainState enum
939 "state.reason" - reason for entering given state, returned
940 as int from virDomain*Reason enum corresponding
941 to given state
942
943 --cpu-total returns:
944
945 "cpu.time" - total cpu time spent for this domain in nanoseconds
946 "cpu.user" - user cpu time spent in nanoseconds
947 "cpu.system" - system cpu time spent in nanoseconds
948 "cpu.cache.monitor.count" - the number of cache monitors for this
949 domain
950 "cpu.cache.monitor.<num>.name" - the name of cache monitor <num>
951 "cpu.cache.monitor.<num>.vcpus" - vcpu list of cache monitor <num>
952 "cpu.cache.monitor.<num>.bank.count" - the number of cache banks
953 in cache monitor <num>
954 "cpu.cache.monitor.<num>.bank.<index>.id" - host allocated cache id
955 for bank <index> in
956 cache monitor <num>
957 "cpu.cache.monitor.<num>.bank.<index>.bytes" - the number of bytes
958 of last level cache
959 that the domain is
960 using on cache bank
961 <index>
962
963 --balloon returns:
964
965 "balloon.current" - the memory in KiB currently used
966 "balloon.maximum" - the maximum memory in KiB allowed
967 "balloon.swap_in" - the amount of data read from swap space (in KiB)
968 "balloon.swap_out" - the amount of memory written out to swap
969 space (in KiB)
970 "balloon.major_fault" - the number of page faults then disk IO
971 was required
972 "balloon.minor_fault" - the number of other page faults
973 "balloon.unused" - the amount of memory left unused by the
974 system (in KiB)
975 "balloon.available" - the amount of usable memory as seen by
976 the domain (in KiB)
977 "balloon.rss" - Resident Set Size of running domain's process
978 (in KiB)
979 "balloon.usable" - the amount of memory which can be reclaimed by
980 balloon without causing host swapping (in KiB)
981 "balloon.last-update" - timestamp of the last update of statistics
982 (in seconds)
983 "balloon.disk_caches " - the amount of memory that can be reclaimed
984 without additional I/O, typically disk
985 caches (in KiB)
986
987 --vcpu returns:
988
989 "vcpu.current" - current number of online virtual CPUs
990 "vcpu.maximum" - maximum number of online virtual CPUs
991 "vcpu.<num>.state" - state of the virtual CPU <num>, as
992 number from virVcpuState enum
993 "vcpu.<num>.time" - virtual cpu time spent by virtual
994 CPU <num> (in microseconds)
995 "vcpu.<num>.wait" - virtual cpu time spent by virtual
996 CPU <num> waiting on I/O (in microseconds)
997 "vcpu.<num>.halted" - virtual CPU <num> is halted: yes or
998 no (may indicate the processor is idle
999 or even disabled, depending on the
1000 architecture)
1001
1002 --interface returns:
1003
1004 "net.count" - number of network interfaces on this domain
1005 "net.<num>.name" - name of the interface <num>
1006 "net.<num>.rx.bytes" - number of bytes received
1007 "net.<num>.rx.pkts" - number of packets received
1008 "net.<num>.rx.errs" - number of receive errors
1009 "net.<num>.rx.drop" - number of receive packets dropped
1010 "net.<num>.tx.bytes" - number of bytes transmitted
1011 "net.<num>.tx.pkts" - number of packets transmitted
1012 "net.<num>.tx.errs" - number of transmission errors
1013 "net.<num>.tx.drop" - number of transmit packets dropped
1014
1015 --perf returns the statistics of all enabled perf events:
1016
1017 "perf.cmt" - the cache usage in Byte currently used
1018 "perf.mbmt" - total system bandwidth from one level of cache
1019 "perf.mbml" - bandwidth of memory traffic for a memory controller
1020 "perf.cpu_cycles" - the count of cpu cycles (total/elapsed)
1021 "perf.instructions" - the count of instructions
1022 "perf.cache_references" - the count of cache hits
1023 "perf.cache_misses" - the count of caches misses
1024 "perf.branch_instructions" - the count of branch instructions
1025 "perf.branch_misses" - the count of branch misses
1026 "perf.bus_cycles" - the count of bus cycles
1027 "perf.stalled_cycles_frontend" - the count of stalled frontend
1028 cpu cycles
1029 "perf.stalled_cycles_backend" - the count of stalled backend
1030 cpu cycles
1031 "perf.ref_cpu_cycles" - the count of ref cpu cycles
1032 "perf.cpu_clock" - the count of cpu clock time
1033 "perf.task_clock" - the count of task clock time
1034 "perf.page_faults" - the count of page faults
1035 "perf.context_switches" - the count of context switches
1036 "perf.cpu_migrations" - the count of cpu migrations
1037 "perf.page_faults_min" - the count of minor page faults
1038 "perf.page_faults_maj" - the count of major page faults
1039 "perf.alignment_faults" - the count of alignment faults
1040 "perf.emulation_faults" - the count of emulation faults
1041
1042 See the perf command for more details about each event.
1043
1044 --block returns information about disks associated with each
1045 domain. Using the --backing flag extends this information to cover
1046 all resources in the backing chain, rather than the default of
1047 limiting information to the active layer for each guest disk.
1048 Information listed includes:
1049
1050 "block.count" - number of block devices being listed
1051 "block.<num>.name" - name of the target of the block
1052 device <num> (the same name for
1053 multiple entries if I<--backing>
1054 is present)
1055 "block.<num>.backingIndex" - when I<--backing> is present,
1056 matches up with the <backingStore>
1057 index listed in domain XML for
1058 backing files
1059 "block.<num>.path" - file source of block device <num>, if
1060 it is a local file or block device
1061 "block.<num>.rd.reqs" - number of read requests
1062 "block.<num>.rd.bytes" - number of read bytes
1063 "block.<num>.rd.times" - total time (ns) spent on reads
1064 "block.<num>.wr.reqs" - number of write requests
1065 "block.<num>.wr.bytes" - number of written bytes
1066 "block.<num>.wr.times" - total time (ns) spent on writes
1067 "block.<num>.fl.reqs" - total flush requests
1068 "block.<num>.fl.times" - total time (ns) spent on cache flushing
1069 "block.<num>.errors" - Xen only: the 'oo_req' value
1070 "block.<num>.allocation" - offset of highest written sector in bytes
1071 "block.<num>.capacity" - logical size of source file in bytes
1072 "block.<num>.physical" - physical size of source file in bytes
1073 "block.<num>.threshold" - threshold (in bytes) for delivering the
1074 VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD event
1075 See domblkthreshold.
1076
1077 --iothread returns information about IOThreads on the running guest
1078 if supported by the hypervisor.
1079
1080 The "poll-max-ns" for each thread is the maximum nanoseconds to
1081 allow each polling interval to occur. A polling interval is a
1082 period of time allowed for a thread to process data before being
1083 the guest gives up its CPU quantum back to the host. A value set
1084 too small will not allow the IOThread to run long enough on a CPU
1085 to process data. A value set too high will consume too much CPU
1086 time per IOThread failing to allow other threads running on the CPU
1087 to get time. The polling interval is not available for statistical
1088 purposes.
1089
1090 "iothread.<id>.poll-max-ns" - maximum polling time in nanoseconds used
1091 by the <id> IOThread. A value of 0 (zero)
1092 indicates polling is disabled.
1093 "iothread.<id>.poll-grow" - polling time grow value. A value of 0 (zero)
1094 indicates growth is managed by the hypervisor.
1095 "iothread.<id>.poll-shrink" - polling time shrink value. A value of
1096 0 (zero) indicates shrink is managed by
1097 the hypervisor.
1098
1099 Selecting a specific statistics groups doesn't guarantee that the
1100 daemon supports the selected group of stats. Flag --enforce forces
1101 the command to fail if the daemon doesn't support the selected
1102 group.
1103
1104 When collecting stats libvirtd may wait for some time if there's
1105 already another job running on given domain for it to finish. This
1106 may cause unnecessary delay in delivering stats. Using --nowait
1107 suppresses this behaviour. On the other hand some statistics might
1108 be missing for such domain.
1109
1110 domiflist domain [--inactive]
1111 Print a table showing the brief information of all virtual
1112 interfaces associated with domain. If --inactive is specified,
1113 query the virtual interfaces that will be used on the next boot,
1114 rather than those currently in use by a running domain. Other
1115 contexts that require a MAC address of virtual interface (such as
1116 detach-interface or domif-setlink) will accept the MAC address
1117 printed by this command.
1118
1119 blockcommit domain path [bandwidth] [--bytes] [base] [--shallow] [top]
1120 [--delete] [--keep-relative] [--wait [--async] [--verbose]] [--timeout
1121 seconds] [--active] [{--pivot | --keep-overlay}]
1122 Reduce the length of a backing image chain, by committing changes
1123 at the top of the chain (snapshot or delta files) into backing
1124 images. By default, this command attempts to flatten the entire
1125 chain. If base and/or top are specified as files within the
1126 backing chain, then the operation is constrained to committing just
1127 that portion of the chain; --shallow can be used instead of base to
1128 specify the immediate backing file of the resulting top image to be
1129 committed. The files being committed are rendered invalid,
1130 possibly as soon as the operation starts; using the --delete flag
1131 will attempt to remove these invalidated files at the successful
1132 completion of the commit operation. When the --keep-relative flag
1133 is used, the backing file paths will be kept relative.
1134
1135 When top is omitted or specified as the active image, it is also
1136 possible to specify --active to trigger a two-phase active commit.
1137 In the first phase, top is copied into base and the job can only be
1138 canceled, with top still containing data not yet in base. In the
1139 second phase, top and base remain identical until a call to
1140 blockjob with the --abort flag (keeping top as the active image
1141 that tracks changes from that point in time) or the --pivot flag
1142 (making base the new active image and invalidating top).
1143
1144 By default, this command returns as soon as possible, and data for
1145 the entire disk is committed in the background; the progress of the
1146 operation can be checked with blockjob. However, if --wait is
1147 specified, then this command will block until the operation
1148 completes (or for --active, enters the second phase), or until the
1149 operation is canceled because the optional timeout in seconds
1150 elapses or SIGINT is sent (usually with "Ctrl-C"). Using --verbose
1151 along with --wait will produce periodic status updates. If job
1152 cancellation is triggered, --async will return control to the user
1153 as fast as possible, otherwise the command may continue to block a
1154 little while longer until the job is done cleaning up. Using
1155 --pivot is shorthand for combining --active --wait with an
1156 automatic blockjob --pivot; and using --keep-overlay is shorthand
1157 for combining --active --wait with an automatic blockjob --abort.
1158
1159 path specifies fully-qualified path of the disk; it corresponds to
1160 a unique target name (<target dev='name'/>) or source file (<source
1161 file='name'/>) for one of the disk devices attached to domain (see
1162 also domblklist for listing these names). bandwidth specifies
1163 copying bandwidth limit in MiB/s, although for qemu, it may be non-
1164 zero only for an online domain. For further information on the
1165 bandwidth argument see the corresponding section for the blockjob
1166 command.
1167
1168 blockcopy domain path { dest [format] [--blockdev] | --xml file }
1169 [--shallow] [--reuse-external] [bandwidth] [--wait [--async]
1170 [--verbose]] [{--pivot | --finish}] [--timeout seconds] [granularity]
1171 [buf-size] [--bytes] [--transient-job]
1172 Copy a disk backing image chain to a destination. Either dest as
1173 the destination file name, or --xml with the name of an XML file
1174 containing a top-level <disk> element describing the destination,
1175 must be present. Additionally, if dest is given, format should be
1176 specified to declare the format of the destination (if format is
1177 omitted, then libvirt will reuse the format of the source, or with
1178 --reuse-external will be forced to probe the destination format,
1179 which could be a potential security hole). The command supports
1180 --raw as a boolean flag synonym for --format=raw. When using dest,
1181 the destination is treated as a regular file unless --blockdev is
1182 used to signal that it is a block device. By default, this command
1183 flattens the entire chain; but if --shallow is specified, the copy
1184 shares the backing chain.
1185
1186 If --reuse-external is specified, then the destination must exist
1187 and have sufficient space to hold the copy. If --shallow is used in
1188 conjunction with --reuse-external then the pre-created image must
1189 have guest visible contents identical to guest visible contents of
1190 the backing file of the original image. This may be used to modify
1191 the backing file names on the destination.
1192
1193 By default, the copy job runs in the background, and consists of
1194 two phases. Initially, the job must copy all data from the source,
1195 and during this phase, the job can only be canceled to revert back
1196 to the source disk, with no guarantees about the destination.
1197 After this phase completes, both the source and the destination
1198 remain mirrored until a call to blockjob with the --abort and
1199 --pivot flags pivots over to the copy, or a call without --pivot
1200 leaves the destination as a faithful copy of that point in time.
1201 However, if --wait is specified, then this command will block until
1202 the mirroring phase begins, or cancel the operation if the optional
1203 timeout in seconds elapses or SIGINT is sent (usually with
1204 "Ctrl-C"). Using --verbose along with --wait will produce periodic
1205 status updates. Using --pivot (similar to blockjob --pivot) or
1206 --finish (similar to blockjob --abort) implies --wait, and will
1207 additionally end the job cleanly rather than leaving things in the
1208 mirroring phase. If job cancellation is triggered by timeout or by
1209 --finish, --async will return control to the user as fast as
1210 possible, otherwise the command may continue to block a little
1211 while longer until the job has actually cancelled.
1212
1213 path specifies fully-qualified path of the disk. bandwidth
1214 specifies copying bandwidth limit in MiB/s. Specifying a negative
1215 value is interpreted as an unsigned long long value that might be
1216 essentially unlimited, but more likely would overflow; it is safer
1217 to use 0 for that purpose. For further information on the bandwidth
1218 argument see the corresponding section for the blockjob command.
1219 Specifying granularity allows fine-tuning of the granularity that
1220 will be copied when a dirty region is detected; larger values
1221 trigger less I/O overhead but may end up copying more data overall
1222 (the default value is usually correct); hypervisors may restrict
1223 this to be a power of two or fall within a certain range.
1224 Specifying buf-size will control how much data can be
1225 simultaneously in-flight during the copy; larger values use more
1226 memory but may allow faster completion (the default value is
1227 usually correct).
1228
1229 --transient-job allows to specify that the user does not require
1230 the job to be recovered if the VM crashes or is turned off before
1231 the job completes. This flag removes the restriction of copy jobs
1232 to transient domains if that restriction is applied by the
1233 hypervisor.
1234
1235 blockpull domain path [bandwidth] [--bytes] [base] [--wait [--verbose]
1236 [--timeout seconds] [--async]] [--keep-relative]
1237 Populate a disk from its backing image chain. By default, this
1238 command flattens the entire chain; but if base is specified,
1239 containing the name of one of the backing files in the chain, then
1240 that file becomes the new backing file and only the intermediate
1241 portion of the chain is pulled. Once all requested data from the
1242 backing image chain has been pulled, the disk no longer depends on
1243 that portion of the backing chain.
1244
1245 By default, this command returns as soon as possible, and data for
1246 the entire disk is pulled in the background; the progress of the
1247 operation can be checked with blockjob. However, if --wait is
1248 specified, then this command will block until the operation
1249 completes, or cancel the operation if the optional timeout in
1250 seconds elapses or SIGINT is sent (usually with "Ctrl-C"). Using
1251 --verbose along with --wait will produce periodic status updates.
1252 If job cancellation is triggered, --async will return control to
1253 the user as fast as possible, otherwise the command may continue to
1254 block a little while longer until the job is done cleaning up.
1255
1256 Using the --keep-relative flag will keep the backing chain names
1257 relative.
1258
1259 path specifies fully-qualified path of the disk; it corresponds to
1260 a unique target name (<target dev='name'/>) or source file (<source
1261 file='name'/>) for one of the disk devices attached to domain (see
1262 also domblklist for listing these names). bandwidth specifies
1263 copying bandwidth limit in MiB/s. For further information on the
1264 bandwidth argument see the corresponding section for the blockjob
1265 command.
1266
1267 blkdeviotune domain device [[--config] [--live] | [--current]] [[total-
1268 bytes-sec] | [read-bytes-sec] [write-bytes-sec]] [[total-iops-sec] |
1269 [read-iops-sec] [write-iops-sec]] [[total-bytes-sec-max] | [read-bytes-
1270 sec-max] [write-bytes-sec-max]] [[total-iops-sec-max] | [read-iops-sec-
1271 max] [write-iops-sec-max]] [[total-bytes-sec-max-length] | [read-bytes-
1272 sec-max-length] [write-bytes-sec-max-length]] [[total-iops-sec-max-
1273 length] | [read-iops-sec-max-length] [write-iops-sec-max-length]]
1274 [size-iops-sec] [group-name]
1275 Set or query the block disk io parameters for a block device of
1276 domain. device specifies a unique target name (<target
1277 dev='name'/>) or source file (<source file='name'/>) for one of the
1278 disk devices attached to domain (see also domblklist for listing
1279 these names).
1280
1281 If no limit is specified, it will query current I/O limits setting.
1282 Otherwise, alter the limits with these flags: --total-bytes-sec
1283 specifies total throughput limit as a scaled integer, the default
1284 being bytes per second if no suffix is specified. --read-bytes-sec
1285 specifies read throughput limit as a scaled integer, the default
1286 being bytes per second if no suffix is specified.
1287 --write-bytes-sec specifies write throughput limit as a scaled
1288 integer, the default being bytes per second if no suffix is
1289 specified. --total-iops-sec specifies total I/O operations limit
1290 per second. --read-iops-sec specifies read I/O operations limit
1291 per second. --write-iops-sec specifies write I/O operations limit
1292 per second. --total-bytes-sec-max specifies maximum total
1293 throughput limit as a scaled integer, the default being bytes per
1294 second if no suffix is specified --read-bytes-sec-max specifies
1295 maximum read throughput limit as a scaled integer, the default
1296 being bytes per second if no suffix is specified.
1297 --write-bytes-sec-max specifies maximum write throughput limit as a
1298 scaled integer, the default being bytes per second if no suffix is
1299 specified. --total-iops-sec-max specifies maximum total I/O
1300 operations limit per second. --read-iops-sec-max specifies maximum
1301 read I/O operations limit per second. --write-iops-sec-max
1302 specifies maximum write I/O operations limit per second.
1303 --total-bytes-sec-max-length specifies duration in seconds to allow
1304 maximum total throughput limit. --read-bytes-sec-max-length
1305 specifies duration in seconds to allow maximum read throughput
1306 limit. --write-bytes-sec-max-length specifies duration in seconds
1307 to allow maximum write throughput limit.
1308 --total-iops-sec-max-length specifies duration in seconds to allow
1309 maximum total I/O operations limit. --read-iops-sec-max-length
1310 specifies duration in seconds to allow maximum read I/O operations
1311 limit. --write-iops-sec-max-length specifies duration in seconds
1312 to allow maximum write I/O operations limit. --size-iops-sec
1313 specifies size I/O operations limit per second. --group-name
1314 specifies group name to share I/O quota between multiple drives.
1315 For a qemu domain, if no name is provided, then the default is to
1316 have a single group for each device.
1317
1318 Older versions of virsh only accepted these options with underscore
1319 instead of dash, as in --total_bytes_sec.
1320
1321 Bytes and iops values are independent, but setting only one value
1322 (such as --read-bytes-sec) resets the other two in that category to
1323 unlimited. An explicit 0 also clears any limit. A non-zero value
1324 for a given total cannot be mixed with non-zero values for read or
1325 write.
1326
1327 It is up to the hypervisor to determine how to handle the length
1328 values. For the qemu hypervisor, if an I/O limit value or maximum
1329 value is set, then the default value of 1 second will be displayed.
1330 Supplying a 0 will reset the value back to the default.
1331
1332 If --live is specified, affect a running guest. If --config is
1333 specified, affect the next boot of a persistent guest. If
1334 --current is specified, affect the current guest state. When
1335 setting the disk io parameters both --live and --config flags may
1336 be given, but --current is exclusive. For querying only one of
1337 --live, --config or --current can be specified. If no flag is
1338 specified, behavior is different depending on hypervisor.
1339
1340 blockjob domain path { [--abort] [--async] [--pivot] | [--info] [--raw]
1341 [--bytes] | [bandwidth] }
1342 Manage active block operations. There are three mutually-exclusive
1343 modes: --info, bandwidth, and --abort. --async and --pivot imply
1344 abort mode; --raw implies info mode; and if no mode was given,
1345 --info mode is assumed.
1346
1347 path specifies fully-qualified path of the disk; it corresponds to
1348 a unique target name (<target dev='name'/>) or source file (<source
1349 file='name'/>) for one of the disk devices attached to domain (see
1350 also domblklist for listing these names).
1351
1352 In --abort mode, the active job on the specified disk will be
1353 aborted. If --async is also specified, this command will return
1354 immediately, rather than waiting for the cancellation to complete.
1355 If --pivot is specified, this requests that an active copy or
1356 active commit job be pivoted over to the new image.
1357
1358 In --info mode, the active job information on the specified disk
1359 will be printed. By default, the output is a single human-readable
1360 summary line; this format may change in future versions. Adding
1361 --raw lists each field of the struct, in a stable format. If the
1362 --bytes flag is set, then the command errors out if the server
1363 could not supply bytes/s resolution; when omitting the flag, raw
1364 output is listed in MiB/s and human-readable output automatically
1365 selects the best resolution supported by the server.
1366
1367 bandwidth can be used to set bandwidth limit for the active job in
1368 MiB/s. If --bytes is specified then the bandwidth value is
1369 interpreted in bytes/s. Specifying a negative value is interpreted
1370 as an unsigned long value or essentially unlimited. The hypervisor
1371 can choose whether to reject the value or convert it to the maximum
1372 value allowed. Optionally a scaled positive number may be used as
1373 bandwidth (see NOTES above). Using --bytes with a scaled value
1374 allows to use finer granularity. A scaled value used without
1375 --bytes will be rounded down to MiB/s. Note that the --bytes may be
1376 unsupported by the hypervisor.
1377
1378 domblkthreshold domain dev threshold
1379 Set the threshold value for delivering the block-threshold event.
1380 dev specifies the disk device target or backing chain element of
1381 given device using the 'target[1]' syntax. threshold is a scaled
1382 value of the offset. If the block device should write beyond that
1383 offset the event will be delivered.
1384
1385 blockresize domain path size
1386 Resize a block device of domain while the domain is running, path
1387 specifies the absolute path of the block device; it corresponds to
1388 a unique target name (<target dev='name'/>) or source file (<source
1389 file='name'/>) for one of the disk devices attached to domain (see
1390 also domblklist for listing these names).
1391
1392 size is a scaled integer (see NOTES above) which defaults to KiB
1393 (blocks of 1024 bytes) if there is no suffix. You must use a
1394 suffix of "B" to get bytes (note that for historical reasons, this
1395 differs from vol-resize which defaults to bytes without a suffix).
1396
1397 domdisplay domain [--include-password] [[--type] type] [--all]
1398 Output a URI which can be used to connect to the graphical display
1399 of the domain via VNC, SPICE or RDP. The particular graphical
1400 display type can be selected using the type parameter (e.g. "vnc",
1401 "spice", "rdp"). If --include-password is specified, the SPICE
1402 channel password will be included in the URI. If --all is
1403 specified, then all show all possible graphical displays, for a VM
1404 could have more than one graphical displays.
1405
1406 domfsinfo domain
1407 Show a list of mounted filesystems within the running domain. The
1408 list contains mountpoints, names of a mounted device in the guest,
1409 filesystem types, and unique target names used in the domain XML
1410 (<target dev='name'/>).
1411
1412 Note that this command requires a guest agent configured and
1413 running in the domain's guest OS.
1414
1415 domfsfreeze domain [[--mountpoint] mountpoint...]
1416 Freeze mounted filesystems within a running domain to prepare for
1417 consistent snapshots.
1418
1419 The --mountpoint option takes a parameter mountpoint, which is a
1420 mount point path of the filesystem to be frozen. This option can
1421 occur multiple times. If this is not specified, every mounted
1422 filesystem is frozen.
1423
1424 Note: snapshot-create command has a --quiesce option to freeze and
1425 thaw the filesystems automatically to keep snapshots consistent.
1426 domfsfreeze command is only needed when a user wants to utilize the
1427 native snapshot features of storage devices not supported by
1428 libvirt.
1429
1430 domfsthaw domain [[--mountpoint] mountpoint...]
1431 Thaw mounted filesystems within a running domain, which have been
1432 frozen by domfsfreeze command.
1433
1434 The --mountpoint option takes a parameter mountpoint, which is a
1435 mount point path of the filesystem to be thawed. This option can
1436 occur multiple times. If this is not specified, every mounted
1437 filesystem is thawed.
1438
1439 domfstrim domain [--minimum bytes] [--mountpoint mountPoint]
1440 Issue a fstrim command on all mounted filesystems within a running
1441 domain. It discards blocks which are not in use by the filesystem.
1442 If --minimum bytes is specified, it tells guest kernel length of
1443 contiguous free range. Smaller than this may be ignored (this is a
1444 hint and the guest may not respect it). By increasing this value,
1445 the fstrim operation will complete more quickly for filesystems
1446 with badly fragmented free space, although not all blocks will be
1447 discarded. The default value is zero, meaning "discard every free
1448 block". Moreover, if a user wants to trim only one mount point, it
1449 can be specified via optional --mountpoint parameter.
1450
1451 domhostname domain
1452 Returns the hostname of a domain, if the hypervisor makes it
1453 available.
1454
1455 dominfo domain
1456 Returns basic information about the domain.
1457
1458 domuuid domain-name-or-id
1459 Convert a domain name or id to domain UUID
1460
1461 domid domain-name-or-uuid
1462 Convert a domain name (or UUID) to a domain id
1463
1464 domjobabort domain
1465 Abort the currently running domain job.
1466
1467 domjobinfo domain [--completed]
1468 Returns information about jobs running on a domain. --completed
1469 tells virsh to return information about a recently finished job.
1470 Statistics of a completed job are automatically destroyed once read
1471 or when libvirtd is restarted. Note that time information returned
1472 for completed migrations may be completely irrelevant unless both
1473 source and destination hosts have synchronized time (i.e., NTP
1474 daemon is running on both of them).
1475
1476 domname domain-id-or-uuid
1477 Convert a domain Id (or UUID) to domain name
1478
1479 domrename domain new-name
1480 Rename a domain. This command changes current domain name to the
1481 new name specified in the second argument.
1482
1483 Note: Domain must be inactive and without snapshots.
1484
1485 domstate domain [--reason]
1486 Returns state about a domain. --reason tells virsh to also print
1487 reason for the state.
1488
1489 domcontrol domain
1490 Returns state of an interface to VMM used to control a domain. For
1491 states other than "ok" or "error" the command also prints number of
1492 seconds elapsed since the control interface entered its current
1493 state.
1494
1495 domtime domain { [--now] [--pretty] [--sync] [--time time] }
1496 Gets or sets the domain's system time. When run without any
1497 arguments (but domain), the current domain's system time is printed
1498 out. The --pretty modifier can be used to print the time in more
1499 human readable form.
1500
1501 When --time time is specified, the domain's time is not gotten but
1502 set instead. The --now modifier acts like if it was an alias for
1503 --time $now, which means it sets the time that is currently on the
1504 host virsh is running at. In both cases (setting and getting), time
1505 is in seconds relative to Epoch of 1970-01-01 in UTC. The --sync
1506 modifies the set behavior a bit: The time passed is ignored, but
1507 the time to set is read from domain's RTC instead. Please note,
1508 that some hypervisors may require a guest agent to be configured in
1509 order to get or set the guest time.
1510
1511 domxml-from-native format config
1512 Convert the file config in the native guest configuration format
1513 named by format to a domain XML format. For QEMU/KVM hypervisor,
1514 the format argument must be qemu-argv. For Xen hypervisor, the
1515 format argument may be xen-xm, xen-xl, or xen-sxpr. For LXC
1516 hypervisor, the format argument must be lxc-tools.
1517
1518 domxml-to-native format { [--xml] xml | --domain domain-name-or-id-or-
1519 uuid }
1520 Convert the file xml into domain XML format or convert an existing
1521 --domain to the native guest configuration format named by format.
1522 The xml and --domain arguments are mutually exclusive.
1523
1524 For the QEMU/KVM hypervisor, the format argument must be qemu-argv.
1525
1526 For the Xen hypervisor, the format argument may be xen-xm, xen-xl,
1527 or xen-sxpr.
1528
1529 For the LXC hypervisor, the format argument must be lxc-tools.
1530
1531 dump domain corefilepath [--bypass-cache] { [--live] | [--crash] |
1532 [--reset] } [--verbose] [--memory-only] [--format string]
1533 Dumps the core of a domain to a file for analysis. If --live is
1534 specified, the domain continues to run until the core dump is
1535 complete, rather than pausing up front. If --crash is specified,
1536 the domain is halted with a crashed status, rather than merely left
1537 in a paused state. If --reset is specified, the domain is reset
1538 after successful dump. Note, these three switches are mutually
1539 exclusive. If --bypass-cache is specified, the save will avoid the
1540 file system cache, although this may slow down the operation. If
1541 --memory-only is specified, the file is elf file, and will only
1542 include domain's memory and cpu common register value. It is very
1543 useful if the domain uses host devices directly. --format string
1544 is used to specify the format of 'memory-only' dump, and string can
1545 be one of them: elf, kdump-zlib(kdump-compressed format with zlib-
1546 compressed), kdump-lzo(kdump-compressed format with lzo-
1547 compressed), kdump-snappy(kdump-compressed format with snappy-
1548 compressed).
1549
1550 The progress may be monitored using domjobinfo virsh command and
1551 canceled with domjobabort command (sent by another virsh instance).
1552 Another option is to send SIGINT (usually with "Ctrl-C") to the
1553 virsh process running dump command. --verbose displays the progress
1554 of dump.
1555
1556 NOTE: Some hypervisors may require the user to manually ensure
1557 proper permissions on file and path specified by argument
1558 corefilepath.
1559
1560 NOTE: Crash dump in a old kvmdump format is being obsolete and
1561 cannot be loaded and processed by crash utility since its version
1562 6.1.0. A --memory-only option is required in order to produce valid
1563 ELF file which can be later processed by the crash utility.
1564
1565 dumpxml domain [--inactive] [--security-info] [--update-cpu]
1566 [--migratable]
1567 Output the domain information as an XML dump to stdout, this format
1568 can be used by the create command. Additional options affecting the
1569 XML dump may be used. --inactive tells virsh to dump domain
1570 configuration that will be used on next start of the domain as
1571 opposed to the current domain configuration. Using --security-info
1572 will also include security sensitive information in the XML dump.
1573 --update-cpu updates domain CPU requirements according to host CPU.
1574 With --migratable one can request an XML that is suitable for
1575 migrations, i.e., compatible with older libvirt releases and
1576 possibly amended with internal run-time options. This option may
1577 automatically enable other options (--update-cpu, --security-info,
1578 ...) as necessary.
1579
1580 edit domain
1581 Edit the XML configuration file for a domain, which will affect the
1582 next boot of the guest.
1583
1584 This is equivalent to:
1585
1586 virsh dumpxml --inactive --security-info domain > domain.xml
1587 vi domain.xml (or make changes with your other text editor)
1588 virsh define domain.xml
1589
1590 except that it does some error checking.
1591
1592 The editor used can be supplied by the $VISUAL or $EDITOR
1593 environment variables, and defaults to "vi".
1594
1595 event {[domain] { event | --all } [--loop] [--timeout seconds]
1596 [--timestamp] | --list}
1597 Wait for a class of domain events to occur, and print appropriate
1598 details of events as they happen. The events can optionally be
1599 filtered by domain. Using --list as the only argument will provide
1600 a list of possible event values known by this client, although the
1601 connection might not allow registering for all these events. It is
1602 also possible to use --all instead of event to register for all
1603 possible event types at once.
1604
1605 By default, this command is one-shot, and returns success once an
1606 event occurs; you can send SIGINT (usually via "Ctrl-C") to quit
1607 immediately. If --timeout is specified, the command gives up
1608 waiting for events after seconds have elapsed. With --loop, the
1609 command prints all events until a timeout or interrupt key.
1610
1611 When --timestamp is used, a human-readable timestamp will be
1612 printed before the event.
1613
1614 iothreadinfo domain [[--live] [--config] | [--current]]
1615 Display basic domain IOThreads information including the IOThread
1616 ID and the CPU Affinity for each IOThread.
1617
1618 If --live is specified, get the IOThreads data from the running
1619 guest. If the guest is not running, an error is returned. If
1620 --config is specified, get the IOThreads data from the next boot of
1621 a persistent guest. If --current is specified or --live and
1622 --config are not specified, then get the IOThread data based on the
1623 current guest state.
1624
1625 iothreadpin domain iothread cpulist [[--live] [--config] | [--current]]
1626 Change the pinning of a domain IOThread to host physical CPUs. In
1627 order to retrieve a list of all IOThreads, use iothreadinfo. To pin
1628 an iothread specify the cpulist desired for the IOThread ID as
1629 listed in the iothreadinfo output.
1630
1631 cpulist is a list of physical CPU numbers. Its syntax is a comma
1632 separated list and a special markup using '-' and '^' (ex. '0-4',
1633 '0-3,^2') can also be allowed. The '-' denotes the range and the
1634 '^' denotes exclusive. If you want to reset iothreadpin setting,
1635 that is, to pin an iothread to all physical cpus, simply specify
1636 'r' as a cpulist.
1637
1638 If --live is specified, affect a running guest. If the guest is not
1639 running, an error is returned. If --config is specified, affect
1640 the next boot of a persistent guest. If --current is specified or
1641 --live and --config are not specified, affect the current guest
1642 state. Both --live and --config flags may be given if cpulist is
1643 present, but --current is exclusive. If no flag is specified,
1644 behavior is different depending on hypervisor.
1645
1646 Note: The expression is sequentially evaluated, so "0-15,^8" is
1647 identical to "9-14,0-7,15" but not identical to "^8,0-15".
1648
1649 iothreadadd domain iothread_id [[--config] [--live] | [--current]]
1650 Add a new IOThread to the domain using the specified iothread_id.
1651 If the iothread_id already exists, the command will fail. The
1652 iothread_id must be greater than zero.
1653
1654 If --live is specified, affect a running guest. If the guest is not
1655 running an error is returned. If --config is specified, affect the
1656 next boot of a persistent guest. If --current is specified or
1657 --live and --config are not specified, affect the current guest
1658 state.
1659
1660 iothreadset domain iothread_id [[--poll-max-ns ns] [--poll-grow factor]
1661 [--poll-shrink divisor]] [[--config] [--live] | [--current]]
1662 Modifies an existing iothread of the domain using the specified
1663 iothread_id. The --poll-max-ns provides the maximum polling
1664 interval to be allowed for an IOThread in ns. If a 0 (zero) is
1665 provided, then polling for the IOThread is disabled. The
1666 --poll-grow is the factor by which the current polling time will be
1667 adjusted in order to reach the maximum polling time. If a 0 (zero)
1668 is provided, then the default factor will be used. The
1669 --poll-shrink is the quotient by which the current polling time
1670 will be reduced in order to get below the maximum polling interval.
1671 If a 0 (zero) is provided, then the default quotient will be used.
1672
1673 If --live is specified, affect a running guest. If the guest is not
1674 running an error is returned. If --current is specified or --live
1675 is not specified, then handle as if --live was specified.
1676
1677 iothreaddel domain iothread_id [[--config] [--live] | [--current]]
1678 Delete an IOThread from the domain using the specified iothread_id.
1679 If an IOThread is currently assigned to a disk resource such as via
1680 the attach-disk command, then the attempt to remove the IOThread
1681 will fail. If the iothread_id does not exist an error will occur.
1682
1683 If --live is specified, affect a running guest. If the guest is not
1684 running an error is returned. If --config is specified, affect the
1685 next boot of a persistent guest. If --current is specified or
1686 --live and --config are not specified, affect the current guest
1687 state.
1688
1689 managedsave domain [--bypass-cache] [{--running | --paused}]
1690 [--verbose]
1691 Save and destroy (stop) a running domain, so it can be restarted
1692 from the same state at a later time. When the virsh start command
1693 is next run for the domain, it will automatically be started from
1694 this saved state. If --bypass-cache is specified, the save will
1695 avoid the file system cache, although this may slow down the
1696 operation.
1697
1698 The progress may be monitored using domjobinfo virsh command and
1699 canceled with domjobabort command (sent by another virsh instance).
1700 Another option is to send SIGINT (usually with "Ctrl-C") to the
1701 virsh process running managedsave command. --verbose displays the
1702 progress of save.
1703
1704 Normally, starting a managed save will decide between running or
1705 paused based on the state the domain was in when the save was done;
1706 passing either the --running or --paused flag will allow overriding
1707 which state the start should use.
1708
1709 The dominfo command can be used to query whether a domain currently
1710 has any managed save image.
1711
1712 managedsave-remove domain
1713 Remove the managedsave state file for a domain, if it exists. This
1714 ensures the domain will do a full boot the next time it is started.
1715
1716 managedsave-define domain xml [{--running | --paused}]
1717 Update the domain XML that will be used when domain is later
1718 started. The xml argument must be a file name containing the
1719 alternative XML, with changes only in the host-specific portions of
1720 the domain XML. For example, it can be used to change disk file
1721 paths.
1722
1723 The managed save image records whether the domain should be started
1724 to a running or paused state. Normally, this command does not
1725 alter the recorded state; passing either the --running or --paused
1726 flag will allow overriding which state the start should use.
1727
1728 managedsave-dumpxml domain [--security-info]
1729 Extract the domain XML that was in effect at the time the saved
1730 state file file was created with the managedsave command. Using
1731 --security-info will also include security sensitive information.
1732
1733 managedsave-edit domain [{--running | --paused}]
1734 Edit the XML configuration associated with a saved state file of a
1735 domain was created by the managedsave command.
1736
1737 The managed save image records whether the domain should be started
1738 to a running or paused state. Normally, this command does not
1739 alter the recorded state; passing either the --running or --paused
1740 flag will allow overriding which state the restore should use.
1741
1742 This is equivalent to:
1743
1744 virsh managedsave-dumpxml domain-name > state-file.xml
1745 vi state-file.xml (or make changes with your other text editor)
1746 virsh managedsave-define domain-name state-file-xml
1747
1748 except that it does some error checking.
1749
1750 The editor used can be supplied by the $VISUAL or $EDITOR
1751 environment variables, and defaults to "vi".
1752
1753 maxvcpus [type]
1754 Provide the maximum number of virtual CPUs supported for a guest VM
1755 on this connection. If provided, the type parameter must be a
1756 valid type attribute for the <domain> element of XML.
1757
1758 cpu-stats domain [--total] [start] [count]
1759 Provide cpu statistics information of a domain. The domain should
1760 be running. Default it shows stats for all CPUs, and a total. Use
1761 --total for only the total stats, start for only the per-cpu stats
1762 of the CPUs from start, count for only count CPUs' stats.
1763
1764 metadata domain [[--live] [--config] | [--current]] [--edit] [uri]
1765 [key] [set] [--remove]
1766 Show or modify custom XML metadata of a domain. The metadata is a
1767 user defined XML that allows to store arbitrary XML data in the
1768 domain definition. Multiple separate custom metadata pieces can be
1769 stored in the domain XML. The pieces are identified by a private
1770 XML namespace provided via the uri argument. (See also desc that
1771 works with textual metadata of a domain.)
1772
1773 Flags --live or --config select whether this command works on live
1774 or persistent definitions of the domain. If both --live and
1775 --config are specified, the --config option takes precedence on
1776 getting the current description and both live configuration and
1777 config are updated while setting the description. --current is
1778 exclusive and implied if none of these was specified.
1779
1780 Flag --remove specifies that the metadata element specified by the
1781 uri argument should be removed rather than updated.
1782
1783 Flag --edit specifies that an editor with the metadata identified
1784 by the uri argument should be opened and the contents saved back
1785 afterwards. Otherwise the new contents can be provided via the set
1786 argument.
1787
1788 When setting metadata via --edit or set the key argument must be
1789 specified and is used to prefix the custom elements to bind them to
1790 the private namespace.
1791
1792 If neither of --edit and set are specified the XML metadata
1793 corresponding to the uri namespace is displayed instead of being
1794 modified.
1795
1796 migrate [--live] [--offline] [--direct] [--p2p [--tunnelled]]
1797 [--persistent] [--undefinesource] [--suspend] [--copy-storage-all]
1798 [--copy-storage-inc] [--change-protection] [--unsafe] [--verbose]
1799 [--rdma-pin-all] [--abort-on-error] [--postcopy]
1800 [--postcopy-after-precopy] domain desturi [migrateuri] [graphicsuri]
1801 [listen-address] [dname] [--timeout seconds [--timeout-suspend |
1802 --timeout-postcopy]] [--xml file] [--migrate-disks disk-list]
1803 [--disks-port port] [--compressed] [--comp-methods method-list]
1804 [--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads]
1805 [--comp-xbzrle-cache] [--auto-converge] [auto-converge-initial] [auto-
1806 converge-increment] [--persistent-xml file] [--tls]
1807 [--postcopy-bandwidth bandwidth]
1808 Migrate domain to another host. Add --live for live migration;
1809 <--p2p> for peer-2-peer migration; --direct for direct migration;
1810 or --tunnelled for tunnelled migration. --offline migrates domain
1811 definition without starting the domain on destination and without
1812 stopping it on source host. Offline migration may be used with
1813 inactive domains and it must be used with --persistent option.
1814 --persistent leaves the domain persistent on destination host,
1815 --undefinesource undefines the domain on the source host, and
1816 --suspend leaves the domain paused on the destination host.
1817 --copy-storage-all indicates migration with non-shared storage with
1818 full disk copy, --copy-storage-inc indicates migration with non-
1819 shared storage with incremental copy (same base image shared
1820 between source and destination). In both cases the disk images
1821 have to exist on destination host, the --copy-storage-... options
1822 only tell libvirt to transfer data from the images on source host
1823 to the images found at the same place on the destination host. By
1824 default only non-shared non-readonly images are transferred. Use
1825 --migrate-disks to explicitly specify a list of disk targets to
1826 transfer via the comma separated disk-list argument.
1827 --change-protection enforces that no incompatible configuration
1828 changes will be made to the domain while the migration is underway;
1829 this flag is implicitly enabled when supported by the hypervisor,
1830 but can be explicitly used to reject the migration if the
1831 hypervisor lacks change protection support. --verbose displays the
1832 progress of migration. --abort-on-error cancels the migration if a
1833 soft error (for example I/O error) happens during the migration.
1834 --postcopy enables post-copy logic in migration, but does not
1835 actually start post-copy, i.e., migration is started in pre-copy
1836 mode. Once migration is running, the user may switch to post-copy
1837 using the migrate-postcopy command sent from another virsh instance
1838 or use --postcopy-after-precopy along with --postcopy to let
1839 libvirt automatically switch to post-copy after the first pass of
1840 pre-copy is finished. The maximum bandwidth consumed during the
1841 post-copy phase may be limited using --postcopy-bandwidth.
1842
1843 --auto-converge forces convergence during live migration. The
1844 initial guest CPU throttling rate can be set with auto-converge-
1845 initial. If the initial throttling rate is not enough to ensure
1846 convergence, the rate is periodically increased by auto-converge-
1847 increment.
1848
1849 --rdma-pin-all can be used with RDMA migration (i.e., when
1850 migrateuri starts with rdma://) to tell the hypervisor to pin all
1851 domain's memory at once before migration starts rather than letting
1852 it pin memory pages as needed. For QEMU/KVM this requires
1853 hard_limit memory tuning element (in the domain XML) to be used and
1854 set to the maximum memory configured for the domain plus any memory
1855 consumed by the QEMU process itself. Beware of setting the memory
1856 limit too high (and thus allowing the domain to lock most of the
1857 host's memory). Doing so may be dangerous to both the domain and
1858 the host itself since the host's kernel may run out of memory.
1859
1860 Note: Individual hypervisors usually do not support all possible
1861 types of migration. For example, QEMU does not support direct
1862 migration.
1863
1864 In some cases libvirt may refuse to migrate the domain because
1865 doing so may lead to potential problems such as data corruption,
1866 and thus the migration is considered unsafe. For QEMU domain, this
1867 may happen if the domain uses disks without explicitly setting
1868 cache mode to "none". Migrating such domains is unsafe unless the
1869 disk images are stored on coherent clustered filesystem, such as
1870 GFS2 or GPFS. If you are sure the migration is safe or you just do
1871 not care, use --unsafe to force the migration.
1872
1873 dname is used for renaming the domain to new name during migration,
1874 which also usually can be omitted. Likewise, --xml file is usually
1875 omitted, but can be used to supply an alternative XML file for use
1876 on the destination to supply a larger set of changes to any host-
1877 specific portions of the domain XML, such as accounting for naming
1878 differences between source and destination in accessing underlying
1879 storage. If --persistent is enabled, --persistent-xml file can be
1880 used to supply an alternative XML file which will be used as the
1881 persistent domain definition on the destination host.
1882
1883 --timeout seconds tells virsh to run a specified action when live
1884 migration exceeds that many seconds. It can only be used with
1885 --live. If --timeout-suspend is specified, the domain will be
1886 suspended after the timeout and the migration will complete
1887 offline; this is the default if no --timeout-* option is specified
1888 on the command line. When --timeout-postcopy is used, virsh will
1889 switch migration from pre-copy to post-copy upon timeout; migration
1890 has to be started with --postcopy option for this to work.
1891
1892 --compressed activates compression, the compression method is
1893 chosen with --comp-methods. Supported methods are "mt" and "xbzrle"
1894 and can be used in any combination. When no methods are specified,
1895 a hypervisor default methods will be used. QEMU defaults to
1896 "xbzrle". Compression methods can be tuned further. --comp-mt-level
1897 sets compression level. Values are in range from 0 to 9, where 1
1898 is maximum speed and 9 is maximum compression. --comp-mt-threads
1899 and --comp-mt-dthreads set the number of compress threads on source
1900 and the number of decompress threads on target respectively.
1901 --comp-xbzrle-cache sets size of page cache in bytes.
1902
1903 Providing --tls causes the migration to use the host configured TLS
1904 setup (see migrate_tls_x509_cert_dir in /etc/libvirt/qemu.conf) in
1905 order to perform the migration of the domain. Usage requires proper
1906 TLS setup for both source and target.
1907
1908 Running migration can be canceled by interrupting virsh (usually
1909 using "Ctrl-C") or by domjobabort command sent from another virsh
1910 instance.
1911
1912 The desturi and migrateuri parameters can be used to control which
1913 destination the migration uses. desturi is important for managed
1914 migration, but unused for direct migration; migrateuri is required
1915 for direct migration, but can usually be automatically determined
1916 for managed migration.
1917
1918 Note: The desturi parameter for normal migration and peer2peer
1919 migration has different semantics:
1920
1921 · normal migration: the desturi is an address of the target host
1922 as seen from the client machine.
1923
1924 · peer2peer migration: the desturi is an address of the target
1925 host as seen from the source machine.
1926
1927 When migrateuri is not specified, libvirt will automatically
1928 determine the hypervisor specific URI. Some hypervisors, including
1929 QEMU, have an optional "migration_host" configuration parameter
1930 (useful when the host has multiple network interfaces). If this is
1931 unspecified, libvirt determines a name by looking up the target
1932 host's configured hostname.
1933
1934 There are a few scenarios where specifying migrateuri may help:
1935
1936 · The configured hostname is incorrect, or DNS is broken. If a
1937 host has a hostname which will not resolve to match one of its
1938 public IP addresses, then libvirt will generate an incorrect
1939 URI. In this case migrateuri should be explicitly specified,
1940 using an IP address, or a correct hostname.
1941
1942 · The host has multiple network interfaces. If a host has
1943 multiple network interfaces, it might be desirable for the
1944 migration data stream to be sent over a specific interface for
1945 either security or performance reasons. In this case
1946 migrateuri should be explicitly specified, using an IP address
1947 associated with the network to be used.
1948
1949 · The firewall restricts what ports are available. When libvirt
1950 generates a migration URI, it will pick a port number using
1951 hypervisor specific rules. Some hypervisors only require a
1952 single port to be open in the firewalls, while others require a
1953 whole range of port numbers. In the latter case migrateuri
1954 might be specified to choose a specific port number outside the
1955 default range in order to comply with local firewall policies.
1956
1957 See <https://libvirt.org/migration.html#uris> for more details on
1958 migration URIs.
1959
1960 Optional graphicsuri overrides connection parameters used for
1961 automatically reconnecting a graphical clients at the end of
1962 migration. If omitted, libvirt will compute the parameters based on
1963 target host IP address. In case the client does not have a direct
1964 access to the network virtualization hosts are connected to and
1965 needs to connect through a proxy, graphicsuri may be used to
1966 specify the address the client should connect to. The URI is formed
1967 as follows:
1968
1969 protocol://hostname[:port]/[?parameters]
1970
1971 where protocol is either "spice" or "vnc" and parameters is a list
1972 of protocol specific parameters separated by '&'. Currently
1973 recognized parameters are "tlsPort" and "tlsSubject". For example,
1974
1975 spice://target.host.com:1234/?tlsPort=4567
1976
1977 Optional listen-address sets the listen address that hypervisor on
1978 the destination side should bind to for incoming migration. Both
1979 IPv4 and IPv6 addresses are accepted as well as hostnames (the
1980 resolving is done on destination). Some hypervisors do not support
1981 this feature and will return an error if this parameter is used.
1982
1983 Optional disks-port sets the port that hypervisor on destination
1984 side should bind to for incoming disks traffic. Currently it is
1985 supported only by qemu.
1986
1987 migrate-setmaxdowntime domain downtime
1988 Set maximum tolerable downtime for a domain which is being live-
1989 migrated to another host. The downtime is a number of milliseconds
1990 the guest is allowed to be down at the end of live migration.
1991
1992 migrate-getmaxdowntime domain
1993 Get the maximum tolerable downtime for a domain which is being
1994 live-migrated to another host. This is the number of milliseconds
1995 the guest is allowed to be down at the end of live migration.
1996
1997 migrate-compcache domain [--size bytes]
1998 Sets and/or gets size of the cache (in bytes) used for compressing
1999 repeatedly transferred memory pages during live migration. When
2000 called without size, the command just prints current size of the
2001 compression cache. When size is specified, the hypervisor is asked
2002 to change compression cache to size bytes and then the current size
2003 is printed (the result may differ from the requested size due to
2004 rounding done by the hypervisor). The size option is supposed to be
2005 used while the domain is being live-migrated as a reaction to
2006 migration progress and increasing number of compression cache
2007 misses obtained from domjobinfo.
2008
2009 migrate-setspeed domain bandwidth [--postcopy]
2010 Set the maximum migration bandwidth (in MiB/s) for a domain which
2011 is being migrated to another host. bandwidth is interpreted as an
2012 unsigned long long value. Specifying a negative value results in an
2013 essentially unlimited value being provided to the hypervisor. The
2014 hypervisor can choose whether to reject the value or convert it to
2015 the maximum value allowed. If the --postcopy option is specified,
2016 the command will set the maximum bandwidth allowed during a post-
2017 copy migration phase.
2018
2019 migrate-getspeed domain [--postcopy]
2020 Get the maximum migration bandwidth (in MiB/s) for a domain. If the
2021 --postcopy option is specified, the command will get the maximum
2022 bandwidth allowed during a post-copy migration phase.
2023
2024 migrate-postcopy domain
2025 Switch the current migration from pre-copy to post-copy. This is
2026 only supported for a migration started with --postcopy option.
2027
2028 numatune domain [--mode mode] [--nodeset nodeset] [[--config] [--live]
2029 | [--current]]
2030 Set or get a domain's numa parameters, corresponding to the
2031 <numatune> element of domain XML. Without flags, the current
2032 settings are displayed.
2033
2034 mode can be one of `strict', `interleave' and `preferred' or any
2035 valid number from the virDomainNumatuneMemMode enum in case the
2036 daemon supports it. For a running domain, the mode can't be
2037 changed, and the nodeset can be changed only if the domain was
2038 started with a mode of `strict'.
2039
2040 nodeset is a list of numa nodes used by the host for running the
2041 domain. Its syntax is a comma separated list, with '-' for ranges
2042 and '^' for excluding a node.
2043
2044 If --live is specified, set scheduler information of a running
2045 guest. If --config is specified, affect the next boot of a
2046 persistent guest. If --current is specified, affect the current
2047 guest state.
2048
2049 reboot domain [--mode MODE-LIST]
2050 Reboot a domain. This acts just as if the domain had the reboot
2051 command run from the console. The command returns as soon as it
2052 has executed the reboot action, which may be significantly before
2053 the domain actually reboots.
2054
2055 The exact behavior of a domain when it reboots is set by the
2056 on_reboot parameter in the domain's XML definition.
2057
2058 By default the hypervisor will try to pick a suitable shutdown
2059 method. To specify an alternative method, the --mode parameter can
2060 specify a comma separated list which includes "acpi", "agent",
2061 "initctl", "signal" and "paravirt". The order in which drivers will
2062 try each mode is undefined, and not related to the order specified
2063 to virsh. For strict control over ordering, use a single mode at a
2064 time and repeat the command.
2065
2066 reset domain
2067 Reset a domain immediately without any guest shutdown. reset
2068 emulates the power reset button on a machine, where all guest
2069 hardware sees the RST line set and reinitializes internal state.
2070
2071 Note: Reset without any guest OS shutdown risks data loss.
2072
2073 restore state-file [--bypass-cache] [--xml file] [{--running |
2074 --paused}]
2075 Restores a domain from a virsh save state file. See save for more
2076 info.
2077
2078 If --bypass-cache is specified, the restore will avoid the file
2079 system cache, although this may slow down the operation.
2080
2081 --xml file is usually omitted, but can be used to supply an
2082 alternative XML file for use on the restored guest with changes
2083 only in the host-specific portions of the domain XML. For example,
2084 it can be used to account for file naming differences in underlying
2085 storage due to disk snapshots taken after the guest was saved.
2086
2087 Normally, restoring a saved image will use the state recorded in
2088 the save image to decide between running or paused; passing either
2089 the --running or --paused flag will allow overriding which state
2090 the domain should be started in.
2091
2092 Note: To avoid corrupting file system contents within the domain,
2093 you should not reuse the saved state file for a second restore
2094 unless you have also reverted all storage volumes back to the same
2095 contents as when the state file was created.
2096
2097 save domain state-file [--bypass-cache] [--xml file] [{--running |
2098 --paused}] [--verbose]
2099 Saves a running domain (RAM, but not disk state) to a state file so
2100 that it can be restored later. Once saved, the domain will no
2101 longer be running on the system, thus the memory allocated for the
2102 domain will be free for other domains to use. virsh restore
2103 restores from this state file. If --bypass-cache is specified, the
2104 save will avoid the file system cache, although this may slow down
2105 the operation.
2106
2107 The progress may be monitored using domjobinfo virsh command and
2108 canceled with domjobabort command (sent by another virsh instance).
2109 Another option is to send SIGINT (usually with "Ctrl-C") to the
2110 virsh process running save command. --verbose displays the progress
2111 of save.
2112
2113 This is roughly equivalent to doing a hibernate on a running
2114 computer, with all the same limitations. Open network connections
2115 may be severed upon restore, as TCP timeouts may have expired.
2116
2117 --xml file is usually omitted, but can be used to supply an
2118 alternative XML file for use on the restored guest with changes
2119 only in the host-specific portions of the domain XML. For example,
2120 it can be used to account for file naming differences that are
2121 planned to be made via disk snapshots of underlying storage after
2122 the guest is saved.
2123
2124 Normally, restoring a saved image will decide between running or
2125 paused based on the state the domain was in when the save was done;
2126 passing either the --running or --paused flag will allow overriding
2127 which state the restore should use.
2128
2129 Domain saved state files assume that disk images will be unchanged
2130 between the creation and restore point. For a more complete system
2131 restore point, where the disk state is saved alongside the memory
2132 state, see the snapshot family of commands.
2133
2134 save-image-define file xml [{--running | --paused}]
2135 Update the domain XML that will be used when file is later used in
2136 the restore command. The xml argument must be a file name
2137 containing the alternative XML, with changes only in the host-
2138 specific portions of the domain XML. For example, it can be used
2139 to account for file naming differences resulting from creating disk
2140 snapshots of underlying storage after the guest was saved.
2141
2142 The save image records whether the domain should be restored to a
2143 running or paused state. Normally, this command does not alter the
2144 recorded state; passing either the --running or --paused flag will
2145 allow overriding which state the restore should use.
2146
2147 save-image-dumpxml file [--security-info]
2148 Extract the domain XML that was in effect at the time the saved
2149 state file file was created with the save command. Using
2150 --security-info will also include security sensitive information.
2151
2152 save-image-edit file [{--running | --paused}]
2153 Edit the XML configuration associated with a saved state file file
2154 created by the save command.
2155
2156 The save image records whether the domain should be restored to a
2157 running or paused state. Normally, this command does not alter the
2158 recorded state; passing either the --running or --paused flag will
2159 allow overriding which state the restore should use.
2160
2161 This is equivalent to:
2162
2163 virsh save-image-dumpxml state-file > state-file.xml
2164 vi state-file.xml (or make changes with your other text editor)
2165 virsh save-image-define state-file state-file-xml
2166
2167 except that it does some error checking.
2168
2169 The editor used can be supplied by the $VISUAL or $EDITOR
2170 environment variables, and defaults to "vi".
2171
2172 schedinfo domain [[--config] [--live] | [--current]] [[--set]
2173 parameter=value]...
2174 schedinfo [--weight number] [--cap number] domain
2175 Allows you to show (and set) the domain scheduler parameters. The
2176 parameters available for each hypervisor are:
2177
2178 LXC (posix scheduler) : cpu_shares, vcpu_period, vcpu_quota
2179
2180 QEMU/KVM (posix scheduler): cpu_shares, vcpu_period, vcpu_quota,
2181 emulator_period, emulator_quota, iothread_quota, iothread_period
2182
2183 Xen (credit scheduler): weight, cap
2184
2185 ESX (allocation scheduler): reservation, limit, shares
2186
2187 If --live is specified, set scheduler information of a running
2188 guest. If --config is specified, affect the next boot of a
2189 persistent guest. If --current is specified, affect the current
2190 guest state.
2191
2192 Note: The cpu_shares parameter has a valid value range of 0-262144;
2193 Negative values are wrapped to positive, and larger values are
2194 capped at the maximum. Therefore, -1 is a useful shorthand for
2195 262144. On the Linux kernel, the values 0 and 1 are automatically
2196 converted to a minimal value of 2.
2197
2198 Note: The weight and cap parameters are defined only for the
2199 XEN_CREDIT scheduler.
2200
2201 Note: The vcpu_period, emulator_period, and iothread_period
2202 parameters have a valid value range of 1000-1000000 or 0, and the
2203 vcpu_quota, emulator_quota, and iothread_quota parameters have a
2204 valid value range of 1000-18446744073709551 or less than 0. The
2205 value 0 for either parameter is the same as not specifying that
2206 parameter.
2207
2208 screenshot domain [imagefilepath] [--screen screenID]
2209 Takes a screenshot of a current domain console and stores it into a
2210 file. Optionally, if hypervisor supports more displays for a
2211 domain, screenID allows to specify which screen will be captured.
2212 It is the sequential number of screen. In case of multiple graphics
2213 cards, heads are enumerated before devices, e.g. having two
2214 graphics cards, both with four heads, screen ID 5 addresses the
2215 second head on the second card.
2216
2217 send-key domain [--codeset codeset] [--holdtime holdtime] keycode...
2218 Parse the keycode sequence as keystrokes to send to domain. Each
2219 keycode can either be a numeric value or a symbolic name from the
2220 corresponding codeset. If --holdtime is given, each keystroke will
2221 be held for that many milliseconds. The default codeset is linux,
2222 but use of the --codeset option allows other codesets to be chosen.
2223
2224 If multiple keycodes are specified, they are all sent
2225 simultaneously to the guest, and they may be received in random
2226 order. If you need distinct keypresses, you must use multiple send-
2227 key invocations.
2228
2229 linux
2230 The numeric values are those defined by the Linux generic input
2231 event subsystem. The symbolic names match the corresponding
2232 Linux key constant macro names.
2233
2234 See virkeycode-linux(7) and virkeyname-linux(7)
2235
2236 xt The numeric values are those defined by the original XT
2237 keyboard controller. No symbolic names are provided
2238
2239 See virkeycode-xt(7)
2240
2241 atset1
2242 The numeric values are those defined by the AT keyboard
2243 controller, set 1 (aka XT compatible set). Extended keycoes
2244 from atset1 may differ from extended keycodes in the xt
2245 codeset. No symbolic names are provided
2246
2247 See virkeycode-atset1(7)
2248
2249 atset2
2250 The numeric values are those defined by the AT keyboard
2251 controller, set 2. No symbolic names are provided
2252
2253 See virkeycode-atset2(7)
2254
2255 atset3
2256 The numeric values are those defined by the AT keyboard
2257 controller, set 3 (aka PS/2 compatible set). No symbolic names
2258 are provided
2259
2260 See virkeycode-atset3(7)
2261
2262 os_x
2263 The numeric values are those defined by the OS-X keyboard input
2264 subsystem. The symbolic names match the corresponding OS-X key
2265 constant macro names
2266
2267 See virkeycode-osx(7) and virkeyname-osx(7)
2268
2269 xt_kbd
2270 The numeric values are those defined by the Linux KBD device.
2271 These are a variant on the original XT codeset, but often with
2272 different encoding for extended keycodes. No symbolic names are
2273 provided.
2274
2275 See virkeycode-xtkbd(7)
2276
2277 win32
2278 The numeric values are those defined by the Win32 keyboard
2279 input subsystem. The symbolic names match the corresponding
2280 Win32 key constant macro names
2281
2282 See virkeycode-win32(7) and virkeyname-win32(7)
2283
2284 usb The numeric values are those defined by the USB HID
2285 specification for keyboard input. No symbolic names are
2286 provided
2287
2288 See virkeycode-usb(7)
2289
2290 qnum
2291 The numeric values are those defined by the QNUM extension for
2292 sending raw keycodes. These are a variant on the XT codeset,
2293 but extended keycodes have the low bit of the second byte set,
2294 instead of the high bit of the first byte. No symbolic names
2295 are provided.
2296
2297 See virkeycode-qnum(7)
2298
2299 Examples
2300 # send three strokes 'k', 'e', 'y', using xt codeset. these
2301 # are all pressed simultaneously and may be received by the guest
2302 # in random order
2303 virsh send-key dom --codeset xt 37 18 21
2304
2305 # send one stroke 'right-ctrl+C'
2306 virsh send-key dom KEY_RIGHTCTRL KEY_C
2307
2308 # send a tab, held for 1 second
2309 virsh send-key --holdtime 1000 0xf
2310
2311 send-process-signal domain-id pid signame
2312 Send a signal signame to the process identified by pid running in
2313 the virtual domain domain-id. The pid is a process ID in the
2314 virtual domain namespace.
2315
2316 The signame argument may be either an integer signal constant
2317 number, or one of the symbolic names:
2318
2319 "nop", "hup", "int", "quit", "ill",
2320 "trap", "abrt", "bus", "fpe", "kill",
2321 "usr1", "segv", "usr2", "pipe", "alrm",
2322 "term", "stkflt", "chld", "cont", "stop",
2323 "tstp", "ttin", "ttou", "urg", "xcpu",
2324 "xfsz", "vtalrm", "prof", "winch", "poll",
2325 "pwr", "sys", "rt0", "rt1", "rt2", "rt3",
2326 "rt4", "rt5", "rt6", "rt7", "rt8", "rt9",
2327 "rt10", "rt11", "rt12", "rt13", "rt14", "rt15",
2328 "rt16", "rt17", "rt18", "rt19", "rt20", "rt21",
2329 "rt22", "rt23", "rt24", "rt25", "rt26", "rt27",
2330 "rt28", "rt29", "rt30", "rt31", "rt32"
2331
2332 The symbol name may optionally be prefixed with 'sig' or 'sig_' and
2333 may be in uppercase or lowercase.
2334
2335 Examples
2336 virsh send-process-signal myguest 1 15
2337 virsh send-process-signal myguest 1 term
2338 virsh send-process-signal myguest 1 sigterm
2339 virsh send-process-signal myguest 1 SIG_HUP
2340
2341 setmem domain size [[--config] [--live] | [--current]]
2342 Change the memory allocation for a guest domain. If --live is
2343 specified, perform a memory balloon of a running guest. If
2344 --config is specified, affect the next boot of a persistent guest.
2345 If --current is specified, affect the current guest state. Both
2346 --live and --config flags may be given, but --current is exclusive.
2347 If no flag is specified, behavior is different depending on
2348 hypervisor.
2349
2350 size is a scaled integer (see NOTES above); it defaults to
2351 kibibytes (blocks of 1024 bytes) unless you provide a suffix (and
2352 the older option name --kilobytes is available as a deprecated
2353 synonym) . Libvirt rounds up to the nearest kibibyte. Some
2354 hypervisors require a larger granularity than KiB, and requests
2355 that are not an even multiple will be rounded up. For example,
2356 vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
2357
2358 For Xen, you can only adjust the memory of a running domain if the
2359 domain is paravirtualized or running the PV balloon driver.
2360
2361 For LXC, the value being set is the cgroups value for
2362 limit_in_bytes or the maximum amount of user memory (including file
2363 cache). When viewing memory inside the container, this is the
2364 /proc/meminfo "MemTotal" value. When viewing the value from the
2365 host, use the virsh memtune command. In order to view the current
2366 memory in use and the maximum value allowed to set memory, use the
2367 virsh dominfo command.
2368
2369 set-lifecycle-action domain type action [[--config] [--live] |
2370 [--current]]
2371 Set the lifecycle action for specified lifecycle type. The valid
2372 types are "poweroff", "reboot" and "crash", and for each of them
2373 valid action is one of "destroy", "restart", "rename-restart",
2374 "preserve". For type "crash", additional actions "coredump-
2375 destroy" and "coredump-restart" are supported.
2376
2377 set-user-password domain user password [--encrypted]
2378 Set the password for the user account in the guest domain.
2379
2380 If --encrypted is specified, the password is assumed to be already
2381 encrypted by the method required by the guest OS.
2382
2383 For QEMU/KVM, this requires the guest agent to be configured and
2384 running.
2385
2386 setmaxmem domain size [[--config] [--live] | [--current]]
2387 Change the maximum memory allocation limit for a guest domain. If
2388 --live is specified, affect a running guest. If --config is
2389 specified, affect the next boot of a persistent guest. If
2390 --current is specified, affect the current guest state. Both
2391 --live and --config flags may be given, but --current is exclusive.
2392 If no flag is specified, behavior is different depending on
2393 hypervisor.
2394
2395 Some hypervisors such as QEMU/KVM don't support live changes
2396 (especially increasing) of the maximum memory limit. Even
2397 persistent configuration changes might not be performed with some
2398 hypervisors/configuration (e.g. on NUMA enabled domains on QEMU).
2399 For complex configuration changes use command edit instead).
2400
2401 size is a scaled integer (see NOTES above); it defaults to
2402 kibibytes (blocks of 1024 bytes) unless you provide a suffix (and
2403 the older option name --kilobytes is available as a deprecated
2404 synonym) . Libvirt rounds up to the nearest kibibyte. Some
2405 hypervisors require a larger granularity than KiB, and requests
2406 that are not an even multiple will be rounded up. For example,
2407 vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
2408
2409 memtune domain [--hard-limit size] [--soft-limit size]
2410 [--swap-hard-limit size] [--min-guarantee size] [[--config] [--live] |
2411 [--current]]
2412 Allows you to display or set the domain memory parameters. Without
2413 flags, the current settings are displayed; with a flag, the
2414 appropriate limit is adjusted if supported by the hypervisor. LXC
2415 and QEMU/KVM support --hard-limit, --soft-limit, and
2416 --swap-hard-limit. --min-guarantee is supported only by ESX
2417 hypervisor. Each of these limits are scaled integers (see NOTES
2418 above), with a default of kibibytes (blocks of 1024 bytes) if no
2419 suffix is present. Libvirt rounds up to the nearest kibibyte. Some
2420 hypervisors require a larger granularity than KiB, and requests
2421 that are not an even multiple will be rounded up. For example,
2422 vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
2423
2424 If --live is specified, affect a running guest. If --config is
2425 specified, affect the next boot of a persistent guest. If
2426 --current is specified, affect the current guest state. Both
2427 --live and --config flags may be given, but --current is exclusive.
2428 If no flag is specified, behavior is different depending on
2429 hypervisor.
2430
2431 For QEMU/KVM, the parameters are applied to the QEMU process as a
2432 whole. Thus, when counting them, one needs to add up guest RAM,
2433 guest video RAM, and some memory overhead of QEMU itself. The last
2434 piece is hard to determine so one needs guess and try.
2435
2436 For LXC, the displayed hard_limit value is the current memory
2437 setting from the XML or the results from a virsh setmem command.
2438
2439 --hard-limit
2440 The maximum memory the guest can use.
2441
2442 --soft-limit
2443 The memory limit to enforce during memory contention.
2444
2445 --swap-hard-limit
2446 The maximum memory plus swap the guest can use. This has to be
2447 more than hard-limit value provided.
2448
2449 --min-guarantee
2450 The guaranteed minimum memory allocation for the guest.
2451
2452 Specifying -1 as a value for these limits is interpreted as
2453 unlimited.
2454
2455 perf domain [--enable eventSpec] [--disable eventSpec] [[--config]
2456 [--live] | [--current]]
2457 Get the current perf events setting or enable/disable specific perf
2458 events for a guest domain.
2459
2460 Perf is a performance analyzing tool in Linux, and it can
2461 instrument CPU performance counters, tracepoints, kprobes, and
2462 uprobes (dynamic tracing). Perf supports a list of measurable
2463 events, and can measure events coming from different sources. For
2464 instance, some event are pure kernel counters, in this case they
2465 are called software events, including context-switches, minor-
2466 faults, etc.. Now dozens of events from different sources can be
2467 supported by perf.
2468
2469 Currently only QEMU/KVM supports this command. The --enable and
2470 --disable option combined with eventSpec can be used to enable or
2471 disable specific performance event. eventSpec is a string list of
2472 one or more events separated by commas. Valid event names are as
2473 follows:
2474
2475 Valid perf event names
2476 cmt - A PQos (Platform Qos) feature to monitor the
2477 usage of cache by applications running on the
2478 platform.
2479 mbmt - Provides a way to monitor the total system
2480 memory bandwidth between one level of cache
2481 and another.
2482 mbml - Provides a way to limit the amount of data
2483 (bytes/s) send through the memory controller
2484 on the socket.
2485 cache_misses - Provides the count of cache misses by
2486 applications running on the platform.
2487 cache_references - Provides the count of cache hits by
2488 applications running on th e platform.
2489 instructions - Provides the count of instructions executed
2490 by applications running on the platform.
2491 cpu_cycles - Provides the count of cpu cycles
2492 (total/elapsed). May be used with
2493 instructions in order to get a cycles
2494 per instruction.
2495 branch_instructions - Provides the count of branch instructions
2496 executed by applications running on the
2497 platform.
2498 branch_misses - Provides the count of branch misses executed
2499 by applications running on the platform.
2500 bus_cycles - Provides the count of bus cycles executed
2501 by applications running on the platform.
2502 stalled_cycles_frontend - Provides the count of stalled cpu
2503 cycles in the frontend of the
2504 instruction processor pipeline by
2505 applications running on the platform.
2506 stalled_cycles_backend - Provides the count of stalled cpu
2507 cycles in the backend of the
2508 instruction processor pipeline by
2509 applications running on the platform.
2510 ref_cpu_cycles - Provides the count of total cpu cycles
2511 not affected by CPU frequency scaling by
2512 applications running on the platform.
2513 cpu_clock - Provides the cpu clock time consumed by
2514 applications running on the platform.
2515 task_clock - Provides the task clock time consumed by
2516 applications running on the platform.
2517 page_faults - Provides the count of page faults by
2518 applications running on the platform.
2519 context_switches - Provides the count of context switches
2520 by applications running on the platform.
2521 cpu_migrations - Provides the count cpu migrations by
2522 applications running on the platform.
2523 page_faults_min - Provides the count minor page faults
2524 by applications running on the platform.
2525 page_faults_maj - Provides the count major page faults
2526 by applications running on the platform.
2527 alignment_faults - Provides the count alignment faults
2528 by applications running on the platform.
2529 emulation_faults - Provides the count emulation faults
2530 by applications running on the platform.
2531
2532 Note: The statistics can be retrieved using the domstats command
2533 using the --perf flag.
2534
2535 If --live is specified, affect a running guest. If --config is
2536 specified, affect the next boot of a persistent guest. If
2537 --current is specified, affect the current guest state. Both
2538 --live and --config flags may be given, but --current is exclusive.
2539 If no flag is specified, behavior is different depending on
2540 hypervisor.
2541
2542 blkiotune domain [--weight weight] [--device-weights device-weights]
2543 [--device-read-iops-sec device-read-iops-sec] [--device-write-iops-sec
2544 device-write-iops-sec] [--device-read-bytes-sec device-read-bytes-sec]
2545 [--device-write-bytes-sec device-write-bytes-sec] [[--config] [--live]
2546 | [--current]]
2547 Display or set the blkio parameters. QEMU/KVM supports --weight.
2548 --weight is in range [100, 1000]. After kernel 2.6.39, the value
2549 could be in the range [10, 1000].
2550
2551 device-weights is a single string listing one or more device/weight
2552 pairs, in the format of
2553 /path/to/device,weight,/path/to/device,weight. Each weight is in
2554 the range [100, 1000], [10, 1000] after kernel 2.6.39, or the value
2555 0 to remove that device from per-device listings. Only the devices
2556 listed in the string are modified; any existing per-device weights
2557 for other devices remain unchanged.
2558
2559 device-read-iops-sec is a single string listing one or more
2560 device/read_iops_sec pairs, int the format of
2561 /path/to/device,read_iops_sec,/path/to/device,read_iops_sec. Each
2562 read_iops_sec is a number which type is unsigned int, value 0 to
2563 remove that device from per-device listing. Only the devices
2564 listed in the string are modified; any existing per-device
2565 read_iops_sec for other devices remain unchanged.
2566
2567 device-write-iops-sec is a single string listing one or more
2568 device/write_iops_sec pairs, int the format of
2569 /path/to/device,write_iops_sec,/path/to/device,write_iops_sec.
2570 Each write_iops_sec is a number which type is unsigned int, value 0
2571 to remove that device from per-device listing. Only the devices
2572 listed in the string are modified; any existing per-device
2573 write_iops_sec for other devices remain unchanged.
2574
2575 device-read-bytes-sec is a single string listing one or more
2576 device/read_bytes_sec pairs, int the format of
2577 /path/to/device,read_bytes_sec,/path/to/device,read_bytes_sec.
2578 Each read_bytes_sec is a number which type is unsigned long long,
2579 value 0 to remove that device from per-device listing. Only the
2580 devices listed in the string are modified; any existing per-device
2581 read_bytes_sec for other devices remain unchanged.
2582
2583 device-write-bytes-sec is a single string listing one or more
2584 device/write_bytes_sec pairs, int the format of
2585 /path/to/device,write_bytes_sec,/path/to/device,write_bytes_sec.
2586 Each write_bytes_sec is a number which type is unsigned long long,
2587 value 0 to remove that device from per-device listing. Only the
2588 devices listed in the string are modified; any existing per-device
2589 write_bytes_sec for other devices remain unchanged.
2590
2591 If --live is specified, affect a running guest. If --config is
2592 specified, affect the next boot of a persistent guest. If
2593 --current is specified, affect the current guest state. Both
2594 --live and --config flags may be given, but --current is exclusive.
2595 If no flag is specified, behavior is different depending on
2596 hypervisor.
2597
2598 setvcpus domain count [--maximum] [[--config] [--live] | [--current]]
2599 [--guest] [--hotpluggable]
2600 Change the number of virtual CPUs active in a guest domain. By
2601 default, this command works on active guest domains. To change the
2602 settings for an inactive guest domain, use the --config flag.
2603
2604 The count value may be limited by host, hypervisor, or a limit
2605 coming from the original description of the guest domain. For Xen,
2606 you can only adjust the virtual CPUs of a running domain if the
2607 domain is paravirtualized.
2608
2609 If the --config flag is specified, the change is made to the stored
2610 XML configuration for the guest domain, and will only take effect
2611 when the guest domain is next started.
2612
2613 If --live is specified, the guest domain must be active, and the
2614 change takes place immediately. Both the --config and --live flags
2615 may be specified together if supported by the hypervisor. If this
2616 command is run before the guest has finished booting, the guest may
2617 fail to process the change.
2618
2619 If --current is specified, affect the current guest state.
2620
2621 When no flags are given, the --live flag is assumed and the guest
2622 domain must be active. In this situation it is up to the
2623 hypervisor whether the --config flag is also assumed, and therefore
2624 whether the XML configuration is adjusted to make the change
2625 persistent.
2626
2627 If --guest is specified, then the count of cpus is modified in the
2628 guest instead of the hypervisor. This flag is usable only for live
2629 domains and may require guest agent to be configured in the guest.
2630
2631 To allow adding vcpus to persistent definitions that can be later
2632 hotunplugged after the domain is booted it is necessary to specify
2633 the --hotpluggable flag. Vcpus added to live domains supporting
2634 vcpu unplug are automatically marked as hotpluggable.
2635
2636 The --maximum flag controls the maximum number of virtual cpus that
2637 can be hot-plugged the next time the domain is booted. As such, it
2638 must only be used with the --config flag, and not with the --live
2639 or the --current flag. Note that it may not be possible to change
2640 the maximum vcpu count if the processor topology is specified for
2641 the guest.
2642
2643 setvcpu domain vcpulist [--enable] | [--disable] [[--live] [--config] |
2644 [--current]]
2645 Change state of individual vCPUs using hot(un)plug mechanism.
2646
2647 See vcpupin for information on format of vcpulist. Hypervisor
2648 drivers may require that vcpulist contains exactly vCPUs belonging
2649 to one hotpluggable entity. This is usually just a single vCPU but
2650 certain architectures such as ppc64 require a full core to be
2651 specified at once.
2652
2653 Note that hypervisors may refuse to disable certain vcpus such as
2654 vcpu 0 or others.
2655
2656 If --live is specified, affect a running domain. If --config is
2657 specified, affect the next startup of a persistent domain. If
2658 --current is specified, affect the current domain state. This is
2659 the default. Both --live and --config flags may be given, but
2660 --current is exclusive.
2661
2662 shutdown domain [--mode MODE-LIST]
2663 Gracefully shuts down a domain. This coordinates with the domain
2664 OS to perform graceful shutdown, so there is no guarantee that it
2665 will succeed, and may take a variable length of time depending on
2666 what services must be shutdown in the domain.
2667
2668 The exact behavior of a domain when it shuts down is set by the
2669 on_poweroff parameter in the domain's XML definition.
2670
2671 If domain is transient, then the metadata of any snapshots will be
2672 lost once the guest stops running, but the snapshot contents still
2673 exist, and a new domain with the same name and UUID can restore the
2674 snapshot metadata with snapshot-create.
2675
2676 By default the hypervisor will try to pick a suitable shutdown
2677 method. To specify an alternative method, the --mode parameter can
2678 specify a comma separated list which includes "acpi", "agent",
2679 "initctl", "signal" and "paravirt". The order in which drivers will
2680 try each mode is undefined, and not related to the order specified
2681 to virsh. For strict control over ordering, use a single mode at a
2682 time and repeat the command.
2683
2684 start domain-name-or-uuid [--console] [--paused] [--autodestroy]
2685 [--bypass-cache] [--force-boot] [--pass-fds N,M,...]
2686 Start a (previously defined) inactive domain, either from the last
2687 managedsave state, or via a fresh boot if no managedsave state is
2688 present. The domain will be paused if the --paused option is used
2689 and supported by the driver; otherwise it will be running. If
2690 --console is requested, attach to the console after creation. If
2691 --autodestroy is requested, then the guest will be automatically
2692 destroyed when virsh closes its connection to libvirt, or otherwise
2693 exits. If --bypass-cache is specified, and managedsave state
2694 exists, the restore will avoid the file system cache, although this
2695 may slow down the operation. If --force-boot is specified, then
2696 any managedsave state is discarded and a fresh boot occurs.
2697
2698 If --pass-fds is specified, the argument is a comma separated list
2699 of open file descriptors which should be pass on into the guest.
2700 The file descriptors will be re-numbered in the guest, starting
2701 from 3. This is only supported with container based virtualization.
2702
2703 suspend domain
2704 Suspend a running domain. It is kept in memory but won't be
2705 scheduled anymore.
2706
2707 resume domain
2708 Moves a domain out of the suspended state. This will allow a
2709 previously suspended domain to now be eligible for scheduling by
2710 the underlying hypervisor.
2711
2712 dompmsuspend domain target [--duration]
2713 Suspend a running domain into one of these states (possible target
2714 values):
2715 mem equivalent of S3 ACPI state
2716 disk equivalent of S4 ACPI state
2717 hybrid RAM is saved to disk but not powered off
2718
2719 The --duration argument specifies number of seconds before the
2720 domain is woken up after it was suspended (see also dompmwakeup).
2721 Default is 0 for unlimited suspend time. (This feature isn't
2722 currently supported by any hypervisor driver and 0 should be
2723 used.).
2724
2725 Note that this command requires a guest agent configured and
2726 running in the domain's guest OS.
2727
2728 Beware that at least for QEMU, the domain's process will be
2729 terminated when target disk is used and a new process will be
2730 launched when libvirt is asked to wake up the domain. As a result
2731 of this, any runtime changes, such as device hotplug or memory
2732 settings, are lost unless such changes were made with --config
2733 flag.
2734
2735 dompmwakeup domain
2736 Wakeup a domain from pmsuspended state (either suspended by
2737 dompmsuspend or from the guest itself). Injects a wakeup into the
2738 guest that is in pmsuspended state, rather than waiting for the
2739 previously requested duration (if any) to elapse. This operation
2740 doesn't not necessarily fail if the domain is running.
2741
2742 ttyconsole domain
2743 Output the device used for the TTY console of the domain. If the
2744 information is not available the processes will provide an exit
2745 code of 1.
2746
2747 undefine domain [--managed-save] [--snapshots-metadata] [--nvram]
2748 [--keep-nvram] [ {--storage volumes | --remove-all-storage
2749 [--delete-snapshots]} --wipe-storage]
2750 Undefine a domain. If the domain is running, this converts it to a
2751 transient domain, without stopping it. If the domain is inactive,
2752 the domain configuration is removed.
2753
2754 The --managed-save flag guarantees that any managed save image (see
2755 the managedsave command) is also cleaned up. Without the flag,
2756 attempts to undefine a domain with a managed save image will fail.
2757
2758 The --snapshots-metadata flag guarantees that any snapshots (see
2759 the snapshot-list command) are also cleaned up when undefining an
2760 inactive domain. Without the flag, attempts to undefine an
2761 inactive domain with snapshot metadata will fail. If the domain is
2762 active, this flag is ignored.
2763
2764 --nvram and --keep-nvram specify accordingly to delete or keep
2765 nvram (/domain/os/nvram/) file. If the domain has an nvram file and
2766 the flags are omitted, the undefine will fail.
2767
2768 The --storage flag takes a parameter volumes, which is a comma
2769 separated list of volume target names or source paths of storage
2770 volumes to be removed along with the undefined domain. Volumes can
2771 be undefined and thus removed only on inactive domains. Volume
2772 deletion is only attempted after the domain is undefined; if not
2773 all of the requested volumes could be deleted, the error message
2774 indicates what still remains behind. If a volume path is not found
2775 in the domain definition, it's treated as if the volume was
2776 successfully deleted. Only volumes managed by libvirt in storage
2777 pools can be removed this way. (See domblklist for list of target
2778 names associated to a domain). Example: --storage
2779 vda,/path/to/storage.img
2780
2781 The --remove-all-storage flag specifies that all of the domain's
2782 storage volumes should be deleted.
2783
2784 The --delete-snapshots flag specifies that any snapshots associated
2785 with the storage volume should be deleted as well. Requires the
2786 --remove-all-storage flag to be provided. Not all storage drivers
2787 support this option, presently only rbd.
2788
2789 The flag --wipe-storage specifies that the storage volumes should
2790 be wiped before removal.
2791
2792 NOTE: For an inactive domain, the domain name or UUID must be used
2793 as the domain.
2794
2795 vcpucount domain [{--maximum | --active} {--config | --live |
2796 --current}] [--guest]
2797 Print information about the virtual cpu counts of the given domain.
2798 If no flags are specified, all possible counts are listed in a
2799 table; otherwise, the output is limited to just the numeric value
2800 requested. For historical reasons, the table lists the label
2801 "current" on the rows that can be queried in isolation via the
2802 --active flag, rather than relating to the --current flag.
2803
2804 --maximum requests information on the maximum cap of vcpus that a
2805 domain can add via setvcpus, while --active shows the current
2806 usage; these two flags cannot both be specified. --config requires
2807 a persistent domain and requests information regarding the next
2808 time the domain will be booted, --live requires a running domain
2809 and lists current values, and --current queries according to the
2810 current state of the domain (corresponding to --live if running, or
2811 --config if inactive); these three flags are mutually exclusive.
2812
2813 If --guest is specified, then the count of cpus is reported from
2814 the perspective of the guest. This flag is usable only for live
2815 domains and may require guest agent to be configured in the guest.
2816
2817 vcpuinfo domain [--pretty]
2818 Returns basic information about the domain virtual CPUs, like the
2819 number of vCPUs, the running time, the affinity to physical
2820 processors.
2821
2822 With --pretty, cpu affinities are shown as ranges.
2823
2824 An example output is
2825
2826 $ virsh vcpuinfo fedora
2827 VCPU: 0
2828 CPU: 0
2829 State: running
2830 CPU time: 7,0s
2831 CPU Affinity: yyyy
2832
2833 VCPU: 1
2834 CPU: 1
2835 State: running
2836 CPU time: 0,7s
2837 CPU Affinity: yyyy
2838
2839 STATES
2840
2841 The State field displays the current operating state of a virtual
2842 CPU
2843
2844 offline
2845 The virtual CPU is offline and not usable by the domain. This
2846 state is not supported by all hypervisors.
2847
2848 running
2849 The virtual CPU is available to the domain and is operating.
2850
2851 blocked
2852 The virtual CPU is available to the domain but is waiting for a
2853 resource. This state is not supported by all hypervisors, in
2854 which case running may be reported instead.
2855
2856 no state
2857 The virtual CPU state could not be determined. This could
2858 happen if the hypervisor is newer than virsh.
2859
2860 N/A There's no information about the virtual CPU state available.
2861 This can be the case if the domain is not running or the
2862 hypervisor does not report the virtual CPU state.
2863
2864 vcpupin domain [vcpu] [cpulist] [[--live] [--config] | [--current]]
2865 Query or change the pinning of domain VCPUs to host physical CPUs.
2866 To pin a single vcpu, specify cpulist; otherwise, you can query one
2867 vcpu or omit vcpu to list all at once.
2868
2869 cpulist is a list of physical CPU numbers. Its syntax is a comma
2870 separated list and a special markup using '-' and '^' (ex. '0-4',
2871 '0-3,^2') can also be allowed. The '-' denotes the range and the
2872 '^' denotes exclusive. For pinning the vcpu to all physical cpus
2873 specify 'r' as a cpulist. If --live is specified, affect a running
2874 guest. If --config is specified, affect the next boot of a
2875 persistent guest. If --current is specified, affect the current
2876 guest state. Both --live and --config flags may be given if
2877 cpulist is present, but --current is exclusive. If no flag is
2878 specified, behavior is different depending on hypervisor.
2879
2880 Note: The expression is sequentially evaluated, so "0-15,^8" is
2881 identical to "9-14,0-7,15" but not identical to "^8,0-15".
2882
2883 emulatorpin domain [cpulist] [[--live] [--config] | [--current]]
2884 Query or change the pinning of domain's emulator threads to host
2885 physical CPUs.
2886
2887 See vcpupin for cpulist.
2888
2889 If --live is specified, affect a running guest. If --config is
2890 specified, affect the next boot of a persistent guest. If
2891 --current is specified, affect the current guest state. Both
2892 --live and --config flags may be given if cpulist is present, but
2893 --current is exclusive. If no flag is specified, behavior is
2894 different depending on hypervisor.
2895
2896 guestvcpus domain [[--enable] | [--disable]] [cpulist]
2897 Query or change state of vCPUs from guest's point of view using the
2898 guest agent. When invoked without cpulist the guest is queried for
2899 available guest vCPUs, their state and possibility to be offlined.
2900
2901 If cpulist is provided then one of --enable or --disable must be
2902 provided too. The desired operation is then executed on the domain.
2903
2904 See vcpupin for information on cpulist.
2905
2906 vncdisplay domain
2907 Output the IP address and port number for the VNC display. If the
2908 information is not available the processes will provide an exit
2909 code of 1.
2910
2912 The following commands manipulate devices associated to domains. The
2913 domain can be specified as a short integer, a name or a full UUID. To
2914 better understand the values allowed as options for the command reading
2915 the documentation at <https://libvirt.org/formatdomain.html> on the
2916 format of the device sections to get the most accurate set of accepted
2917 values.
2918
2919 attach-device domain FILE [[[--live] [--config] | [--current]] |
2920 [--persistent]]
2921 Attach a device to the domain, using a device definition in an XML
2922 file using a device definition element such as <disk> or
2923 <interface> as the top-level element. See the documentation at
2924 <https://libvirt.org/formatdomain.html#elementsDevices> to learn
2925 about libvirt XML format for a device. If --config is specified
2926 the command alters the persistent domain configuration with the
2927 device attach taking effect the next time libvirt starts the
2928 domain. For cdrom and floppy devices, this command only replaces
2929 the media within an existing device; consider using update-device
2930 for this usage. For passthrough host devices, see also nodedev-
2931 detach, needed if the PCI device does not use managed mode.
2932
2933 If --live is specified, affect a running domain. If --config is
2934 specified, affect the next startup of a persistent domain. If
2935 --current is specified, affect the current domain state. Both
2936 --live and --config flags may be given, but --current is exclusive.
2937 When no flag is specified legacy API is used whose behavior depends
2938 on the hypervisor driver.
2939
2940 For compatibility purposes, --persistent behaves like --config for
2941 an offline domain, and like --live --config for a running domain.
2942
2943 Note: using of partial device definition XML files may lead to
2944 unexpected results as some fields may be autogenerated and thus
2945 match devices other than expected.
2946
2947 attach-disk domain source target [[[--live] [--config] | [--current]] |
2948 [--persistent]] [--targetbus bus] [--driver driver] [--subdriver
2949 subdriver] [--iothread iothread] [--cache cache] [--io io] [--type
2950 type] [--alias alias] [--mode mode] [--sourcetype sourcetype] [--serial
2951 serial] [--wwn wwn] [--rawio] [--address address] [--multifunction]
2952 [--print-xml]
2953 Attach a new disk device to the domain. source is path for the
2954 files and devices. target controls the bus or device under which
2955 the disk is exposed to the guest OS. It indicates the "logical"
2956 device name; the optional targetbus attribute specifies the type of
2957 disk device to emulate; possible values are driver specific, with
2958 typical values being ide, scsi, virtio, xen, usb, sata, or sd, if
2959 omitted, the bus type is inferred from the style of the device name
2960 (e.g. a device named 'sda' will typically be exported using a SCSI
2961 bus). driver can be file, tap or phy for the Xen hypervisor
2962 depending on the kind of access; or qemu for the QEMU emulator.
2963 Further details to the driver can be passed using subdriver. For
2964 Xen subdriver can be aio, while for QEMU subdriver should match the
2965 format of the disk source, such as raw or qcow2. Hypervisor
2966 default will be used if subdriver is not specified. However, the
2967 default may not be correct, esp. for QEMU as for security reasons
2968 it is configured not to detect disk formats. type can indicate
2969 lun, cdrom or floppy as alternative to the disk default, although
2970 this use only replaces the media within the existing virtual cdrom
2971 or floppy device; consider using update-device for this usage
2972 instead. alias can set user supplied alias. mode can specify the
2973 two specific mode readonly or shareable. sourcetype can indicate
2974 the type of source (block|file) cache can be one of "default",
2975 "none", "writethrough", "writeback", "directsync" or "unsafe". io
2976 controls specific policies on I/O; QEMU guests support "threads"
2977 and "native". iothread is the number within the range of domain
2978 IOThreads to which this disk may be attached (QEMU only). serial
2979 is the serial of disk device. wwn is the wwn of disk device. rawio
2980 indicates the disk needs rawio capability. address is the address
2981 of disk device in the form of pci:domain.bus.slot.function,
2982 scsi:controller.bus.unit, ide:controller.bus.unit, usb:bus.port,
2983 sata:controller.bus.unit or ccw:cssid.ssid.devno. Virtio-ccw
2984 devices must have their cssid set to 0xfe. multifunction indicates
2985 specified pci address is a multifunction pci device address.
2986
2987 If --print-xml is specified, then the XML of the disk that would be
2988 attached is printed instead.
2989
2990 If --live is specified, affect a running domain. If --config is
2991 specified, affect the next startup of a persistent domain. If
2992 --current is specified, affect the current domain state. Both
2993 --live and --config flags may be given, but --current is exclusive.
2994 When no flag is specified legacy API is used whose behavior depends
2995 on the hypervisor driver.
2996
2997 For compatibility purposes, --persistent behaves like --config for
2998 an offline domain, and like --live --config for a running domain.
2999 Likewise, --shareable is an alias for --mode shareable.
3000
3001 attach-interface domain type source [[[--live] [--config] |
3002 [--current]] | [--persistent]] [--target target] [--mac mac] [--script
3003 script] [--model model] [--inbound average,peak,burst,floor]
3004 [--outbound average,peak,burst] [--alias alias] [--managed]
3005 [--print-xml]
3006 Attach a new network interface to the domain.
3007
3008 type can be one of the:
3009
3010 network to indicate connection via a libvirt virtual network,
3011
3012 bridge to indicate connection via a bridge device on the host,
3013
3014 direct to indicate connection directly to one of the host's
3015 network interfaces or bridges,
3016
3017 hostdev to indicate connection using a passthrough of PCI
3018 device on the host.
3019
3020 source indicates the source of the connection. The source depends
3021 on the type of the interface:
3022
3023 network name of the virtual network,
3024
3025 bridge the name of the bridge device,
3026
3027 direct the name of the host's interface or bridge,
3028
3029 hostdev the PCI address of the host's interface formatted as
3030 domain:bus:slot.function.
3031
3032 --target is used to specify the tap/macvtap device to be used to
3033 connect the domain to the source. Names starting with 'vnet' are
3034 considered as auto-generated and are blanked out/regenerated each
3035 time the interface is attached.
3036
3037 --mac specifies the MAC address of the network interface; if a MAC
3038 address is not given, a new address will be automatically generated
3039 (and stored in the persistent configuration if "--config" is given
3040 on the command line).
3041
3042 --script is used to specify a path to a custom script to be called
3043 while attaching to a bridge - this will be called instead of the
3044 default script not in addition to it. This is valid only for
3045 interfaces of bridge type and only for Xen domains.
3046
3047 --model specifies the network device model to be presented to the
3048 domain.
3049
3050 alias can set user supplied alias.
3051
3052 --inbound and --outbound control the bandwidth of the interface.
3053 At least one from the average, floor pair must be specified. The
3054 other two peak and burst are optional, so "average,peak",
3055 "average,,burst", "average,,,floor", "average" and ",,,floor" are
3056 also legal. Values for average, floor and peak are expressed in
3057 kilobytes per second, while burst is expressed in kilobytes in a
3058 single burst at peak speed as described in the Network XML
3059 documentation at
3060 <https://libvirt.org/formatnetwork.html#elementQoS>.
3061
3062 --managed is usable only for hostdev type and tells libvirt that
3063 the interface should be managed, which means detached and
3064 reattached from/to the host by libvirt.
3065
3066 If --print-xml is specified, then the XML of the interface that
3067 would be attached is printed instead.
3068
3069 If --live is specified, affect a running domain. If --config is
3070 specified, affect the next startup of a persistent domain. If
3071 --current is specified, affect the current domain state. Both
3072 --live and --config flags may be given, but --current is exclusive.
3073 When no flag is specified legacy API is used whose behavior depends
3074 on the hypervisor driver.
3075
3076 For compatibility purposes, --persistent behaves like --config for
3077 an offline domain, and like --live --config for a running domain.
3078
3079 Note: the optional target value is the name of a device to be
3080 created as the back-end on the node. If not provided a device
3081 named "vnetN" or "vifN" will be created automatically.
3082
3083 detach-device domain FILE [[[--live] [--config] | [--current]] |
3084 [--persistent]]
3085 Detach a device from the domain, takes the same kind of XML
3086 descriptions as command attach-device. For passthrough host
3087 devices, see also nodedev-reattach, needed if the device does not
3088 use managed mode.
3089
3090 Note: The supplied XML description of the device should be as
3091 specific as its definition in the domain XML. The set of attributes
3092 used to match the device are internal to the drivers. Using a
3093 partial definition, or attempting to detach a device that is not
3094 present in the domain XML, but shares some specific attributes with
3095 one that is present, may lead to unexpected results.
3096
3097 If --live is specified, affect a running domain. If --config is
3098 specified, affect the next startup of a persistent domain. If
3099 --current is specified, affect the current domain state. Both
3100 --live and --config flags may be given, but --current is exclusive.
3101 When no flag is specified legacy API is used whose behavior depends
3102 on the hypervisor driver.
3103
3104 For compatibility purposes, --persistent behaves like --config for
3105 an offline domain, and like --live --config for a running domain.
3106
3107 Note that older versions of virsh used --config as an alias for
3108 --persistent.
3109
3110 detach-device-alias domain alias [[[--live] [--config] | [--current]]]]
3111 Detach a device with given alias from the domain.
3112
3113 If --live is specified, affect a running domain. If --config is
3114 specified, affect the next startup of a persistent domain. If
3115 --current is specified, affect the current domain state. Both
3116 --live and --config flags may be given, but --current is exclusive.
3117
3118 detach-disk domain target [[[--live] [--config] | [--current]] |
3119 [--persistent]] [--print-xml]
3120 Detach a disk device from a domain. The target is the device as
3121 seen from the domain.
3122
3123 If --live is specified, affect a running domain. If --config is
3124 specified, affect the next startup of a persistent domain. If
3125 --current is specified, affect the current domain state. Both
3126 --live and --config flags may be given, but --current is exclusive.
3127 When no flag is specified legacy API is used whose behavior depends
3128 on the hypervisor driver.
3129
3130 For compatibility purposes, --persistent behaves like --config for
3131 an offline domain, and like --live --config for a running domain.
3132
3133 Note that older versions of virsh used --config as an alias for
3134 --persistent.
3135
3136 If --print-xml is specified, then the XML which would be used to
3137 detach the disk is printed instead.
3138
3139 detach-interface domain type [--mac mac] [[[--live] [--config] |
3140 [--current]] | [--persistent]]
3141 Detach a network interface from a domain. type can be either
3142 network to indicate a physical network device or bridge to indicate
3143 a bridge to a device. It is recommended to use the mac option to
3144 distinguish between the interfaces if more than one are present on
3145 the domain.
3146
3147 If --live is specified, affect a running domain. If --config is
3148 specified, affect the next startup of a persistent domain. If
3149 --current is specified, affect the current domain state. Both
3150 --live and --config flags may be given, but --current is exclusive.
3151 When no flag is specified legacy API is used whose behavior depends
3152 on the hypervisor driver.
3153
3154 For compatibility purposes, --persistent behaves like --config for
3155 an offline domain, and like --live --config for a running domain.
3156
3157 Note that older versions of virsh used --config as an alias for
3158 --persistent.
3159
3160 update-device domain file [--force] [[[--live] [--config] |
3161 [--current]] | [--persistent]]
3162 Update the characteristics of a device associated with domain,
3163 based on the device definition in an XML file. The --force option
3164 can be used to force device update, e.g., to eject a CD-ROM even if
3165 it is locked/mounted in the domain. See the documentation at
3166 <https://libvirt.org/formatdomain.html#elementsDevices> to learn
3167 about libvirt XML format for a device.
3168
3169 If --live is specified, affect a running domain. If --config is
3170 specified, affect the next startup of a persistent domain. If
3171 --current is specified, affect the current domain state. Both
3172 --live and --config flags may be given, but --current is exclusive.
3173 Not specifying any flag is the same as specifying --current.
3174
3175 For compatibility purposes, --persistent behaves like --config for
3176 an offline domain, and like --live --config for a running domain.
3177
3178 Note that older versions of virsh used --config as an alias for
3179 --persistent.
3180
3181 Note: using of partial device definition XML files may lead to
3182 unexpected results as some fields may be autogenerated and thus
3183 match devices other than expected.
3184
3185 change-media domain path [--eject] [--insert] [--update] [source]
3186 [--force] [[--live] [--config] | [--current]] [--print-xml] [--block]
3187 Change media of CDROM or floppy drive. path can be the fully-
3188 qualified path or the unique target name (<target dev='hdc'>) of
3189 the disk device. source specifies the path of the media to be
3190 inserted or updated. Flag --block allows to set the backing type in
3191 case a block device is used as media for the CDROM or floppy drive
3192 instead of a file.
3193
3194 --eject indicates the media will be ejected. --insert indicates
3195 the media will be inserted. source must be specified. If the
3196 device has source (e.g. <source file='media'>), and source is not
3197 specified, --update is equal to --eject. If the device has no
3198 source, and source is specified, --update is equal to --insert. If
3199 the device has source, and source is specified, --update behaves
3200 like combination of --eject and --insert. If none of --eject,
3201 --insert, and --update is specified, --update is used by default.
3202 The --force option can be used to force media changing. If --live
3203 is specified, alter live configuration of running guest. If
3204 --config is specified, alter persistent configuration, effect
3205 observed on next boot. --current can be either or both of live and
3206 config, depends on the hypervisor's implementation. Both --live
3207 and --config flags may be given, but --current is exclusive. If no
3208 flag is specified, behavior is different depending on hypervisor.
3209 If --print-xml is specified, the XML that would be used to change
3210 media is printed instead of changing the media.
3211
3213 The following commands manipulate host devices that are intended to be
3214 passed through to guest domains via <hostdev> elements in a domain's
3215 <devices> section. A node device key is generally specified by the bus
3216 name followed by its address, using underscores between all components,
3217 such as pci_0000_00_02_1, usb_1_5_3, or net_eth1_00_27_13_6a_fe_00.
3218 The nodedev-list gives the full list of host devices that are known to
3219 libvirt, although this includes devices that cannot be assigned to a
3220 guest (for example, attempting to detach the PCI device that controls
3221 the host's hard disk controller where the guest's disk images live
3222 could cause the host system to lock up or reboot).
3223
3224 For more information on node device definition see:
3225 <https://libvirt.org/formatnode.html>.
3226
3227 Passthrough devices cannot be simultaneously used by the host and its
3228 guest domains, nor by multiple active guests at once. If the <hostdev>
3229 description of a PCI device includes the attribute managed='yes', and
3230 the hypervisor driver supports it, then the device is in managed mode,
3231 and attempts to use that passthrough device in an active guest will
3232 automatically behave as if nodedev-detach (guest start, device hot-
3233 plug) and nodedev-reattach (guest stop, device hot-unplug) were called
3234 at the right points. If a PCI device is not marked as managed, then it
3235 must manually be detached before guests can use it, and manually
3236 reattached to be returned to the host. Also, if a device is manually
3237 detached, then the host does not regain control of the device without a
3238 matching reattach, even if the guests use the device in managed mode.
3239
3240 nodedev-create FILE
3241 Create a device on the host node that can then be assigned to
3242 virtual machines. Normally, libvirt is able to automatically
3243 determine which host nodes are available for use, but this allows
3244 registration of host hardware that libvirt did not automatically
3245 detect. file contains xml for a top-level <device> description of
3246 a node device.
3247
3248 nodedev-destroy device
3249 Destroy (stop) a device on the host. device can be either device
3250 name or wwn pair in "wwnn,wwpn" format (only works for vHBA
3251 currently). Note that this makes libvirt quit managing a host
3252 device, and may even make that device unusable by the rest of the
3253 physical host until a reboot.
3254
3255 nodedev-detach nodedev [--driver backend_driver]
3256 Detach nodedev from the host, so that it can safely be used by
3257 guests via <hostdev> passthrough. This is reversed with nodedev-
3258 reattach, and is done automatically for managed devices.
3259
3260 Different backend drivers expect the device to be bound to
3261 different dummy devices. For example, QEMU's "kvm" backend driver
3262 (the default) expects the device to be bound to pci-stub, but its
3263 "vfio" backend driver expects the device to be bound to vfio-pci.
3264 The --driver parameter can be used to specify the desired backend
3265 driver.
3266
3267 nodedev-dumpxml device
3268 Dump a <device> XML representation for the given node device,
3269 including such information as the device name, which bus owns the
3270 device, the vendor and product id, and any capabilities of the
3271 device usable by libvirt (such as whether device reset is
3272 supported). device can be either device name or wwn pair in
3273 "wwnn,wwpn" format (only works for HBA).
3274
3275 nodedev-list cap --tree
3276 List all of the devices available on the node that are known by
3277 libvirt. cap is used to filter the list by capability types, the
3278 types must be separated by comma, e.g. --cap pci,scsi. Valid
3279 capability types include 'system', 'pci', 'usb_device', 'usb',
3280 'net', 'scsi_host', 'scsi_target', 'scsi', 'storage', 'fc_host',
3281 'vports', 'scsi_generic', 'drm', 'mdev', 'mdev_types', 'ccw'. If
3282 --tree is used, the output is formatted in a tree representing
3283 parents of each node. cap and --tree are mutually exclusive.
3284
3285 nodedev-reattach nodedev
3286 Declare that nodedev is no longer in use by any guests, and that
3287 the host can resume normal use of the device. This is done
3288 automatically for PCI devices in managed mode and USB devices, but
3289 must be done explicitly to match any explicit nodedev-detach.
3290
3291 nodedev-reset nodedev
3292 Trigger a device reset for nodedev, useful prior to transferring a
3293 node device between guest passthrough or the host. Libvirt will
3294 often do this action implicitly when required, but this command
3295 allows an explicit reset when needed.
3296
3297 nodedev-event {[nodedev] event [--loop] [--timeout seconds]
3298 [--timestamp] | --list}
3299 Wait for a class of node device events to occur, and print
3300 appropriate details of events as they happen. The events can
3301 optionally be filtered by nodedev. Using --list as the only
3302 argument will provide a list of possible event values known by this
3303 client, although the connection might not allow registering for all
3304 these events.
3305
3306 By default, this command is one-shot, and returns success once an
3307 event occurs; you can send SIGINT (usually via "Ctrl-C") to quit
3308 immediately. If --timeout is specified, the command gives up
3309 waiting for events after seconds have elapsed. With --loop, the
3310 command prints all events until a timeout or interrupt key.
3311
3312 When --timestamp is used, a human-readable timestamp will be
3313 printed before the event.
3314
3316 The following commands manipulate networks. Libvirt has the capability
3317 to define virtual networks which can then be used by domains and linked
3318 to actual network devices. For more detailed information about this
3319 feature see the documentation at
3320 <https://libvirt.org/formatnetwork.html> . Many of the commands for
3321 virtual networks are similar to the ones used for domains, but the way
3322 to name a virtual network is either by its name or UUID.
3323
3324 net-autostart network [--disable]
3325 Configure a virtual network to be automatically started at boot.
3326 The --disable option disable autostarting.
3327
3328 net-create file
3329 Create a transient (temporary) virtual network from an XML file and
3330 instantiate (start) the network. See the documentation at
3331 <https://libvirt.org/formatnetwork.html> to get a description of
3332 the XML network format used by libvirt.
3333
3334 net-define file
3335 Define an inactive persistent virtual network or modify an existing
3336 persistent one from the XML file.
3337
3338 net-destroy network
3339 Destroy (stop) a given transient or persistent virtual network
3340 specified by its name or UUID. This takes effect immediately.
3341
3342 net-dumpxml network [--inactive]
3343 Output the virtual network information as an XML dump to stdout.
3344 If --inactive is specified, then physical functions are not
3345 expanded into their associated virtual functions.
3346
3347 net-edit network
3348 Edit the XML configuration file for a network.
3349
3350 This is equivalent to:
3351
3352 virsh net-dumpxml --inactive network > network.xml
3353 vi network.xml (or make changes with your other text editor)
3354 virsh net-define network.xml
3355
3356 except that it does some error checking.
3357
3358 The editor used can be supplied by the $VISUAL or $EDITOR
3359 environment variables, and defaults to "vi".
3360
3361 net-event {[network] event [--loop] [--timeout seconds] [--timestamp] |
3362 --list}
3363 Wait for a class of network events to occur, and print appropriate
3364 details of events as they happen. The events can optionally be
3365 filtered by network. Using --list as the only argument will
3366 provide a list of possible event values known by this client,
3367 although the connection might not allow registering for all these
3368 events.
3369
3370 By default, this command is one-shot, and returns success once an
3371 event occurs; you can send SIGINT (usually via "Ctrl-C") to quit
3372 immediately. If --timeout is specified, the command gives up
3373 waiting for events after seconds have elapsed. With --loop, the
3374 command prints all events until a timeout or interrupt key.
3375
3376 When --timestamp is used, a human-readable timestamp will be
3377 printed before the event.
3378
3379 net-info network
3380 Returns basic information about the network object.
3381
3382 net-list [--inactive | --all] { [--table] | --name | --uuid }
3383 [--persistent] [<--transient>] [--autostart] [<--no-autostart>]
3384 Returns the list of active networks, if --all is specified this
3385 will also include defined but inactive networks, if --inactive is
3386 specified only the inactive ones will be listed. You may also want
3387 to filter the returned networks by --persistent to list the
3388 persistent ones, --transient to list the transient ones,
3389 --autostart to list the ones with autostart enabled, and
3390 --no-autostart to list the ones with autostart disabled.
3391
3392 If --name is specified, network names are printed instead of the
3393 table formatted one per line. If --uuid is specified network's
3394 UUID's are printed instead of names. Flag --table specifies that
3395 the legacy table-formatted output should be used. This is the
3396 default. All of these are mutually exclusive.
3397
3398 NOTE: When talking to older servers, this command is forced to use
3399 a series of API calls with an inherent race, where a pool might not
3400 be listed or might appear more than once if it changed state
3401 between calls while the list was being collected. Newer servers do
3402 not have this problem.
3403
3404 net-name network-UUID
3405 Convert a network UUID to network name.
3406
3407 net-start network
3408 Start a (previously defined) inactive network.
3409
3410 net-undefine network
3411 Undefine the configuration for a persistent network. If the network
3412 is active, make it transient.
3413
3414 net-uuid network-name
3415 Convert a network name to network UUID.
3416
3417 net-update network command section xml [--parent-index index] [[--live]
3418 [--config] | [--current]]
3419 Update the given section of an existing network definition, with
3420 the changes optionally taking effect immediately, without needing
3421 to destroy and re-start the network.
3422
3423 command is one of "add-first", "add-last", "add" (a synonym for
3424 add-last), "delete", or "modify".
3425
3426 section is one of "bridge", "domain", "ip", "ip-dhcp-host", "ip-
3427 dhcp-range", "forward", "forward-interface", "forward-pf",
3428 "portgroup", "dns-host", "dns-txt", or "dns-srv", each section
3429 being named by a concatenation of the xml element hierarchy leading
3430 to the element being changed. For example, "ip-dhcp-host" will
3431 change a <host> element that is contained inside a <dhcp> element
3432 inside an <ip> element of the network.
3433
3434 xml is either the text of a complete xml element of the type being
3435 changed (e.g. "<host mac="00:11:22:33:44:55' ip='1.2.3.4'/>", or
3436 the name of a file that contains a complete xml element.
3437 Disambiguation is done by looking at the first character of the
3438 provided text - if the first character is "<", it is xml text, if
3439 the first character is not "<", it is the name of a file that
3440 contains the xml text to be used.
3441
3442 The --parent-index option is used to specify which of several
3443 parent elements the requested element is in (0-based). For example,
3444 a dhcp <host> element could be in any one of multiple <ip> elements
3445 in the network; if a parent-index isn't provided, the "most
3446 appropriate" <ip> element will be selected (usually the only one
3447 that already has a <dhcp> element), but if --parent-index is given,
3448 that particular instance of <ip> will get the modification.
3449
3450 If --live is specified, affect a running network. If --config is
3451 specified, affect the next startup of a persistent network. If
3452 --current is specified, affect the current network state. Both
3453 --live and --config flags may be given, but --current is exclusive.
3454 Not specifying any flag is the same as specifying --current.
3455
3456 net-dhcp-leases network [mac]
3457 Get a list of dhcp leases for all network interfaces connected to
3458 the given virtual network or limited output just for one interface
3459 if mac is specified.
3460
3462 The following commands manipulate host interfaces. Often, these host
3463 interfaces can then be used by name within domain <interface> elements
3464 (such as a system-created bridge interface), but there is no
3465 requirement that host interfaces be tied to any particular guest
3466 configuration XML at all.
3467
3468 Many of the commands for host interfaces are similar to the ones used
3469 for domains, and the way to name an interface is either by its name or
3470 its MAC address. However, using a MAC address for an iface argument
3471 only works when that address is unique (if an interface and a bridge
3472 share the same MAC address, which is often the case, then using that
3473 MAC address results in an error due to ambiguity, and you must resort
3474 to a name instead).
3475
3476 iface-bridge interface bridge [--no-stp] [delay] [--no-start]
3477 Create a bridge device named bridge, and attach the existing
3478 network device interface to the new bridge. The new bridge
3479 defaults to starting immediately, with STP enabled and a delay of
3480 0; these settings can be altered with --no-stp, --no-start, and an
3481 integer number of seconds for delay. All IP address configuration
3482 of interface will be moved to the new bridge device.
3483
3484 See also iface-unbridge for undoing this operation.
3485
3486 iface-define file
3487 Define an inactive persistent physical host interface or modify an
3488 existing persistent one from the XML file.
3489
3490 iface-destroy interface
3491 Destroy (stop) a given host interface, such as by running "if-down"
3492 to disable that interface from active use. This takes effect
3493 immediately.
3494
3495 iface-dumpxml interface [--inactive]
3496 Output the host interface information as an XML dump to stdout. If
3497 --inactive is specified, then the output reflects the persistent
3498 state of the interface that will be used the next time it is
3499 started.
3500
3501 iface-edit interface
3502 Edit the XML configuration file for a host interface.
3503
3504 This is equivalent to:
3505
3506 virsh iface-dumpxml iface > iface.xml
3507 vi iface.xml (or make changes with your other text editor)
3508 virsh iface-define iface.xml
3509
3510 except that it does some error checking.
3511
3512 The editor used can be supplied by the $VISUAL or $EDITOR
3513 environment variables, and defaults to "vi".
3514
3515 iface-list [--inactive | --all]
3516 Returns the list of active host interfaces. If --all is specified
3517 this will also include defined but inactive interfaces. If
3518 --inactive is specified only the inactive ones will be listed.
3519
3520 iface-name interface
3521 Convert a host interface MAC to interface name, if the MAC address
3522 is unique among the host's interfaces.
3523
3524 interface specifies the interface MAC address.
3525
3526 iface-mac interface
3527 Convert a host interface name to MAC address.
3528
3529 interface specifies the interface name.
3530
3531 iface-start interface
3532 Start a (previously defined) host interface, such as by running
3533 "if-up".
3534
3535 iface-unbridge bridge [--no-start]
3536 Tear down a bridge device named bridge, releasing its underlying
3537 interface back to normal usage, and moving all IP address
3538 configuration from the bridge device to the underlying device. The
3539 underlying interface is restarted unless --no-start is present;
3540 this flag is present for symmetry, but generally not recommended.
3541
3542 See also iface-bridge for creating a bridge.
3543
3544 iface-undefine interface
3545 Undefine the configuration for an inactive host interface.
3546
3547 iface-begin
3548 Create a snapshot of current host interface settings, which can
3549 later be committed (iface-commit) or restored (iface-rollback). If
3550 a snapshot already exists, then this command will fail until the
3551 previous snapshot has been committed or restored. Undefined
3552 behavior results if any external changes are made to host
3553 interfaces outside of the libvirt API between the beginning of a
3554 snapshot and its eventual commit or rollback.
3555
3556 iface-commit
3557 Declare all changes since the last iface-begin as working, and
3558 delete the rollback point. If no interface snapshot has already
3559 been started, then this command will fail.
3560
3561 iface-rollback
3562 Revert all host interface settings back to the state recorded in
3563 the last iface-begin. If no interface snapshot has already been
3564 started, then this command will fail. Rebooting the host also
3565 serves as an implicit rollback point.
3566
3568 The following commands manipulate storage pools. Libvirt has the
3569 capability to manage various storage solutions, including files, raw
3570 partitions, and domain-specific formats, used to provide the storage
3571 volumes visible as devices within virtual machines. For more detailed
3572 information about this feature, see the documentation at
3573 <https://libvirt.org/formatstorage.html> . Many of the commands for
3574 pools are similar to the ones used for domains.
3575
3576 find-storage-pool-sources type [srcSpec]
3577 Returns XML describing all possible available storage pool sources
3578 that could be used to create or define a storage pool of a given
3579 type. If srcSpec is provided, it is a file that contains XML to
3580 further restrict the query for pools.
3581
3582 Not all storage pools support discovery in this manner.
3583 Furthermore, for those that do support discovery, only specific XML
3584 elements are required in order to return valid data, while other
3585 elements and even attributes of some elements are ignored since
3586 they are not necessary to find the pool based on the search
3587 criteria. The following lists the supported type options and the
3588 expected minimal XML elements used to perform the search.
3589
3590 For a "netfs" or "gluster" pool, the minimal expected XML required
3591 is the <host> element with a "name" attribute describing the IP
3592 address or hostname to be used to find the pool. The "port"
3593 attribute will be ignored as will any other provided XML elements
3594 in srcSpec.
3595
3596 For a "logical" pool, the contents of the srcSpec file are ignored,
3597 although if provided the file must at least exist.
3598
3599 For an "iscsi" pool, the minimal expect XML required is the <host>
3600 element with a "name" attribute describing the IP address or
3601 hostname to be used to find the pool (the iSCSI server address).
3602 Optionally, the "port" attribute may be provided, although it will
3603 default to 3260. Optionally, an <initiator> XML element with a
3604 "name" attribute may be provided to further restrict the iSCSI
3605 target search to a specific initiator for multi-iqn iSCSI storage
3606 pools.
3607
3608 find-storage-pool-sources-as type [host] [port] [initiator]
3609 Rather than providing srcSpec XML file for find-storage-pool-
3610 sources use this command option in order to have virsh generate the
3611 query XML file using the optional arguments. The command will
3612 return the same output XML as find-storage-pool-sources.
3613
3614 Use host to describe a specific host to use for networked storage,
3615 such as netfs, gluster, and iscsi type pools.
3616
3617 Use port to further restrict which networked port to utilize for
3618 the connection if required by the specific storage backend, such as
3619 iscsi.
3620
3621 Use initiator to further restrict the iscsi type pool searches to
3622 specific target initiators.
3623
3624 pool-autostart pool-or-uuid [--disable]
3625 Configure whether pool should automatically start at boot.
3626
3627 pool-build pool-or-uuid [--overwrite] [--no-overwrite]
3628 Build a given pool.
3629
3630 Options --overwrite and --no-overwrite can only be used for pool-
3631 build a filesystem, disk, or logical pool.
3632
3633 For a file system pool if neither flag is specified, then pool-
3634 build just makes the target path directory and no attempt to run
3635 mkfs on the target volume device. If --no-overwrite is specified,
3636 it probes to determine if a filesystem already exists on the target
3637 device, returning an error if one exists or using mkfs to format
3638 the target device if not. If --overwrite is specified, mkfs is
3639 always executed and any existing data on the target device is
3640 overwritten unconditionally.
3641
3642 For a disk pool, if neither of them is specified or --no-overwrite
3643 is specified, pool-build will check the target volume device for
3644 existing filesystems or partitions before attempting to write a new
3645 label on the target volume device. If the target volume device
3646 already has a label, the command will fail. If --overwrite is
3647 specified, then no check will be made on the target volume device
3648 prior to writing a new label. Writing of the label uses the pool
3649 source format type or "dos" if not specified.
3650
3651 For a logical pool, if neither of them is specified or
3652 --no-overwrite is specified, pool-build will check the target
3653 volume devices for existing filesystems or partitions before
3654 attempting to initialize and format each device for usage by the
3655 logical pool. If any target volume device already has a label, the
3656 command will fail. If --overwrite is specified, then no check will
3657 be made on the target volume devices prior to initializing and
3658 formatting each device. Once all the target volume devices are
3659 properly formatted via pvcreate, the volume group will be created
3660 using all the devices.
3661
3662 pool-create file [--build] [[--overwrite] | [--no-overwrite]]
3663 Create and start a pool object from the XML file.
3664
3665 [--build] [[--overwrite] | [--no-overwrite]] perform a pool-build
3666 after creation in order to remove the need for a follow-up command
3667 to build the pool. The --overwrite and --no-overwrite flags follow
3668 the same rules as pool-build. If just --build is provided, then
3669 pool-build is called with no flags.
3670
3671 pool-create-as name type [--source-host hostname] [--source-path path]
3672 [--source-dev path] [--source-name name] [--target path]
3673 [--source-format format] [--auth-type authtype --auth-username username
3674 [--secret-usage usage | --secret-uuid uuid]] [--source-protocol-ver
3675 ver] [[--adapter-name name] | [--adapter-wwnn wwnn --adapter-wwpn wwpn]
3676 [--adapter-parent parent | --adapter-parent-wwnn parent_wwnn adapter-
3677 parent-wwpn parent_wwpn | --adapter-parent-fabric-wwn
3678 parent_fabric_wwn]] [--build] [[--overwrite] | [--no-overwrite]]
3679 [--print-xml]
3680 Create and start a pool object name from the raw parameters. If
3681 --print-xml is specified, then print the XML of the pool object
3682 without creating the pool. Otherwise, the pool has the specified
3683 type. When using pool-create-as for a pool of type "disk", the
3684 existing partitions found on the --source-dev path will be used to
3685 populate the disk pool. Therefore, it is suggested to use pool-
3686 define-as and pool-build with the --overwrite in order to properly
3687 initialize the disk pool.
3688
3689 [--source-host hostname] provides the source hostname for pools
3690 backed by storage from a remote server (pool types netfs, iscsi,
3691 rbd, sheepdog, gluster).
3692
3693 [--source-path path] provides the source directory path for pools
3694 backed by directories (pool type dir).
3695
3696 [--source-dev path] provides the source path for pools backed by
3697 physical devices (pool types fs, logical, disk, iscsi, zfs).
3698
3699 [--source-name name] provides the source name for pools backed by
3700 storage from a named element (pool types logical, rbd, sheepdog,
3701 gluster).
3702
3703 [--target path] is the path for the mapping of the storage pool
3704 into the host file system.
3705
3706 [--source-format format] provides information about the format of
3707 the pool (pool types fs, netfs, disk, logical).
3708
3709 [--auth-type authtype --auth-username username [--secret-usage
3710 usage | --secret-uuid uuid]] provides the elements required to
3711 generate authentication credentials for the storage pool. The
3712 authtype is either chap for iscsi type pools or ceph for rbd type
3713 pools. Either the secret usage or uuid value may be provided, but
3714 not both.
3715
3716 [--source-protocol-ver ver] provides the NFS protocol version
3717 number used to contact the server's NFS service via nfs mount
3718 option 'nfsvers=n'. It is expect the ver value is an unsigned
3719 integer.
3720
3721 [--adapter-name name] defines the scsi_hostN adapter name to be
3722 used for the scsi_host adapter type pool.
3723
3724 [--adapter-wwnn wwnn --adapter-wwpn wwpn [--adapter-parent parent |
3725 --adapter-parent-wwnn parent_wwnn adapter-parent-wwpn parent_wwpn |
3726 --adapter-parent-fabric-wwn parent_fabric_wwn]] defines the wwnn
3727 and wwpn to be used for the fc_host adapter type pool. Optionally
3728 provide the parent scsi_hostN node device to be used for the vHBA
3729 either by parent name, parent_wwnn and parent_wwpn, or
3730 parent_fabric_wwn. The parent name could change between reboots if
3731 the hardware environment changes, so providing the parent_wwnn and
3732 parent_wwpn ensure usage of the same physical HBA even if the
3733 scsi_hostN node device changes. Usage of the parent_fabric_wwn
3734 allows a bit more flexibility to choose an HBA on the same storage
3735 fabric in order to define the pool.
3736
3737 [--build] [[--overwrite] | [--no-overwrite]] perform a pool-build
3738 after creation in order to remove the need for a follow-up command
3739 to build the pool. The --overwrite and --no-overwrite flags follow
3740 the same rules as pool-build. If just --build is provided, then
3741 pool-build is called with no flags.
3742
3743 For a "logical" pool only [--name] needs to be provided. The
3744 [--source-name] if provided must match the Volume Group name. If
3745 not provided, one will be generated using the [--name]. If provided
3746 the [--target] is ignored and a target source is generated using
3747 the [--source-name] (or as generated from the [--name]).
3748
3749 pool-define file
3750 Define an inactive persistent storage pool or modify an existing
3751 persistent one from the XML file.
3752
3753 pool-define-as name type [--source-host hostname] [--source-path path]
3754 [--source-dev path] [--source-name name] [--target path]
3755 [--source-format format] [--auth-type authtype --auth-username username
3756 [--secret-usage usage | --secret-uuid uuid]] [[--adapter-name name] |
3757 [--adapter-wwnn --adapter-wwpn] [--adapter-parent parent]]
3758 [--print-xml]
3759 Create, but do not start, a pool object name from the raw
3760 parameters. If --print-xml is specified, then print the XML of the
3761 pool object without defining the pool. Otherwise, the pool has the
3762 specified type.
3763
3764 Use the same arguments as pool-create-as, except for the --build,
3765 --overwrite, and --no-overwrite options.
3766
3767 pool-destroy pool-or-uuid
3768 Destroy (stop) a given pool object. Libvirt will no longer manage
3769 the storage described by the pool object, but the raw data
3770 contained in the pool is not changed, and can be later recovered
3771 with pool-create.
3772
3773 pool-delete pool-or-uuid
3774 Destroy the resources used by a given pool object. This operation
3775 is non-recoverable. The pool object will still exist after this
3776 command, ready for the creation of new storage volumes.
3777
3778 pool-dumpxml [--inactive] pool-or-uuid
3779 Returns the XML information about the pool object. --inactive
3780 tells virsh to dump pool configuration that will be used on next
3781 start of the pool as opposed to the current pool configuration.
3782
3783 pool-edit pool-or-uuid
3784 Edit the XML configuration file for a storage pool.
3785
3786 This is equivalent to:
3787
3788 virsh pool-dumpxml pool > pool.xml
3789 vi pool.xml (or make changes with your other text editor)
3790 virsh pool-define pool.xml
3791
3792 except that it does some error checking.
3793
3794 The editor used can be supplied by the $VISUAL or $EDITOR
3795 environment variables, and defaults to "vi".
3796
3797 pool-info [--bytes] pool-or-uuid
3798 Returns basic information about the pool object. If --bytes is
3799 specified the sizes of basic info are not converted to human
3800 friendly units.
3801
3802 pool-list [--inactive] [--all] [--persistent] [--transient]
3803 [--autostart] [--no-autostart] [[--details] [--uuid] [--name] [<type>]
3804 List pool objects known to libvirt. By default, only active pools
3805 are listed; --inactive lists just the inactive pools, and --all
3806 lists all pools.
3807
3808 In addition, there are several sets of filtering flags.
3809 --persistent is to list the persistent pools, --transient is to
3810 list the transient pools. --autostart lists the autostarting
3811 pools, --no-autostart lists the pools with autostarting disabled.
3812 If --uuid is specified only pool's UUIDs are printed. If --name is
3813 specified only pool's names are printed. If both --name and --uuid
3814 are specified, pool's UUID and names are printed side by side
3815 without any header. Option --details is mutually exclusive with
3816 options --uuid and --name.
3817
3818 You may also want to list pools with specified types using type,
3819 the pool types must be separated by comma, e.g. --type dir,disk.
3820 The valid pool types include 'dir', 'fs', 'netfs', 'logical',
3821 'disk', 'iscsi', 'scsi', 'mpath', 'rbd', 'sheepdog' and 'gluster'.
3822
3823 The --details option instructs virsh to additionally display pool
3824 persistence and capacity related information where available.
3825
3826 NOTE: When talking to older servers, this command is forced to use
3827 a series of API calls with an inherent race, where a pool might not
3828 be listed or might appear more than once if it changed state
3829 between calls while the list was being collected. Newer servers do
3830 not have this problem.
3831
3832 pool-name uuid
3833 Convert the uuid to a pool name.
3834
3835 pool-refresh pool-or-uuid
3836 Refresh the list of volumes contained in pool.
3837
3838 pool-start pool-or-uuid [--build] [[--overwrite] | [--no-overwrite]]
3839 Start the storage pool, which is previously defined but inactive.
3840
3841 [--build] [[--overwrite] | [--no-overwrite]] perform a pool-build
3842 prior to pool-start to ensure the pool environment is in an
3843 expected state rather than needing to run the build command prior
3844 to startup. The --overwrite and --no-overwrite flags follow the
3845 same rules as pool-build. If just --build is provided, then pool-
3846 build is called with no flags.
3847
3848 Note: A storage pool that relies on remote resources such as an
3849 "iscsi" or a (v)HBA backed "scsi" pool may need to be refreshed
3850 multiple times in order to have all the volumes detected (see pool-
3851 refresh). This is because the corresponding volume devices may not
3852 be present in the host's filesystem during the initial pool startup
3853 or the current refresh attempt. The number of refresh retries is
3854 dependent upon the network connection and the time the host takes
3855 to export the corresponding devices.
3856
3857 pool-undefine pool-or-uuid
3858 Undefine the configuration for an inactive pool.
3859
3860 pool-uuid pool
3861 Returns the UUID of the named pool.
3862
3863 pool-event {[pool] event [--loop] [--timeout seconds] [--timestamp] |
3864 --list}
3865 Wait for a class of storage pool events to occur, and print
3866 appropriate details of events as they happen. The events can
3867 optionally be filtered by pool. Using --list as the only argument
3868 will provide a list of possible event values known by this client,
3869 although the connection might not allow registering for all these
3870 events.
3871
3872 By default, this command is one-shot, and returns success once an
3873 event occurs; you can send SIGINT (usually via "Ctrl-C") to quit
3874 immediately. If --timeout is specified, the command gives up
3875 waiting for events after seconds have elapsed. With --loop, the
3876 command prints all events until a timeout or interrupt key.
3877
3878 When --timestamp is used, a human-readable timestamp will be
3879 printed before the event.
3880
3882 vol-create pool-or-uuid FILE [--prealloc-metadata]
3883 Create a volume from an XML <file>.
3884
3885 pool-or-uuid is the name or UUID of the storage pool to create the
3886 volume in.
3887
3888 FILE is the XML <file> with the volume definition. An easy way to
3889 create the XML <file> is to use the vol-dumpxml command to obtain
3890 the definition of a pre-existing volume.
3891
3892 [--prealloc-metadata] preallocate metadata (for qcow2 images which
3893 don't support full allocation). This option creates a sparse image
3894 file with metadata, resulting in higher performance compared to
3895 images with no preallocation and only slightly higher initial disk
3896 space usage.
3897
3898 Example
3899
3900 virsh vol-dumpxml --pool storagepool1 appvolume1 > newvolume.xml
3901 vi newvolume.xml (or make changes with your other text editor)
3902 virsh vol-create differentstoragepool newvolume.xml
3903
3904 vol-create-from pool-or-uuid FILE vol-name-or-key-or-path [--inputpool
3905 pool-or-uuid] [--prealloc-metadata] [--reflink]
3906 Create a volume, using another volume as input.
3907
3908 pool-or-uuid is the name or UUID of the storage pool to create the
3909 volume in.
3910
3911 FILE is the XML <file> with the volume definition.
3912
3913 vol-name-or-key-or-path is the name or key or path of the source
3914 volume.
3915
3916 --inputpool pool-or-uuid is the name or uuid of the storage pool
3917 the source volume is in.
3918
3919 [--prealloc-metadata] preallocate metadata (for qcow2 images which
3920 don't support full allocation). This option creates a sparse image
3921 file with metadata, resulting in higher performance compared to
3922 images with no preallocation and only slightly higher initial disk
3923 space usage.
3924
3925 When --reflink is specified, perform a COW lightweight copy, where
3926 the data blocks are copied only when modified. If this is not
3927 possible, the copy fails.
3928
3929 vol-create-as pool-or-uuid name capacity [--allocation size] [--format
3930 string] [--backing-vol vol-name-or-key-or-path] [--backing-vol-format
3931 string] [--prealloc-metadata] [--print-xml]
3932 Create a volume from a set of arguments unless --print-xml is
3933 specified, in which case just the XML of the volume object is
3934 printed out without any actual object creation.
3935
3936 pool-or-uuid is the name or UUID of the storage pool to create the
3937 volume in.
3938
3939 name is the name of the new volume. For a disk pool, this must
3940 match the partition name as determined from the pool's source
3941 device path and the next available partition. For example, a source
3942 device path of /dev/sdb and there are no partitions on the disk,
3943 then the name must be sdb1 with the next name being sdb2 and so on.
3944
3945 capacity is the size of the volume to be created, as a scaled
3946 integer (see NOTES above), defaulting to bytes if there is no
3947 suffix.
3948
3949 --allocation size is the initial size to be allocated in the
3950 volume, also as a scaled integer defaulting to bytes.
3951
3952 --format string is used in file based storage pools to specify the
3953 volume file format to use; raw, bochs, qcow, qcow2, vmdk, qed. Use
3954 extended for disk storage pools in order to create an extended
3955 partition (other values are validity checked but not preserved when
3956 libvirtd is restarted or the pool is refreshed).
3957
3958 --backing-vol vol-name-or-key-or-path is the source backing volume
3959 to be used if taking a snapshot of an existing volume.
3960
3961 --backing-vol-format string is the format of the snapshot backing
3962 volume; raw, bochs, qcow, qcow2, qed, vmdk, host_device. These are,
3963 however, meant for file based storage pools.
3964
3965 [--prealloc-metadata] preallocate metadata (for qcow2 images which
3966 don't support full allocation). This option creates a sparse image
3967 file with metadata, resulting in higher performance compared to
3968 images with no preallocation and only slightly higher initial disk
3969 space usage.
3970
3971 vol-clone vol-name-or-key-or-path name [--pool pool-or-uuid]
3972 [--prealloc-metadata] [--reflink]
3973 Clone an existing volume within the parent pool. Less powerful,
3974 but easier to type, version of vol-create-from.
3975
3976 vol-name-or-key-or-path is the name or key or path of the source
3977 volume.
3978
3979 name is the name of the new volume.
3980
3981 --pool pool-or-uuid is the name or UUID of the storage pool that
3982 contains the source volume and will contain the new volume. If the
3983 source volume name is provided instead of the key or path, then
3984 providing the pool is necessary to find the volume to be cloned;
3985 otherwise, the first volume found by the key or path will be used.
3986
3987 [--prealloc-metadata] preallocate metadata (for qcow2 images which
3988 don't support full allocation). This option creates a sparse image
3989 file with metadata, resulting in higher performance compared to
3990 images with no preallocation and only slightly higher initial disk
3991 space usage.
3992
3993 When --reflink is specified, perform a COW lightweight copy, where
3994 the data blocks are copied only when modified. If this is not
3995 possible, the copy fails.
3996
3997 vol-delete vol-name-or-key-or-path [--pool pool-or-uuid]
3998 [--delete-snapshots]
3999 Delete a given volume.
4000
4001 vol-name-or-key-or-path is the volume name or key or path of the
4002 volume to delete.
4003
4004 [--pool pool-or-uuid] is the name or UUID of the storage pool the
4005 volume is in. If the volume name is provided instead of the key or
4006 path, then providing the pool is necessary to find the volume to be
4007 deleted; otherwise, the first volume found by the key or path will
4008 be used.
4009
4010 The --delete-snapshots flag specifies that any snapshots associated
4011 with the storage volume should be deleted as well. Not all storage
4012 drivers support this option, presently only rbd.
4013
4014 vol-upload vol-name-or-key-or-path local-file [--pool pool-or-uuid]
4015 [--offset bytes] [--length bytes] [--sparse]
4016 Upload the contents of local-file to a storage volume.
4017
4018 vol-name-or-key-or-path is the name or key or path of the volume
4019 where the local-file will be uploaded.
4020
4021 --pool pool-or-uuid is the name or UUID of the storage pool the
4022 volume is in. If the volume name is provided instead of the key or
4023 path, then providing the pool is necessary to find the volume to be
4024 uploaded into; otherwise, the first volume found by the key or path
4025 will be used.
4026
4027 --offset is the position in the storage volume at which to start
4028 writing the data. The value must be 0 or larger.
4029
4030 --length is an upper bound of the amount of data to be uploaded. A
4031 negative value is interpreted as an unsigned long long value to
4032 essentially include everything from the offset to the end of the
4033 volume.
4034
4035 If --sparse is specified, this command will preserve volume
4036 sparseness.
4037
4038 An error will occur if the local-file is greater than the specified
4039 length.
4040
4041 See the description for the libvirt virStorageVolUpload API for
4042 details regarding possible target volume and pool changes as a
4043 result of the pool refresh when the upload is attempted.
4044
4045 vol-download vol-name-or-key-or-path local-file [--pool pool-or-uuid]
4046 [--offset bytes] [--length bytes] [--sparse]
4047 Download the contents of a storage volume to local-file.
4048
4049 vol-name-or-key-or-path is the name or key or path of the volume to
4050 download into local-file.
4051
4052 --pool pool-or-uuid is the name or UUID of the storage pool the
4053 volume is in. If the volume name is provided instead of the key or
4054 path, then providing the pool is necessary to find the volume to be
4055 uploaded into; otherwise, the first volume found by the key or path
4056 will be used.
4057
4058 --offset is the position in the storage volume at which to start
4059 reading the data. The value must be 0 or larger.
4060
4061 --length is an upper bound of the amount of data to be downloaded.
4062 A negative value is interpreted as an unsigned long long value to
4063 essentially include everything from the offset to the end of the
4064 volume.
4065
4066 If --sparse is specified, this command will preserve volume
4067 sparseness.
4068
4069 vol-wipe vol-name-or-key-or-path [--pool pool-or-uuid] [--algorithm
4070 algorithm]
4071 Wipe a volume, ensure data previously on the volume is not
4072 accessible to future reads.
4073
4074 vol-name-or-key-or-path is the name or key or path of the volume to
4075 wipe. It is possible to choose different wiping algorithms instead
4076 of re-writing volume with zeroes.
4077
4078 --pool pool-or-uuid is the name or UUID of the storage pool the
4079 volume is in. If the volume name is provided instead of the key or
4080 path, then providing the pool is necessary to find the volume to be
4081 wiped; otherwise, the first volume found by the key or path will be
4082 used.
4083
4084 Use the --algorithm switch choosing from the list of the following
4085 algorithms in order to define which algorithm to use for the wipe.
4086
4087 Supported algorithms
4088 zero - 1-pass all zeroes
4089 nnsa - 4-pass NNSA Policy Letter NAP-14.1-C (XVI-8) for
4090 sanitizing removable and non-removable hard disks:
4091 random x2, 0x00, verify.
4092 dod - 4-pass DoD 5220.22-M section 8-306 procedure for
4093 sanitizing removable and non-removable rigid
4094 disks: random, 0x00, 0xff, verify.
4095 bsi - 9-pass method recommended by the German Center of
4096 Security in Information Technologies
4097 (http://www.bsi.bund.de): 0xff, 0xfe, 0xfd, 0xfb,
4098 0xf7, 0xef, 0xdf, 0xbf, 0x7f.
4099 gutmann - The canonical 35-pass sequence described in
4100 Gutmann's paper.
4101 schneier - 7-pass method described by Bruce Schneier in
4102 "Applied Cryptography" (1996): 0x00, 0xff,
4103 random x5.
4104 pfitzner7 - Roy Pfitzner's 7-random-pass method: random x7.
4105 pfitzner33 - Roy Pfitzner's 33-random-pass method: random x33.
4106 random - 1-pass pattern: random.
4107 trim - 1-pass trimming the volume using TRIM or DISCARD
4108
4109 Note: The "scrub" binary will be used to handle the 'nnsa', 'dod',
4110 'bsi', 'gutmann', 'schneier', 'pfitzner7' and 'pfitzner33'
4111 algorithms. The availability of the algorithms may be limited by
4112 the version of the "scrub" binary installed on the host. The 'zero'
4113 algorithm will write zeroes to the entire volume. For some volumes,
4114 such as sparse or rbd volumes, this may result in completely
4115 filling the volume with zeroes making it appear to be completely
4116 full. As an alternative, the 'trim' algorithm does not overwrite
4117 all the data in a volume, rather it expects the storage driver to
4118 be able to discard all bytes in a volume. It is up to the storage
4119 driver to handle how the discarding occurs. Not all storage drivers
4120 or volume types can support 'trim'.
4121
4122 vol-dumpxml vol-name-or-key-or-path [--pool pool-or-uuid]
4123 Output the volume information as an XML dump to stdout.
4124
4125 vol-name-or-key-or-path is the name or key or path of the volume to
4126 output the XML.
4127
4128 --pool pool-or-uuid is the name or UUID of the storage pool the
4129 volume is in. If the volume name is provided instead of the key or
4130 path, then providing the pool is necessary to find the volume to be
4131 uploaded into; otherwise, the first volume found by the key or path
4132 will be used.
4133
4134 vol-info vol-name-or-key-or-path [--pool pool-or-uuid] [--bytes]
4135 [--physical]
4136 Returns basic information about the given storage volume.
4137
4138 vol-name-or-key-or-path is the name or key or path of the volume to
4139 return information for.
4140
4141 --pool pool-or-uuid is the name or UUID of the storage pool the
4142 volume is in. If the volume name is provided instead of the key or
4143 path, then providing the pool is necessary to find the volume to be
4144 uploaded into; otherwise, the first volume found by the key or path
4145 will be used.
4146
4147 If --bytes is specified the sizes are not converted to human
4148 friendly units.
4149
4150 If --physical is specified, then the host physical size is returned
4151 and displayed instead of the allocation value. The physical value
4152 for some file types, such as qcow2 may have a different (larger)
4153 physical value than is shown for allocation. Additionally sparse
4154 files will have different physical and allocation values.
4155
4156 vol-list [--pool pool-or-uuid] [--details]
4157 Return the list of volumes in the given storage pool.
4158
4159 --pool pool-or-uuid is the name or UUID of the storage pool.
4160
4161 The --details option instructs virsh to additionally display volume
4162 type and capacity related information where available.
4163
4164 vol-pool vol-key-or-path [--uuid]
4165 Return the pool name or UUID for a given volume. By default, the
4166 pool name is returned.
4167
4168 vol-key-or-path is the key or path of the volume to return the pool
4169 information.
4170
4171 If the --uuid option is given, the pool UUID is returned instead.
4172
4173 vol-path vol-name-or-key [--pool pool-or-uuid]
4174 Return the path for a given volume.
4175
4176 vol-name-or-key is the name or key of the volume to return the
4177 path.
4178
4179 --pool pool-or-uuid is the name or UUID of the storage pool the
4180 volume is in. If the volume name is provided instead of the key,
4181 then providing the pool is necessary to find the volume to be
4182 uploaded into; otherwise, the first volume found by the key will be
4183 used.
4184
4185 vol-name vol-key-or-path
4186 Return the name for a given volume.
4187
4188 vol-key-or-path is the key or path of the volume to return the
4189 name.
4190
4191 vol-key vol-name-or-path [--pool pool-or-uuid]
4192 Return the volume key for a given volume.
4193
4194 vol-name-or-path is the name or path of the volume to return the
4195 volume key.
4196
4197 --pool pool-or-uuid is the name or UUID of the storage pool the
4198 volume is in. If the volume name is provided instead of the path,
4199 then providing the pool is necessary to find the volume to be
4200 uploaded into; otherwise, the first volume found by the path will
4201 be used.
4202
4203 vol-resize vol-name-or-path capacity [--pool pool-or-uuid] [--allocate]
4204 [--delta] [--shrink]
4205 Resize the capacity of the given volume, in bytes.
4206
4207 vol-name-or-key-or-path is the name or key or path of the volume to
4208 resize.
4209
4210 capacity is a scaled integer (see NOTES above) for the volume,
4211 which defaults to bytes if there is no suffix.
4212
4213 --pool pool-or-uuid is the name or UUID of the storage pool the
4214 volume is in. If the volume name is provided instead of the key or
4215 path, then providing the pool is necessary to find the volume to be
4216 uploaded into; otherwise, the first volume found by the key or path
4217 will be used.
4218
4219 The new capacity might be sparse unless --allocate is specified.
4220
4221 Normally, capacity is the new size, but if --delta is present, then
4222 it is added to the existing size.
4223
4224 Attempts to shrink the volume will fail unless --shrink is present.
4225 The capacity cannot be negative unless --shrink is provided, but a
4226 negative sign is not necessary.
4227
4228 This command is only safe for storage volumes not in use by an
4229 active guest; see also blockresize for live resizing.
4230
4232 The following commands manipulate "secrets" (e.g. passwords,
4233 passphrases and encryption keys). Libvirt can store secrets
4234 independently from their use, and other objects (e.g. volumes or
4235 domains) can refer to the secrets for encryption or possibly other
4236 uses. Secrets are identified using a UUID. See
4237 <https://libvirt.org/formatsecret.html> for documentation of the XML
4238 format used to represent properties of secrets.
4239
4240 secret-define file
4241 Create a secret with the properties specified in file, with no
4242 associated secret value. If file does not specify a UUID, choose
4243 one automatically. If file specifies a UUID of an existing secret,
4244 replace its properties by properties defined in file, without
4245 affecting the secret value.
4246
4247 secret-dumpxml secret
4248 Output properties of secret (specified by its UUID) as an XML dump
4249 to stdout.
4250
4251 secret-event {[secret] event [--loop] [--timeout seconds] [--timestamp]
4252 | --list}
4253 Wait for a class of secret events to occur, and print appropriate
4254 details of events as they happen. The events can optionally be
4255 filtered by secret. Using --list as the only argument will provide
4256 a list of possible event values known by this client, although the
4257 connection might not allow registering for all these events.
4258
4259 By default, this command is one-shot, and returns success once an
4260 event occurs; you can send SIGINT (usually via "Ctrl-C") to quit
4261 immediately. If --timeout is specified, the command gives up
4262 waiting for events after seconds have elapsed. With --loop, the
4263 command prints all events until a timeout or interrupt key.
4264
4265 When --timestamp is used, a human-readable timestamp will be
4266 printed before the event.
4267
4268 secret-set-value secret base64
4269 Set the value associated with secret (specified by its UUID) to the
4270 value Base64-encoded value base64.
4271
4272 secret-get-value secret
4273 Output the value associated with secret (specified by its UUID) to
4274 stdout, encoded using Base64.
4275
4276 secret-undefine secret
4277 Delete a secret (specified by its UUID), including the associated
4278 value, if any.
4279
4280 secret-list [--ephemeral] [--no-ephemeral] [--private] [--no-private]
4281 Returns the list of secrets. You may also want to filter the
4282 returned secrets by --ephemeral to list the ephemeral ones,
4283 --no-ephemeral to list the non-ephemeral ones, --private to list
4284 the private ones, and --no-private to list the non-private ones.
4285
4287 The following commands manipulate domain snapshots. Snapshots take the
4288 disk, memory, and device state of a domain at a point-of-time, and save
4289 it for future use. They have many uses, from saving a "clean" copy of
4290 an OS image to saving a domain's state before a potentially destructive
4291 operation. Snapshots are identified with a unique name. See
4292 <https://libvirt.org/formatsnapshot.html> for documentation of the XML
4293 format used to represent properties of snapshots.
4294
4295 snapshot-create domain [xmlfile] {[--redefine [--current]] |
4296 [--no-metadata] [--halt] [--disk-only] [--reuse-external] [--quiesce]
4297 [--atomic] [--live]}
4298 Create a snapshot for domain domain with the properties specified
4299 in xmlfile. Normally, the only properties settable for a domain
4300 snapshot are the <name> and <description> elements, as well as
4301 <disks> if --disk-only is given; the rest of the fields are
4302 ignored, and automatically filled in by libvirt. If xmlfile is
4303 completely omitted, then libvirt will choose a value for all
4304 fields. The new snapshot will become current, as listed by
4305 snapshot-current.
4306
4307 If --halt is specified, the domain will be left in an inactive
4308 state after the snapshot is created.
4309
4310 If --disk-only is specified, the snapshot will only include disk
4311 content rather than the usual full system snapshot with vm state.
4312 Disk snapshots are captured faster than full system snapshots, but
4313 reverting to a disk snapshot may require fsck or journal replays,
4314 since it is like the disk state at the point when the power cord is
4315 abruptly pulled; and mixing --halt and --disk-only loses any data
4316 that was not flushed to disk at the time.
4317
4318 If --redefine is specified, then all XML elements produced by
4319 snapshot-dumpxml are valid; this can be used to migrate snapshot
4320 hierarchy from one machine to another, to recreate hierarchy for
4321 the case of a transient domain that goes away and is later
4322 recreated with the same name and UUID, or to make slight
4323 alterations in the snapshot metadata (such as host-specific aspects
4324 of the domain XML embedded in the snapshot). When this flag is
4325 supplied, the xmlfile argument is mandatory, and the domain's
4326 current snapshot will not be altered unless the --current flag is
4327 also given.
4328
4329 If --no-metadata is specified, then the snapshot data is created,
4330 but any metadata is immediately discarded (that is, libvirt does
4331 not treat the snapshot as current, and cannot revert to the
4332 snapshot unless --redefine is later used to teach libvirt about the
4333 metadata again).
4334
4335 If --reuse-external is specified, and the snapshot XML requests an
4336 external snapshot with a destination of an existing file, then the
4337 destination must exist and be pre-created with correct format and
4338 metadata. The file is then reused; otherwise, a snapshot is refused
4339 to avoid losing contents of the existing files.
4340
4341 If --quiesce is specified, libvirt will try to use guest agent to
4342 freeze and unfreeze domain's mounted file systems. However, if
4343 domain has no guest agent, snapshot creation will fail. Currently,
4344 this requires --disk-only to be passed as well.
4345
4346 If --atomic is specified, libvirt will guarantee that the snapshot
4347 either succeeds, or fails with no changes; not all hypervisors
4348 support this. If this flag is not specified, then some hypervisors
4349 may fail after partially performing the action, and dumpxml must be
4350 used to see whether any partial changes occurred.
4351
4352 If --live is specified, libvirt takes the snapshot while the guest
4353 is running. Both disk snapshot and domain memory snapshot are
4354 taken. This increases the size of the memory image of the external
4355 snapshot. This is currently supported only for full system external
4356 snapshots.
4357
4358 Existence of snapshot metadata will prevent attempts to undefine a
4359 persistent domain. However, for transient domains, snapshot
4360 metadata is silently lost when the domain quits running (whether by
4361 command such as destroy or by internal guest action).
4362
4363 snapshot-create-as domain {[--print-xml] | [--no-metadata] [--halt]
4364 [--reuse-external]} [name] [description] [--disk-only [--quiesce]]
4365 [--atomic] [[--live] [--memspec memspec]] [--diskspec] diskspec]...
4366 Create a snapshot for domain domain with the given <name> and
4367 <description>; if either value is omitted, libvirt will choose a
4368 value. If --print-xml is specified, then XML appropriate for
4369 snapshot-create is output, rather than actually creating a
4370 snapshot. Otherwise, if --halt is specified, the domain will be
4371 left in an inactive state after the snapshot is created, and if
4372 --disk-only is specified, the snapshot will not include vm state.
4373
4374 The --memspec option can be used to control whether a full system
4375 snapshot is internal or external. The --memspec flag is mandatory,
4376 followed by a memspec of the form [file=]name[,snapshot=type],
4377 where type can be no, internal, or external. To include a literal
4378 comma in file=name, escape it with a second comma. --memspec cannot
4379 be used together with --disk-only.
4380
4381 The --diskspec option can be used to control how --disk-only and
4382 external full system snapshots create external files. This option
4383 can occur multiple times, according to the number of <disk>
4384 elements in the domain xml. Each <diskspec> is in the form
4385 disk[,snapshot=type][,driver=type][,file=name]. A diskspec must be
4386 provided for disks backed by block devices as libvirt doesn't auto-
4387 generate file names for those. To include a literal comma in disk
4388 or in file=name, escape it with a second comma. A literal
4389 --diskspec must precede each diskspec unless all three of domain,
4390 name, and description are also present. For example, a diskspec of
4391 "vda,snapshot=external,file=/path/to,,new" results in the following
4392 XML:
4393 <disk name='vda' snapshot='external'>
4394 <source file='/path/to,new'/>
4395 </disk>
4396
4397 If --reuse-external is specified, and the domain XML or diskspec
4398 option requests an external snapshot with a destination of an
4399 existing file, then the destination must exist and be pre-created
4400 with correct format and metadata. The file is then reused;
4401 otherwise, a snapshot is refused to avoid losing contents of the
4402 existing files.
4403
4404 If --quiesce is specified, libvirt will try to use guest agent to
4405 freeze and unfreeze domain's mounted file systems. However, if
4406 domain has no guest agent, snapshot creation will fail. Currently,
4407 this requires --disk-only to be passed as well.
4408
4409 If --no-metadata is specified, then the snapshot data is created,
4410 but any metadata is immediately discarded (that is, libvirt does
4411 not treat the snapshot as current, and cannot revert to the
4412 snapshot unless snapshot-create is later used to teach libvirt
4413 about the metadata again). This flag is incompatible with
4414 --print-xml.
4415
4416 If --atomic is specified, libvirt will guarantee that the snapshot
4417 either succeeds, or fails with no changes; not all hypervisors
4418 support this. If this flag is not specified, then some hypervisors
4419 may fail after partially performing the action, and dumpxml must be
4420 used to see whether any partial changes occurred.
4421
4422 If --live is specified, libvirt takes the snapshot while the guest
4423 is running. This increases the size of the memory image of the
4424 external snapshot. This is currently supported only for external
4425 full system snapshots.
4426
4427 snapshot-current domain {[--name] | [--security-info] | [snapshotname]}
4428 Without snapshotname, this will output the snapshot XML for the
4429 domain's current snapshot (if any). If --name is specified, just
4430 the current snapshot name instead of the full xml. Otherwise,
4431 using --security-info will also include security sensitive
4432 information in the XML.
4433
4434 With snapshotname, this is a request to make the existing named
4435 snapshot become the current snapshot, without reverting the domain.
4436
4437 snapshot-edit domain [snapshotname] [--current] {[--rename] |
4438 [--clone]}
4439 Edit the XML configuration file for snapshotname of a domain. If
4440 both snapshotname and --current are specified, also force the
4441 edited snapshot to become the current snapshot. If snapshotname is
4442 omitted, then --current must be supplied, to edit the current
4443 snapshot.
4444
4445 This is equivalent to:
4446
4447 virsh snapshot-dumpxml dom name > snapshot.xml
4448 vi snapshot.xml (or make changes with your other text editor)
4449 virsh snapshot-create dom snapshot.xml --redefine [--current]
4450
4451 except that it does some error checking.
4452
4453 The editor used can be supplied by the $VISUAL or $EDITOR
4454 environment variables, and defaults to "vi".
4455
4456 If --rename is specified, then the edits can change the snapshot
4457 name. If --clone is specified, then changing the snapshot name
4458 will create a clone of the snapshot metadata. If neither is
4459 specified, then the edits must not change the snapshot name. Note
4460 that changing a snapshot name must be done with care, since the
4461 contents of some snapshots, such as internal snapshots within a
4462 single qcow2 file, are accessible only from the original name.
4463
4464 snapshot-info domain {snapshot | --current}
4465 Output basic information about a named <snapshot>, or the current
4466 snapshot with --current.
4467
4468 snapshot-list domain [--metadata] [--no-metadata] [{--parent | --roots
4469 | [{--tree | --name}]}] [{[--from] snapshot | --current}
4470 [--descendants]] [--leaves] [--no-leaves] [--inactive] [--active]
4471 [--disk-only] [--internal] [--external]
4472 List all of the available snapshots for the given domain,
4473 defaulting to show columns for the snapshot name, creation time,
4474 and domain state.
4475
4476 If --parent is specified, add a column to the output table giving
4477 the name of the parent of each snapshot. If --roots is specified,
4478 the list will be filtered to just snapshots that have no parents.
4479 If --tree is specified, the output will be in a tree format,
4480 listing just snapshot names. These three options are mutually
4481 exclusive. If --name is specified only the snapshot name is
4482 printed. This option is mutually exclusive with --tree.
4483
4484 If --from is provided, filter the list to snapshots which are
4485 children of the given snapshot; or if --current is provided, start
4486 at the current snapshot. When used in isolation or with --parent,
4487 the list is limited to direct children unless --descendants is also
4488 present. When used with --tree, the use of --descendants is
4489 implied. This option is not compatible with --roots. Note that
4490 the starting point of --from or --current is not included in the
4491 list unless the --tree option is also present.
4492
4493 If --leaves is specified, the list will be filtered to just
4494 snapshots that have no children. Likewise, if --no-leaves is
4495 specified, the list will be filtered to just snapshots with
4496 children. (Note that omitting both options does no filtering,
4497 while providing both options will either produce the same list or
4498 error out depending on whether the server recognizes the flags).
4499 Filtering options are not compatible with --tree.
4500
4501 If --metadata is specified, the list will be filtered to just
4502 snapshots that involve libvirt metadata, and thus would prevent
4503 undefine of a persistent domain, or be lost on destroy of a
4504 transient domain. Likewise, if --no-metadata is specified, the
4505 list will be filtered to just snapshots that exist without the need
4506 for libvirt metadata.
4507
4508 If --inactive is specified, the list will be filtered to snapshots
4509 that were taken when the domain was shut off. If --active is
4510 specified, the list will be filtered to snapshots that were taken
4511 when the domain was running, and where the snapshot includes the
4512 memory state to revert to that running state. If --disk-only is
4513 specified, the list will be filtered to snapshots that were taken
4514 when the domain was running, but where the snapshot includes only
4515 disk state.
4516
4517 If --internal is specified, the list will be filtered to snapshots
4518 that use internal storage of existing disk images. If --external
4519 is specified, the list will be filtered to snapshots that use
4520 external files for disk images or memory state.
4521
4522 snapshot-dumpxml domain snapshot [--security-info]
4523 Output the snapshot XML for the domain's snapshot named snapshot.
4524 Using --security-info will also include security sensitive
4525 information. Use snapshot-current to easily access the XML of the
4526 current snapshot.
4527
4528 snapshot-parent domain {snapshot | --current}
4529 Output the name of the parent snapshot, if any, for the given
4530 snapshot, or for the current snapshot with --current.
4531
4532 snapshot-revert domain {snapshot | --current} [{--running | --paused}]
4533 [--force]
4534 Revert the given domain to the snapshot specified by snapshot, or
4535 to the current snapshot with --current. Be aware that this is a
4536 destructive action; any changes in the domain since the last
4537 snapshot was taken will be lost. Also note that the state of the
4538 domain after snapshot-revert is complete will be the state of the
4539 domain at the time the original snapshot was taken.
4540
4541 Normally, reverting to a snapshot leaves the domain in the state it
4542 was at the time the snapshot was created, except that a disk
4543 snapshot with no vm state leaves the domain in an inactive state.
4544 Passing either the --running or --paused flag will perform
4545 additional state changes (such as booting an inactive domain, or
4546 pausing a running domain). Since transient domains cannot be
4547 inactive, it is required to use one of these flags when reverting
4548 to a disk snapshot of a transient domain.
4549
4550 There are two cases where a snapshot revert involves extra risk,
4551 which requires the use of --force to proceed. One is the case of a
4552 snapshot that lacks full domain information for reverting
4553 configuration (such as snapshots created prior to libvirt 0.9.5);
4554 since libvirt cannot prove that the current configuration matches
4555 what was in use at the time of the snapshot, supplying --force
4556 assures libvirt that the snapshot is compatible with the current
4557 configuration (and if it is not, the domain will likely fail to
4558 run). The other is the case of reverting from a running domain to
4559 an active state where a new hypervisor has to be created rather
4560 than reusing the existing hypervisor, because it implies drawbacks
4561 such as breaking any existing VNC or Spice connections; this
4562 condition happens with an active snapshot that uses a provably
4563 incompatible configuration, as well as with an inactive snapshot
4564 that is combined with the --start or --pause flag.
4565
4566 snapshot-delete domain {snapshot | --current} [--metadata] [{--children
4567 | --children-only}]
4568 Delete the snapshot for the domain named snapshot, or the current
4569 snapshot with --current. If this snapshot has child snapshots,
4570 changes from this snapshot will be merged into the children. If
4571 --children is passed, then delete this snapshot and any children of
4572 this snapshot. If --children-only is passed, then delete any
4573 children of this snapshot, but leave this snapshot intact. These
4574 two flags are mutually exclusive.
4575
4576 If --metadata is specified, then only delete the snapshot metadata
4577 maintained by libvirt, while leaving the snapshot contents intact
4578 for access by external tools; otherwise deleting a snapshot also
4579 removes the data contents from that point in time.
4580
4582 The following commands manipulate network filters. Network filters
4583 allow filtering of the network traffic coming from and going to virtual
4584 machines. Individual network traffic filters are written in XML and
4585 may contain references to other network filters, describe traffic
4586 filtering rules, or contain both. Network filters are referenced by
4587 virtual machines from within their interface description. A network
4588 filter may be referenced by multiple virtual machines' interfaces.
4589
4590 nwfilter-define xmlfile
4591 Make a new network filter known to libvirt. If a network filter
4592 with the same name already exists, it will be replaced with the new
4593 XML. Any running virtual machine referencing this network filter
4594 will have its network traffic rules adapted. If for any reason the
4595 network traffic filtering rules cannot be instantiated by any of
4596 the running virtual machines, then the new XML will be rejected.
4597
4598 nwfilter-undefine nwfilter-name
4599 Delete a network filter. The deletion will fail if any running
4600 virtual machine is currently using this network filter.
4601
4602 nwfilter-list
4603 List all of the available network filters.
4604
4605 nwfilter-dumpxml nwfilter-name
4606 Output the network filter XML.
4607
4608 nwfilter-edit nwfilter-name
4609 Edit the XML of a network filter.
4610
4611 This is equivalent to:
4612
4613 virsh nwfilter-dumpxml myfilter > myfilter.xml
4614 vi myfilter.xml (or make changes with your other text editor)
4615 virsh nwfilter-define myfilter.xml
4616
4617 except that it does some error checking. The new network filter
4618 may be rejected due to the same reason as mentioned in nwfilter-
4619 define.
4620
4621 The editor used can be supplied by the $VISUAL or $EDITOR
4622 environment variables, and defaults to "vi".
4623
4625 The following commands manipulate network filter bindings. Network
4626 filter bindings track the association between a network port and a
4627 network filter. Generally the bindings are managed automatically by the
4628 hypervisor drivers when adding/removing NICs on a guest.
4629
4630 If an admin is creating/deleting TAP devices for non-guest usage,
4631 however, the network filter binding commands provide a way to make use
4632 of the network filters directly.
4633
4634 nwfilter-binding-create xmlfile
4635 Associate a network port with a network filter. The network filter
4636 backend will immediately attempt to instantiate the filter rules on
4637 the port. This command may be used to associate a filter with a
4638 currently running guest that does not have a filter defined for a
4639 specific network port. Since the bindings are generally
4640 automatically managed by the hypervisor, using this command to
4641 define a filter for a network port and then starting the guest
4642 afterwards may prevent the guest from starting if it attempts to
4643 use the network port and finds a filter already defined.
4644
4645 nwfilter-binding-delete port-name
4646 Disassociate a network port from a network filter. The network
4647 filter backend will immediately tear down the filter rules that
4648 exist on the port. This command may be used to remove the network
4649 port binding for a filter currently in use for the guest while the
4650 guest is running without needing to restart the guest. Restoring
4651 the network port binding filter for the running guest would be
4652 accomplished by using nwfilter-binding-create.
4653
4654 nwfilter-binding-list
4655 List all of the network ports which have filters associated with
4656 them.
4657
4658 nwfilter-binding-dumpxml port-name
4659 Output the network filter binding XML for the network device called
4660 "port-name".
4661
4663 NOTE: Use of the following commands is strongly discouraged. They can
4664 cause libvirt to become confused and do the wrong thing on subsequent
4665 operations. Once you have used these commands, please do not report
4666 problems to the libvirt developers; the reports will be ignored. If
4667 you find that these commands are the only way to accomplish something,
4668 then it is better to request that the feature be added as a first-class
4669 citizen in the regular libvirt library.
4670
4671 qemu-attach pid
4672 Attach an externally launched QEMU process to the libvirt QEMU
4673 driver. The QEMU process must have been created with a monitor
4674 connection using the UNIX driver. Ideally the process will also
4675 have had the '-name' argument specified.
4676
4677 $ qemu-kvm -cdrom ~/demo.iso \
4678 -monitor unix:/tmp/demo,server,nowait \
4679 -name foo \
4680 -uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea &
4681 $ QEMUPID=$!
4682 $ virsh qemu-attach $QEMUPID
4683
4684 Not all functions of libvirt are expected to work reliably after
4685 attaching to an externally launched QEMU process. There may be
4686 issues with the guest ABI changing upon migration and device
4687 hotplug or hotunplug may not work. The attached environment should
4688 be considered primarily read-only.
4689
4690 qemu-monitor-command domain { [--hmp] | [--pretty] } command...
4691 Send an arbitrary monitor command command to domain domain through
4692 the qemu monitor. The results of the command will be printed on
4693 stdout. If --hmp is passed, the command is considered to be a
4694 human monitor command and libvirt will automatically convert it
4695 into QMP if needed. In that case the result will also be converted
4696 back from QMP. If --pretty is given, and the monitor uses QMP,
4697 then the output will be pretty-printed. If more than one argument
4698 is provided for command, they are concatenated with a space in
4699 between before passing the single command to the monitor.
4700
4701 qemu-agent-command domain [--timeout seconds | --async | --block]
4702 command...
4703 Send an arbitrary guest agent command command to domain domain
4704 through qemu agent. --timeout, --async and --block options are
4705 exclusive. --timeout requires timeout seconds seconds and it must
4706 be positive. When --aysnc is given, the command waits for timeout
4707 whether success or failed. And when --block is given, the command
4708 waits forever with blocking timeout.
4709
4710 qemu-monitor-event [domain] [--event event-name] [--loop] [--timeout
4711 seconds] [--pretty] [--regex] [--no-case] [--timestamp]
4712 Wait for arbitrary QEMU monitor events to occur, and print out the
4713 details of events as they happen. The events can optionally be
4714 filtered by domain or event-name. The 'query-events' QMP command
4715 can be used via qemu-monitor-command to learn what events are
4716 supported. If --regex is used, event-name is a basic regular
4717 expression instead of a literal string. If --no-case is used,
4718 event-name will match case-insensitively.
4719
4720 By default, this command is one-shot, and returns success once an
4721 event occurs; you can send SIGINT (usually via "Ctrl-C") to quit
4722 immediately. If --timeout is specified, the command gives up
4723 waiting for events after seconds have elapsed. With --loop, the
4724 command prints all events until a timeout or interrupt key. If
4725 --pretty is specified, any JSON event details are pretty-printed
4726 for better legibility.
4727
4728 When --timestamp is used, a human-readable timestamp will be
4729 printed before the event, and the timing information provided by
4730 QEMU will be omitted.
4731
4732 lxc-enter-namespace domain [--noseclabel] -- /path/to/binary [arg1,
4733 [arg2, ...]]
4734 Enter the namespace of domain and execute the command
4735 "/path/to/binary" passing the requested args. The binary path is
4736 relative to the container root filesystem, not the host root
4737 filesystem. The binary will inherit the environment variables /
4738 console visible to virsh. The command will be run with the same
4739 sVirt context and cgroups placement as processes within the
4740 container. This command only works when connected to the LXC
4741 hypervisor driver. This command succeeds only if "/path/to/binary"
4742 has 0 exit status.
4743
4744 By default the new process will run with the security label of the
4745 new parent container. Use the --noseclabel option to instead have
4746 the process keep the same security label as "virsh".
4747
4749 The following environment variables can be set to alter the behaviour
4750 of "virsh"
4751
4752 VIRSH_DEBUG=<0 to 4>
4753 Turn on verbose debugging of virsh commands. Valid levels are
4754
4755 · VIRSH_DEBUG=0
4756
4757 DEBUG - Messages at ALL levels get logged
4758
4759 · VIRSH_DEBUG=1
4760
4761 INFO - Logs messages at levels INFO, NOTICE, WARNING and ERROR
4762
4763 · VIRSH_DEBUG=2
4764
4765 NOTICE - Logs messages at levels NOTICE, WARNING and ERROR
4766
4767 · VIRSH_DEBUG=3
4768
4769 WARNING - Logs messages at levels WARNING and ERROR
4770
4771 · VIRSH_DEBUG=4
4772
4773 ERROR - Messages at only ERROR level gets logged.
4774
4775 VIRSH_LOG_FILE="LOGFILE"
4776 The file to log virsh debug messages.
4777
4778 VIRSH_DEFAULT_CONNECT_URI
4779 The hypervisor to connect to by default. Set this to a URI, in the
4780 same format as accepted by the connect option. This environment
4781 variable is deprecated in favour of the global LIBVIRT_DEFAULT_URI
4782 variable which serves the same purpose.
4783
4784 LIBVIRT_DEFAULT_URI
4785 The hypervisor to connect to by default. Set this to a URI, in the
4786 same format as accepted by the connect option. This overrides the
4787 default URI set in any client config file and prevents libvirt from
4788 probing for drivers.
4789
4790 VISUAL
4791 The editor to use by the edit and related options.
4792
4793 EDITOR
4794 The editor to use by the edit and related options, if "VISUAL" is
4795 not set.
4796
4797 VIRSH_HISTSIZE
4798 The number of commands to remember in the command history. The
4799 default value is 500.
4800
4801 LIBVIRT_DEBUG=LEVEL
4802 Turn on verbose debugging of all libvirt API calls. Valid levels
4803 are
4804
4805 · LIBVIRT_DEBUG=1
4806
4807 Messages at level DEBUG or above
4808
4809 · LIBVIRT_DEBUG=2
4810
4811 Messages at level INFO or above
4812
4813 · LIBVIRT_DEBUG=3
4814
4815 Messages at level WARNING or above
4816
4817 · LIBVIRT_DEBUG=4
4818
4819 Messages at level ERROR
4820
4821 For further information about debugging options consult
4822 <https://libvirt.org/logging.html>
4823
4825 Report any bugs discovered to the libvirt community via the mailing
4826 list <https://libvirt.org/contact.html> or bug tracker
4827 <https://libvirt.org/bugs.html>. Alternatively report bugs to your
4828 software distributor / vendor.
4829
4831 Please refer to the AUTHORS file distributed with libvirt.
4832
4833 Based on the xm man page by:
4834 Sean Dague <sean at dague dot net>
4835 Daniel Stekloff <dsteklof at us dot ibm dot com>
4836
4838 Copyright (C) 2005, 2007-2015 Red Hat, Inc., and the authors listed in
4839 the libvirt AUTHORS file.
4840
4842 virsh is distributed under the terms of the GNU LGPL v2+. This is free
4843 software; see the source for copying conditions. There is NO warranty;
4844 not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
4845
4847 virt-install(1), virt-xml-validate(1), virt-top(1), virt-df(1),
4848 <https://libvirt.org/>
4849
4850
4851
4852libvirt-5.1.0 2019-02-28 VIRSH(1)