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