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