virsh
management user interface
- Provided by: libvirt-bin (Version: 1.2.2-0ubuntu13.1.28)
- Source: libvirt
- Report a bug
management user interface
virsh [OPTION]... [COMMAND_STRING]
virsh [OPTION]... COMMAND [ARG]...
The virsh program is the main interface for managing virsh guest domains. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains. Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). It is free software available under the GNU Lesser General Public License. Virtualization of the Linux Operating System means the ability to run multiple instances of Operating Systems concurrently on a single hardware system where the basic resources are driven by a Linux instance. The library aims at providing a long term stable C API. It currently supports Xen, QEmu, KVM, LXC, OpenVZ, VirtualBox and VMware ESX.
The basic structure of most virsh usage is:
virsh [OPTION]... <command> <domain> [ARG]...
Where command is one of the commands listed below; domain is the numeric domain id, or the domain name, or the domain UUID; and ARGS are command specific options. There are a few exceptions to this rule in the cases where the command in question acts on all domains, the entire machine, or directly on the xen hypervisor. Those exceptions will be clear for each of those commands. Note: it is permissible to give numeric names to domains, however, doing so will result in a domain that can only be identified by domain id. In other words, if a numeric value is supplied it will be interpreted as a domain id, not as a name.
The virsh program can be used either to run one COMMAND by giving the command and its arguments on the shell command line, or a COMMAND_STRING which is a single shell argument consisting of multiple COMMAND actions and their arguments joined with whitespace, and separated by semicolons between commands. Within COMMAND_STRING, virsh understands the same single, double, and backslash escapes as the shell, although you must add another layer of shell escaping in creating the single shell argument. If no command is given in the command line, virsh will then start a minimal interpreter waiting for your commands, and the quit command will then exit the program.
The virsh program understands the following OPTIONS.
Most virsh operations rely upon the libvirt library being able to connect to an already running libvirtd service. This can usually be done using the command invoke-rc.d libvirt-bin start.
Most virsh commands require root privileges to run due to the communications channels used to talk to the hypervisor. Running as non root will return an error.
Most virsh commands act synchronously, except maybe shutdown, setvcpus and setmem. In those cases the fact that the virsh program returned, may not mean the action is complete and you must poll periodically to detect that the guest completed the operation.
virsh strives for backward compatibility. Although the help command only lists the preferred usage of a command, if an older version of virsh supported an alternate spelling of a command or option (such as --tunnelled instead of --tunneled), then scripts using that older spelling will continue to work.
Several virsh commands take an optionally scaled integer;
if no scale is provided, then the default is listed in the command (for
historical reasons, some commands default to bytes, while other commands
default to kibibytes). The following case-insensitive suffixes can be used
to select a specific scale:
b, byte byte 1
KB kilobyte 1,000
k, KiB kibibyte 1,024
MB megabyte 1,000,000
M, MiB mebibyte 1,048,576
GB gigabyte 1,000,000,000
G, GiB gibibyte 1,073,741,824
TB terabyte 1,000,000,000,000
T, TiB tebibyte 1,099,511,627,776
PB petabyte 1,000,000,000,000,000
P, PiB pebibyte 1,125,899,906,842,624
EB exabyte 1,000,000,000,000,000,000
E, EiB exbibyte 1,152,921,504,606,846,976
The following commands are generic i.e. not specific to a domain.
To display only commands for a specific group, give the keyword for that group as an option. For example:
virsh # help host
Host and Hypervisor (help keyword 'host'):
capabilities capabilities
cpu-models show the CPU models for an architecture
connect (re)connect to hypervisor
freecell NUMA free memory
hostname print the hypervisor hostname
qemu-attach Attach to existing QEMU process
qemu-monitor-command QEMU Monitor Command
qemu-agent-command QEMU Guest Agent Command
sysinfo print the hypervisor sysinfo
uri print the hypervisor canonical URI
To display detailed information for a specific command, give its name as the option instead. For example:
virsh # help list
NAME
list - list domains
SYNOPSIS
list [--inactive] [--all]
DESCRIPTION
Returns list of domains.
OPTIONS
--inactive list inactive domains
--all list inactive & active domains
virsh version
Compiled against library: libvir 0.0.6
Using library: libvir 0.0.6
Using API: Xen 3.0.0
Running hypervisor: Xen 3.0.0
This command is only available in interactive mode.
For remote access see the documentation page at <http://libvirt.org/uri.html> on how to make URIs. The --readonly option allows for read-only connection
Note: Currently the "shared memory service" only means KSM (Kernel Samepage Merging).
An example format for the list is as follows:
virsh list
Id Name State
----------------------------------------------------
0 Domain-0 running
2 fedora paused
Name is the name of the domain. ID the domain numeric id. State is the run state (see below).
STATES
The State field lists 8 states for a domain, and which ones the current domain is in.
Normally only active domains are listed. To list inactive domains specify --inactive or --all to list both active and inactive domains.
To further filter the list of domains you may specify one or more of filtering flags supported by the list command. These flags are grouped by function. Specifying one or more flags from a group enables the filter group. Note that some combinations of flags may yield no results. Supported filtering flags and groups:
When talking to older servers, this command is forced to use a series of API calls with an inherent race, where a domain might not be listed or might appear more than once if it changed state between calls while the list was being collected. Newer servers do not have this problem.
If --managed-save is specified, then domains that have managed save state (only possible if they are in the shut off state, so you need to specify --inactive or --all to actually list them) will instead show as saved in the listing. This flag is usable only with the default --table output. Note that this flag does not filter the list of domains.
If --name is specified, domain names are printed instead of the table formatted one per line. If --uuid is specified domain's UUID's are printed instead of names. Flag --table specifies that the legacy table-formatted output should be used. This is the default. All of these are mutually exclusive.
If --title is specified, then the short domain description (title) is printed in an extra column. This flag is usable only with the default --table output.
Example:
virsh list --title
Id Name State Title
--------------------------------------------------------------------------
0 Domain-0 running Mailserver 1
2 fedora paused
The following commands manipulate domains directly, as stated previously most commands take domain as the first parameter. The domain can be specified as a short integer, a name or a full UUID.
The option --disable disables autostarting.
If the flag --safe is specified, the connection is only attempted if the driver supports safe console handling. This flag specifies that the server has to ensure exclusive access to console devices. Optionally the --force flag may be specified, requesting to disconnect any existing sessions, such as in a case of a broken connection.
If --pass-fds is specified, the argument is a comma separated list of open file descriptors which should be pass on into the guest. The file descriptors will be re-numbered in the guest, starting from 3. This is only supported with container based virtualization.
Example
virsh dumpxml <domain> > domain.xml
vi domain.xml (or make changes with your other text editor)
virsh create domain.xml
Flags --live or --config select whether this command works on live or persistent definitions of the domain. If both --live and --config are specified, the --config option takes precedence on getting the current description and both live configuration and config are updated while setting the description. --current is exclusive and implied if none of these was specified.
Flag --edit specifies that an editor with the contents of current description or title should be opened and the contents saved back afterwards.
Flag --title selects operation on the title field instead of description.
If neither of --edit and --new-desc are specified the note or description is displayed instead of being modified.
If domain is transient, then the metadata of any snapshots will be lost once the guest stops running, but the snapshot contents still exist, and a new domain with the same name and UUID can restore the snapshot metadata with snapshot-create.
If --graceful is specified, don't resort to extreme measures (e.g. SIGKILL) when the guest doesn't stop after a reasonable timeout; return an error instead.
Use --human for a more human readable output.
Availability of these fields depends on hypervisor. Unsupported fields are missing from the output. Other fields may appear if communicating with a newer version of libvirtd.
Explanation of fields (fields appear in the following
order):
rd_req - count of read operations
rd_bytes - count of read bytes
wr_req - count of write operations
wr_bytes - count of written bytes
errs - error count
flush_operations - count of flush operations
rd_total_times - total time read operations took (ns)
wr_total_times - total time write operations took (ns)
flush_total_times - total time flush operations took (ns)
<-- other fields provided by hypervisor -->
interface-device can be the interface's target name or the MAC address.
If no --inbound or --outbound is specified, this command will query and show the bandwidth settings. Otherwise, it will set the inbound or outbound bandwidth. average,peak,burst is the same as in command attach-interface. Values for average and peak are expressed in kilobytes per second, while burst is expressed in kilobytes in a single burst at -peak speed as described in the Network XML documentation at <http://libvirt.org/formatnetwork.html#elementQoS>.
If --live is specified, affect a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state. Both --live and --current flags may be given, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
Depending on the hypervisor a variety of statistics can be returned
For QEMU/KVM with a memory balloon, setting the optional --period to a value larger than 0 in seconds will allow the balloon driver to return additional statistics which will be displayed by subsequent dommemstat commands. Setting the --period to 0 will stop the balloon driver collection, but does not clear the statistics in the balloon driver. Requires at least QEMU/KVM 1.5 to be running on the host.
The --live, --config, and --current flags are only valid when using the --period option in order to set the collection period for the balloon driver. If --live is specified, only the running guest collection period is affected. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state.
Both --live and --config flags may be given, but --current is exclusive. If no flag is specified, behavior is different depending on the guest state.
By default, this command returns as soon as possible, and data for the entire disk is committed in the background; the progress of the operation can be checked with blockjob. However, if --wait is specified, then this command will block until the operation completes, or cancel the operation if the optional timeout in seconds elapses or SIGINT is sent (usually with "Ctrl-C"). Using --verbose along with --wait will produce periodic status updates. If job cancellation is triggered, --async will return control to the user as fast as possible, otherwise the command may continue to block a little while longer until the job is done cleaning up.
path specifies fully-qualified path of the disk; it corresponds to a unique target name (<target dev='name'/>) or source file (<source file='name'/>) for one of the disk devices attached to domain (see also domblklist for listing these names). bandwidth specifies copying bandwidth limit in MiB/s, although for qemu, it may be non-zero only for an online domain.
If --reuse-external is specified, then dest must exist and have contents identical to the resulting backing file (that is, it must start with contents matching the backing file disk if --shallow is used, otherwise it must start empty); this option is typically used to set up a relative backing file name in the destination.
The format of the destination is determined by the first match in the following list: if --raw is specified, it will be raw; if --reuse-external is specified, the existing destination is probed for a format; and in all other cases, the destination format will match the source format.
By default, the copy job runs in the background, and consists of two phases. Initially, the job must copy all data from the source, and during this phase, the job can only be canceled to revert back to the source disk, with no guarantees about the destination. After this phase completes, both the source and the destination remain mirrored until a call to blockjob with the --abort and --pivot flags pivots over to the copy, or a call without --pivot leaves the destination as a faithful copy of that point in time. However, if --wait is specified, then this command will block until the mirroring phase begins, or cancel the operation if the optional timeout in seconds elapses or SIGINT is sent (usually with "Ctrl-C"). Using --verbose along with --wait will produce periodic status updates. Using --pivot or --finish along with --wait will additionally end the job cleanly rather than leaving things in the mirroring phase. If job cancellation is triggered, --async will return control to the user as fast as possible, otherwise the command may continue to block a little while longer until the job is done cleaning up.
path specifies fully-qualified path of the disk. bandwidth specifies copying bandwidth limit in MiB/s.
By default, this command returns as soon as possible, and data for the entire disk is pulled in the background; the progress of the operation can be checked with blockjob. However, if --wait is specified, then this command will block until the operation completes, or cancel the operation if the optional timeout in seconds elapses or SIGINT is sent (usually with "Ctrl-C"). Using --verbose along with --wait will produce periodic status updates. If job cancellation is triggered, --async will return control to the user as fast as possible, otherwise the command may continue to block a little while longer until the job is done cleaning up.
path specifies fully-qualified path of the disk; it corresponds to a unique target name (<target dev='name'/>) or source file (<source file='name'/>) for one of the disk devices attached to domain (see also domblklist for listing these names). bandwidth specifies copying bandwidth limit in MiB/s.
If no limit is specified, it will query current I/O limits setting. Otherwise, alter the limits with these flags: --total-bytes-sec specifies total throughput limit in bytes per second. --read-bytes-sec specifies read throughput limit in bytes per second. --write-bytes-sec specifies write throughput limit in bytes per second. --total-iops-sec specifies total I/O operations limit per second. --read-iops-sec specifies read I/O operations limit per second. --write-iops-sec specifies write I/O operations limit per second.
Older versions of virsh only accepted these options with underscore instead of dash, as in --total_bytes_sec.
Bytes and iops values are independent, but setting only one value (such as --read-bytes-sec) resets the other two in that category to unlimited. An explicit 0 also clears any limit. A non-zero value for a given total cannot be mixed with non-zero values for read or write.
If --live is specified, affect a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state. Both --live and --current flags may be given, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
path specifies fully-qualified path of the disk; it corresponds to a unique target name (<target dev='name'/>) or source file (<source file='name'/>) for one of the disk devices attached to domain (see also domblklist for listing these names).
If --abort is specified, the active job on the specified disk will be aborted. If --async is also specified, this command will return immediately, rather than waiting for the cancellation to complete. If --pivot is specified, this requests that an active copy job be pivoted over to the new copy. If --info is specified, the active job information on the specified disk will be printed. bandwidth can be used to set bandwidth limit for the active job.
size is a scaled integer (see NOTES above) which defaults to KiB (blocks of 1024 bytes) if there is no suffix. You must use a suffix of "B" to get bytes (note that for historical reasons, this differs from vol-resize which defaults to bytes without a suffix).
The progress may be monitored using domjobinfo virsh command and canceled with domjobabort command (sent by another virsh instance). Another option is to send SIGINT (usually with "Ctrl-C") to the virsh process running dump command. --verbose displays the progress of dump.
NOTE: Some hypervisors may require the user to manually ensure proper permissions on file and path specified by argument corefilepath.
This is equivalent to:
virsh dumpxml --inactive --security-info domain > domain.xml
vi domain.xml (or make changes with your other text editor)
virsh define domain.xml
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
By default, this command is one-shot, and returns success once an event occurs; you can send SIGINT (usually via "Ctrl-C") to quit immediately. If --timeout is specified, the command gives up waiting for events after seconds have elapsed. With --loop, the command prints all events until a timeout or interrupt key.
The progress may be monitored using domjobinfo virsh command and canceled with domjobabort command (sent by another virsh instance). Another option is to send SIGINT (usually with "Ctrl-C") to the virsh process running managedsave command. --verbose displays the progress of save.
Normally, starting a managed save will decide between running or paused based on the state the domain was in when the save was done; passing either the --running or --paused flag will allow overriding which state the start should use.
The dominfo command can be used to query whether a domain currently has any managed save image.
Note: Individual hypervisors usually do not support all possible types of migration. For example, QEMU does not support direct migration.
In some cases libvirt may refuse to migrate the domain because doing so may lead to potential problems such as data corruption, and thus the migration is considered unsafe. For QEMU domain, this may happen if the domain uses disks without explicitly setting cache mode to "none". Migrating such domains is unsafe unless the disk images are stored on coherent clustered filesystem, such as GFS2 or GPFS. If you are sure the migration is safe or you just do not care, use --unsafe to force the migration.
The desturi is the connection URI of the destination host, and migrateuri is the migration URI, which usually can be omitted (see below). dname is used for renaming the domain to new name during migration, which also usually can be omitted. Likewise, --xml file is usually omitted, but can be used to supply an alternative XML file for use on the destination to supply a larger set of changes to any host-specific portions of the domain XML, such as accounting for naming differences between source and destination in accessing underlying storage.
--timeout seconds forces guest to suspend when live migration exceeds that many seconds, and then the migration will complete offline. It can only be used with --live.
Running migration can be canceled by interrupting virsh (usually using "Ctrl-C") or by domjobabort command sent from another virsh instance.
Note: The desturi parameter for normal migration and peer2peer migration has different semantics:
When migrateuri is not specified, libvirt will automatically determine the hypervisor specific URI, by looking up the target host's configured hostname. There are a few scenarios where specifying migrateuri may help:
Optional graphicsuri overrides connection parameters used for automatically reconnecting a graphical clients at the end of migration. If omitted, libvirt will compute the parameters based on target host IP address. In case the client does not have a direct access to the network virtualization hosts are connected to and needs to connect through a proxy, graphicsuri may be used to specify the address the client should connect to. The URI is formed as follows:
protocol://hostname[:port]/[?parameters]
where protocol is either "spice" or "vnc" and parameters is a list of protocol specific parameters separated by '&'. Currently recognized parameters are "tlsPort" and "tlsSubject". For example,
spice://target.host.com:1234/?tlsPort=4567
Optional listen-address sets the listen address that hypervisor on the destination side should bind to for incoming migration. Both IPv4 and IPv6 addresses are accepted as well as hostnames (the resolving is done on destination). Some hypervisors do not support this feature and will return an error if this parameter is used.
mode can be one of `strict', `interleave' and `preferred'. For a running domain, the mode can't be changed, and the nodeset can be changed only if the domain was started with a mode of `strict'.
nodeset is a list of numa nodes used by the host for running the domain. Its syntax is a comma separated list, with '-' for ranges and '^' for excluding a node.
If --live is specified, set scheduler information of a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state.
The exact behavior of a domain when it reboots is set by the on_reboot parameter in the domain's XML definition.
By default the hypervisor will try to pick a suitable shutdown method. To specify an alternative method, the --mode parameter can specify a comma separated list which includes "acpi", "agent", "initctl" and "signal". The order in which drivers will try each mode is undefined, and not related to the order specified to virsh. For strict control over ordering, use a single mode at a time and repeat the command.
Note: Reset without any guest OS shutdown risks data loss.
If --bypass-cache is specified, the restore will avoid the file system cache, although this may slow down the operation.
--xml file is usually omitted, but can be used to supply an alternative XML file for use on the restored guest with changes only in the host-specific portions of the domain XML. For example, it can be used to account for file naming differences in underlying storage due to disk snapshots taken after the guest was saved.
Normally, restoring a saved image will use the state recorded in the save image to decide between running or paused; passing either the --running or --paused flag will allow overriding which state the domain should be started in.
Note: To avoid corrupting file system contents within the domain, you should not reuse the saved state file for a second restore unless you have also reverted all storage volumes back to the same contents as when the state file was created.
The progress may be monitored using domjobinfo virsh command and canceled with domjobabort command (sent by another virsh instance). Another option is to send SIGINT (usually with "Ctrl-C") to the virsh process running save command. --verbose displays the progress of save.
This is roughly equivalent to doing a hibernate on a running computer, with all the same limitations. Open network connections may be severed upon restore, as TCP timeouts may have expired.
--xml file is usually omitted, but can be used to supply an alternative XML file for use on the restored guest with changes only in the host-specific portions of the domain XML. For example, it can be used to account for file naming differences that are planned to be made via disk snapshots of underlying storage after the guest is saved.
Normally, restoring a saved image will decide between running or paused based on the state the domain was in when the save was done; passing either the --running or --paused flag will allow overriding which state the restore should use.
Domain saved state files assume that disk images will be unchanged between the creation and restore point. For a more complete system restore point, where the disk state is saved alongside the memory state, see the snapshot family of commands.
The save image records whether the domain should be restored to a running or paused state. Normally, this command does not alter the recorded state; passing either the --running or --paused flag will allow overriding which state the restore should use.
The save image records whether the domain should be restored to a running or paused state. Normally, this command does not alter the recorded state; passing either the --running or --paused flag will allow overriding which state the restore should use.
This is equivalent to:
virsh save-image-dumpxml state-file > state-file.xml
vi state-file.xml (or make changes with your other text editor)
virsh save-image-define state-file state-file-xml
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
LXC (posix scheduler) : cpu_shares
QEMU/KVM (posix scheduler): cpu_shares, vcpu_period, vcpu_quota, emulator_period, emulator_quota
Xen (credit scheduler): weight, cap
ESX (allocation scheduler): reservation, limit, shares
If --live is specified, set scheduler information of a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state.
Note: The cpu_shares parameter has a valid value range of 0-262144; Negative values are wrapped to positive, and larger values are capped at the maximum. Therefore, -1 is a useful shorthand for 262144. On the Linux kernel, the values 0 and 1 are automatically converted to a minimal value of 2.
Note: The weight and cap parameters are defined only for the XEN_CREDIT scheduler and are now DEPRECATED.
Note: The vcpu_period/emulator_period parameters have a valid value range of 1000-1000000 or 0, and the vcpu_quota/emulator_quota parameters have a valid value range of 1000-18446744073709551 or less than 0. The value 0 for either parameter is the same as not specifying that parameter.
If multiple keycodes are specified, they are all sent simultaneously to the guest, and they may be received in random order. If you need distinct keypresses, you must use multiple send-key invocations.
Examples
# send three strokes 'k', 'e', 'y', using xt codeset. these
# are all pressed simultaneously and may be received by the guest
# in random order
virsh send-key dom --codeset xt 37 18 21
# send one stroke 'right-ctrl+C' virsh send-key dom KEY_RIGHTCTRL KEY_C # send a tab, held for 1 second virsh send-key --holdtime 1000 0xf
The signame argument may be either an integer signal constant number, or one of the symbolic names:
"nop", "hup", "int", "quit", "ill",
"trap", "abrt", "bus", "fpe", "kill",
"usr1", "segv", "usr2", "pipe", "alrm",
"term", "stkflt", "chld", "cont", "stop",
"tstp", "ttin", "ttou", "urg", "xcpu",
"xfsz", "vtalrm", "prof", "winch", "poll",
"pwr", "sys", "rt0", "rt1", "rt2", "rt3",
"rt4", "rt5", "rt6", "rt7", "rt8", "rt9",
"rt10", "rt11", "rt12", "rt13", "rt14", "rt15",
"rt16", "rt17", "rt18", "rt19", "rt20", "rt21",
"rt22", "rt23", "rt24", "rt25", "rt26", "rt27",
"rt28", "rt29", "rt30", "rt31", "rt32"
The symbol name may optionally be prefixed with 'sig' or 'sig_' and may be in uppercase or lowercase.
Examples
virsh send-process-signal myguest 1 15
virsh send-process-signal myguest 1 term
virsh send-process-signal myguest 1 sigterm
virsh send-process-signal myguest 1 SIG_HUP
size is a scaled integer (see NOTES above); it defaults to kibibytes (blocks of 1024 bytes) unless you provide a suffix (and the older option name --kilobytes is available as a deprecated synonym) . Libvirt rounds up to the nearest kibibyte. Some hypervisors require a larger granularity than KiB, and requests that are not an even multiple will be rounded up. For example, vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
For Xen, you can only adjust the memory of a running domain if the domain is paravirtualized or running the PV balloon driver.
Some hypervisors such as QEMU/KVM don't support live changes (especially increasing) of the maximum memory limit.
size is a scaled integer (see NOTES above); it defaults to kibibytes (blocks of 1024 bytes) unless you provide a suffix (and the older option name --kilobytes is available as a deprecated synonym) . Libvirt rounds up to the nearest kibibyte. Some hypervisors require a larger granularity than KiB, and requests that are not an even multiple will be rounded up. For example, vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
If --live is specified, affect a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state. Both --live and --config flags may be given, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
For QEMU/KVM, the parameters are applied to the QEMU process as a whole. Thus, when counting them, one needs to add up guest RAM, guest video RAM, and some memory overhead of QEMU itself. The last piece is hard to determine so one needs guess and try.
Specifying -1 as a value for these limits is interpreted as unlimited.
device-weights is a single string listing one or more device/weight pairs, in the format of /path/to/device,weight,/path/to/device,weight. Each weight is in the range [100, 1000], [10, 1000] after kernel 2.6.39, or the value 0 to remove that device from per-device listings. Only the devices listed in the string are modified; any existing per-device weights for other devices remain unchanged.
device-read-iops-sec is a single string listing one or more device/read_iops_sec pairs, int the format of /path/to/device,read_iops_sec,/path/to/device,read_iops_sec. Each read_iops_sec is a number which type is unsigned int, value 0 to remove that device from per-decice listing. Only the devices listed in the string are modified; any existing per-device read_iops_sec for other devices remain unchanged.
device-write-iops-sec is a single string listing one or more device/write_iops_sec pairs, int the format of /path/to/device,write_iops_sec,/path/to/device,write_iops_sec. Each write_iops_sec is a number which type is unsigned int, value 0 to remove that device from per-decice listing. Only the devices listed in the string are modified; any existing per-device write_iops_sec for other devices remain unchanged.
device-read-bytes-sec is a single string listing one or more device/read_bytes_sec pairs, int the format of /path/to/device,read_bytes_sec,/path/to/device,read_bytes_sec. Each read_bytes_sec is a number which type is unsigned long long, value 0 to remove that device from per-decice listing. Only the devices listed in the string are modified; any existing per-device read_bytes_sec for other devices remain unchanged.
device-write-bytes-sec is a single string listing one or more device/write_bytes_sec pairs, int the format of /path/to/device,write_bytes_sec,/path/to/device,write_bytes_sec. Each write_bytes_sec is a number which type is unsigned long long, value 0 to remove that device from per-decice listing. Only the devices listed in the string are modified; any existing per-device write_bytes_sec for other devices remain unchanged.
If --live is specified, affect a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state. Both --live and --config flags may be given, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
The count value may be limited by host, hypervisor, or a limit coming from the original description of the guest domain. For Xen, you can only adjust the virtual CPUs of a running domain if the domain is paravirtualized.
If the --config flag is specified, the change is made to the stored XML configuration for the guest domain, and will only take effect when the guest domain is next started.
If --live is specified, the guest domain must be active, and the change takes place immediately. Both the --config and --live flags may be specified together if supported by the hypervisor.
If --current is specified, affect the current guest state.
When no flags are given, the --live flag is assumed and the guest domain must be active. In this situation it is up to the hypervisor whether the --config flag is also assumed, and therefore whether the XML configuration is adjusted to make the change persistent.
If --guest is specified, then the count of cpus is modified in the guest instead of the hypervisor. This flag is usable only for live domains and may require guest agent to be configured in the guest.
The --maximum flag controls the maximum number of virtual cpus that can be hot-plugged the next time the domain is booted. As such, it must only be used with the --config flag, and not with the --live flag.
The exact behavior of a domain when it shuts down is set by the on_shutdown parameter in the domain's XML definition.
If domain is transient, then the metadata of any snapshots will be lost once the guest stops running, but the snapshot contents still exist, and a new domain with the same name and UUID can restore the snapshot metadata with snapshot-create.
By default the hypervisor will try to pick a suitable shutdown method. To specify an alternative method, the --mode parameter can specify a comma separated list which includes "acpi", "agent", "initctl" and "signal". The order in which drivers will try each mode is undefined, and not related to the order specified to virsh. For strict control over ordering, use a single mode at a time and repeat the command.
If --pass-fds is specified, the argument is a comma separated list of open file descriptors which should be pass on into the guest. The file descriptors will be re-numered in the guest, starting from 3. This is only supported with container based virtualization.
The --duration argument specifies number of seconds before the domain is woken up after it was suspended (see also dompmwakeup). Default is 0 for unlimited suspend time. (This feature isn't currently supported by any hypervisor driver and 0 should be used.).
Note that this command requires a guest agent configured and running in the domain's guest OS.
Beware that at least for QEMU, the domain's process will be terminated when target disk is used and a new process will be launched when libvirt is asked to wake up the domain. As a result of this, any runtime changes, such as device hotplug or memory settings, are lost unless such changes were made with --config flag.
The --managed-save flag guarantees that any managed save image (see the managedsave command) is also cleaned up. Without the flag, attempts to undefine a domain with a managed save image will fail.
The --snapshots-metadata flag guarantees that any snapshots (see the snapshot-list command) are also cleaned up when undefining an inactive domain. Without the flag, attempts to undefine an inactive domain with snapshot metadata will fail. If the domain is active, this flag is ignored.
The --storage flag takes a parameter volumes, which is a comma separated list of volume target names or source paths of storage volumes to be removed along with the undefined domain. Volumes can be undefined and thus removed only on inactive domains. Volume deletion is only attempted after the domain is undefined; if not all of the requested volumes could be deleted, the error message indicates what still remains behind. If a volume path is not found in the domain definition, it's treated as if the volume was successfully deleted. Only volumes managed by libvirt in storage pools can be removed this way. (See domblklist for list of target names associated to a domain). Example: --storage vda,/path/to/storage.img
The --remove-all-storage flag specifies that all of the domain's storage volumes should be deleted.
The flag --wipe-storage specifies that the storage volumes should be wiped before removal.
NOTE: For an inactive domain, the domain name or UUID must be used as the domain.
--maximum requests information on the maximum cap of vcpus that a domain can add via setvcpus, while --active shows the current usage; these two flags cannot both be specified. --config requires a persistent domain and requests information regarding the next time the domain will be booted, --live requires a running domain and lists current values, and --current queries according to the current state of the domain (corresponding to --live if running, or --config if inactive); these three flags are mutually exclusive.
If --guest is specified, then the count of cpus is reported from the perspective of the guest. This flag is usable only for live domains and may require guest agent to be configured in the guest.
cpulist is a list of physical CPU numbers. Its syntax is a comma separated list and a special markup using '-' and '^' (ex. '0-4', '0-3,^2') can also be allowed. The '-' denotes the range and the '^' denotes exclusive. If you want to reset vcpupin setting, that is, to pin vcpu all physical cpus, simply specify 'r' as a cpulist. If --live is specified, affect a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state. Both --live and --config flags may be given if cpulist is present, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
Note: The expression is sequentially evaluated, so "0-15,^8" is identical to "9-14,0-7,15" but not identical to "^8,0-15".
See vcpupin for cpulist.
If --live is specified, affect a running guest. If --config is specified, affect the next boot of a persistent guest. If --current is specified, affect the current guest state. Both --live and --config flags may be given if cpulist is present, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
The following commands manipulate devices associated to domains. The domain can be specified as a short integer, a name or a full UUID. To better understand the values allowed as options for the command reading the documentation at <http://libvirt.org/formatdomain.html> on the format of the device sections to get the most accurate set of accepted values.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. When no flag is specified legacy API is used whose behavior depends on the hypervisor driver.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain.
Note: using of partial device definition XML files may lead to unexpected results as some fields may be autogenerated and thus match devices other than expected.
If --print-xml is specified, then the XML of the disk that would be attached is printed instead.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. When no flag is specified legacy API is used whose behavior depends on the hypervisor driver.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain. Likewise, --shareable is an alias for --mode shareable.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. When no flag is specified legacy API is used whose behavior depends on the hypervisor driver.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain.
Note: the optional target value is the name of a device to be created as the back-end on the node. If not provided a device named "vnetN" or "vifN" will be created automatically.
Note: using of partial device definition XML files may lead to unexpected results as some fields may be autogenerated and thus match devices other than expected.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. When no flag is specified legacy API is used whose behavior depends on the hypervisor driver.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain.
Note that older versions of virsh used --config as an alias for --persistent.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. When no flag is specified legacy API is used whose behavior depends on the hypervisor driver.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain.
Note that older versions of virsh used --config as an alias for --persistent.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. When no flag is specified legacy API is used whose behavior depends on the hypervisor driver.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain.
Note that older versions of virsh used --config as an alias for --persistent.
If --live is specified, affect a running domain. If --config is specified, affect the next startup of a persistent domain. If --current is specified, affect the current domain state. Both --live and --config flags may be given, but --current is exclusive. Not specifying any flag is the same as specifying --current.
For compatibility purposes, --persistent behaves like --config for an offline domain, and like --live --config for a running domain.
Note that older versions of virsh used --config as an alias for --persistent.
Note: using of partial device definition XML files may lead to unexpected results as some fields may be autogenerated and thus match devices other than expected.
--eject indicates the media will be ejected. --insert indicates the media will be inserted. source must be specified. If the device has source (e.g. <source file='media'>), and source is not specified, --update is equal to --eject. If the device has no source, and source is specified, --update is equal to --insert. If the device has source, and source is specified, --update behaves like combination of --eject and --insert. If none of --eject, --insert, and --update is specified, --update is used by default. The --force option can be used to force media changing. If --live is specified, alter live configuration of running guest. If --config is specified, alter persistent configuration, effect observed on next boot. --current can be either or both of live and config, depends on the hypervisor's implementation. Both --live and --config flags may be given, but --current is exclusive. If no flag is specified, behavior is different depending on hypervisor.
The following commands manipulate host devices that are intended to be passed through to guest domains via <hostdev> elements in a domain's <devices> section. A node device key is generally specified by the bus name followed by its address, using underscores between all components, such as pci_0000_00_02_1, usb_1_5_3, or net_eth1_00_27_13_6a_fe_00. The nodedev-list gives the full list of host devices that are known to libvirt, although this includes devices that cannot be assigned to a guest (for example, attempting to detach the PCI device that controls the host's hard disk controller where the guest's disk images live could cause the host system to lock up or reboot).
For more information on node device definition see: <http://libvirt.org/formatnode.html>.
Passthrough devices cannot be simultaneously used by the host and its guest domains, nor by multiple active guests at once. If the <hostdev> description includes the attribute managed='yes', and the hypervisor driver supports it, then the device is in managed mode, and attempts to use that passthrough device in an active guest will automatically behave as if nodedev-detach (guest start, device hot-plug) and nodedev-reattach (guest stop, device hot-unplug) were called at the right points (currently, qemu does this for PCI devices, but not USB). If a device is not marked as managed, then it must manually be detached before guests can use it, and manually reattached to be returned to the host. Also, if a device is manually detached, then the host does not regain control of the device without a matching reattach, even if the guests use the device in managed mode.
Different backend drivers expect the device to be bound to different dummy devices. For example, QEMU's "kvm" backend driver (the default) expects the device to be bound to pci-stub, but its "vfio" backend driver expects the device to be bound to vfio-pci. The --driver parameter can be used to specify the desired backend driver.
The following commands manipulate networks. Libvirt has the capability to define virtual networks which can then be used by domains and linked to actual network devices. For more detailed information about this feature see the documentation at <http://libvirt.org/formatnetwork.html> . Many of the commands for virtual networks are similar to the ones used for domains, but the way to name a virtual network is either by its name or UUID.
This is equivalent to:
virsh net-dumpxml --inactive network > network.xml
vi network.xml (or make changes with your other text editor)
virsh net-define network.xml
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
By default, this command is one-shot, and returns success once an event occurs; you can send SIGINT (usually via "Ctrl-C") to quit immediately. If --timeout is specified, the command gives up waiting for events after seconds have elapsed. With --loop, the command prints all events until a timeout or interrupt key.
NOTE: When talking to older servers, this command is forced to use a series of API calls with an inherent race, where a pool might not be listed or might appear more than once if it changed state between calls while the list was being collected. Newer servers do not have this problem.
command is one of "add-first", "add-last", "add" (a synonym for add-last), "delete", or "modify".
section is one of "bridge", "domain", "ip", "ip-dhcp-host", "ip-dhcp-range", "forward", "forward-interface", "forward-pf", "portgroup", "dns-host", "dns-txt", or "dns-srv", each section being named by a concatenation of the xml element hierarchy leading to the element being changed. For example, "ip-dhcp-host" will change a <host> element that is contained inside a <dhcp> element inside an <ip> element of the network.
xml is either the text of a complete xml element of the type being changed (e.g. "<host mac="00:11:22:33:44:55' ip='1.2.3.4'/>", or the name of a file that contains a complete xml element. Disambiguation is done by looking at the first character of the provided text - if the first character is "<", it is xml text, if the first character is not "<", it is the name of a file that contains the xml text to be used.
The --parent-index option is used to specify which of several parent elements the requested element is in (0-based). For example, a dhcp <host> element could be in any one of multiple <ip> elements in the network; if a parent-index isn't provided, the "most appropriate" <ip> element will be selected (usually the only one that already has a <dhcp> element), but if --parent-index is given, that particular instance of <ip> will get the modification.
If --live is specified, affect a running network. If --config is specified, affect the next startup of a persistent network. If --current is specified, affect the current network state. Both --live and --config flags may be given, but --current is exclusive. Not specifying any flag is the same as specifying --current.
The following commands manipulate host interfaces. Often, these host interfaces can then be used by name within domain <interface> elements (such as a system-created bridge interface), but there is no requirement that host interfaces be tied to any particular guest configuration XML at all.
Many of the commands for host interfaces are similar to the ones used for domains, and the way to name an interface is either by its name or its MAC address. However, using a MAC address for an iface argument only works when that address is unique (if an interface and a bridge share the same MAC address, which is often the case, then using that MAC address results in an error due to ambiguity, and you must resort to a name instead).
See also iface-unbridge for undoing this operation.
This is equivalent to:
virsh iface-dumpxml iface > iface.xml
vi iface.xml (or make changes with your other text editor)
virsh iface-define iface.xml
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
interface specifies the interface MAC address.
interface specifies the interface name.
See also iface-bridge for creating a bridge.
The following commands manipulate storage pools. Libvirt has the capability to manage various storage solutions, including files, raw partitions, and domain-specific formats, used to provide the storage volumes visible as devices within virtual machines. For more detailed information about this feature, see the documentation at <http://libvirt.org/formatstorage.html> . Many of the commands for pools are similar to the ones used for domains.
Options --overwrite and --no-overwrite can only be used for pool-build a filesystem pool. If neither of them is specified, pool-build on a filesystem pool only makes the directory; If --no-overwrite is specified, it probes to determine if a filesystem already exists on the target device, returning an error if exists, or using mkfs to format the target device if not; If --overwrite is specified, mkfs is always executed, any existed data on the target device is overwritten unconditionally.
This is equivalent to:
virsh pool-dumpxml pool > pool.xml
vi pool.xml (or make changes with your other text editor)
virsh pool-define pool.xml
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
In addition, there are several sets of filtering flags. --persistent is to list the persistent pools, --transient is to list the transient pools. --autostart lists the autostarting pools, --no-autostart lists the pools with autostarting disabled.
You may also want to list pools with specified types using type, the pool types must be separated by comma, e.g. --type dir,disk. The valid pool types include 'dir', 'fs', 'netfs', 'logical', 'disk', 'iscsi', 'scsi', 'mpath', 'rbd', 'sheepdog' and 'gluster'.
The --details option instructs virsh to additionally display pool persistence and capacity related information where available.
NOTE: When talking to older servers, this command is forced to use a series of API calls with an inherent race, where a pool might not be listed or might appear more than once if it changed state between calls while the list was being collected. Newer servers do not have this problem.
Note: A storage pool that relies on remote resources such as an "iscsi" or a (v)HBA backed "scsi" pool may need to be refreshed multiple times in order to have all the volumes detected (see pool-refresh). This is because the corresponding volume devices may not be present in the host's filesystem during the initial pool startup or the current refresh attempt. The number of refresh retries is dependant upon the network connection and the time the host takes to export the corresponding devices.
Example
virsh vol-dumpxml --pool storagepool1 appvolume1 > newvolume.xml
vi newvolume.xml (or make changes with your other text editor)
virsh vol-create differentstoragepool newvolume.xml
Supported algorithms
zero - 1-pass all zeroes
nnsa - 4-pass NNSA Policy Letter NAP-14.1-C (XVI-8) for
sanitizing removable and non-removable hard disks:
random x2, 0x00, verify.
dod - 4-pass DoD 5220.22-M section 8-306 procedure for
sanitizing removable and non-removable rigid
disks: random, 0x00, 0xff, verify.
bsi - 9-pass method recommended by the German Center of
Security in Information Technologies
(http://www.bsi.bund.de): 0xff, 0xfe, 0xfd, 0xfb,
0xf7, 0xef, 0xdf, 0xbf, 0x7f.
gutmann - The canonical 35-pass sequence described in
Gutmann's paper.
schneier - 7-pass method described by Bruce Schneier in
"Applied Cryptography" (1996): 0x00, 0xff,
random x5.
pfitzner7 - Roy Pfitzner's 7-random-pass method: random x7.
pfitzner33 - Roy Pfitzner's 33-random-pass method: random x33.
random - 1-pass pattern: random.
Note: The availability of algorithms may be limited by the version of the "scrub" binary installed on the host.
The following commands manipulate "secrets" (e.g. passwords, passphrases and encryption keys). Libvirt can store secrets independently from their use, and other objects (e.g. volumes or domains) can refer to the secrets for encryption or possibly other uses. Secrets are identified using an UUID. See <http://libvirt.org/formatsecret.html> for documentation of the XML format used to represent properties of secrets.
The following commands manipulate domain snapshots. Snapshots take the disk, memory, and device state of a domain at a point-of-time, and save it for future use. They have many uses, from saving a "clean" copy of an OS image to saving a domain's state before a potentially destructive operation. Snapshots are identified with a unique name. See <http://libvirt.org/formatsnapshot.html> for documentation of the XML format used to represent properties of snapshots.
If --halt is specified, the domain will be left in an inactive state after the snapshot is created.
If --disk-only is specified, the snapshot will only include disk state rather than the usual system checkpoint with vm state. Disk snapshots are faster than full system checkpoints, but reverting to a disk snapshot may require fsck or journal replays, since it is like the disk state at the point when the power cord is abruptly pulled; and mixing --halt and --disk-only loses any data that was not flushed to disk at the time.
If --redefine is specified, then all XML elements produced by snapshot-dumpxml are valid; this can be used to migrate snapshot hierarchy from one machine to another, to recreate hierarchy for the case of a transient domain that goes away and is later recreated with the same name and UUID, or to make slight alterations in the snapshot metadata (such as host-specific aspects of the domain XML embedded in the snapshot). When this flag is supplied, the xmlfile argument is mandatory, and the domain's current snapshot will not be altered unless the --current flag is also given.
If --no-metadata is specified, then the snapshot data is created, but any metadata is immediately discarded (that is, libvirt does not treat the snapshot as current, and cannot revert to the snapshot unless --redefine is later used to teach libvirt about the metadata again).
If --reuse-external is specified, and the snapshot XML requests an external snapshot with a destination of an existing file, then the destination must exist, and is reused; otherwise, a snapshot is refused to avoid losing contents of the existing files.
If --quiesce is specified, libvirt will try to use guest agent to freeze and unfreeze domain's mounted file systems. However, if domain has no guest agent, snapshot creation will fail. Currently, this requires --disk-only to be passed as well.
If --atomic is specified, libvirt will guarantee that the snapshot either succeeds, or fails with no changes; not all hypervisors support this. If this flag is not specified, then some hypervisors may fail after partially performing the action, and dumpxml must be used to see whether any partial changes occurred.
If --live is specified, libvirt takes the snapshot while the guest is running. This increases the size of the memory image of the external checkpoint. This is currently supported only for external checkpoints.
Existence of snapshot metadata will prevent attempts to undefine a persistent domain. However, for transient domains, snapshot metadata is silently lost when the domain quits running (whether by command such as destroy or by internal guest action).
The --memspec option can be used to control whether a checkpoint is internal or external. The --memspec flag is mandatory, followed by a memspec of the form [file=]name[,snapshot=type], where type can be none, internal, or external. To include a literal comma in file=name, escape it with a second comma. --memspec cannot be used together with --disk-only.
The --diskspec option can be used to control how
--disk-only and external checkpoints create external files. This
option can occur multiple times, according to the number of <disk>
elements in the domain xml. Each <diskspec> is in the form
disk[,snapshot=type][,driver=type][,file=name]. To include a
literal comma in disk or in file=name, escape it with a
second comma. A literal --diskspec must precede each
diskspec unless all three of domain, name, and
description are also present. For example, a diskspec of
"vda,snapshot=external,file=/path/to,,new" results in the
following XML:
<disk name='vda' snapshot='external'>
<source file='/path/to,new'/>
</disk>
If --reuse-external is specified, and the domain XML or diskspec option requests an external snapshot with a destination of an existing file, then the destination must exist, and is reused; otherwise, a snapshot is refused to avoid losing contents of the existing files.
If --quiesce is specified, libvirt will try to use guest agent to freeze and unfreeze domain's mounted file systems. However, if domain has no guest agent, snapshot creation will fail. Currently, this requires --disk-only to be passed as well.
If --no-metadata is specified, then the snapshot data is created, but any metadata is immediately discarded (that is, libvirt does not treat the snapshot as current, and cannot revert to the snapshot unless snapshot-create is later used to teach libvirt about the metadata again). This flag is incompatible with --print-xml.
If --atomic is specified, libvirt will guarantee that the snapshot either succeeds, or fails with no changes; not all hypervisors support this. If this flag is not specified, then some hypervisors may fail after partially performing the action, and dumpxml must be used to see whether any partial changes occurred.
If --live is specified, libvirt takes the snapshot while the guest is running. This increases the size of the memory image of the external checkpoint. This is currently supported only for external checkpoints.
With snapshotname, this is a request to make the existing named snapshot become the current snapshot, without reverting the domain.
This is equivalent to:
virsh snapshot-dumpxml dom name > snapshot.xml
vi snapshot.xml (or make changes with your other text editor)
virsh snapshot-create dom snapshot.xml --redefine [--current]
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
If --rename is specified, then the edits can change the snapshot name. If --clone is specified, then changing the snapshot name will create a clone of the snapshot metadata. If neither is specified, then the edits must not change the snapshot name. Note that changing a snapshot name must be done with care, since the contents of some snapshots, such as internal snapshots within a single qcow2 file, are accessible only from the original name.
If --parent is specified, add a column to the output table giving the name of the parent of each snapshot. If --roots is specified, the list will be filtered to just snapshots that have no parents. If --tree is specified, the output will be in a tree format, listing just snapshot names. These three options are mutually exclusive. If --name is specified only the snapshot name is printed. This option is mutually exclusive with --tree.
If --from is provided, filter the list to snapshots which are children of the given snapshot; or if --current is provided, start at the current snapshot. When used in isolation or with --parent, the list is limited to direct children unless --descendants is also present. When used with --tree, the use of --descendants is implied. This option is not compatible with --roots. Note that the starting point of --from or --current is not included in the list unless the --tree option is also present.
If --leaves is specified, the list will be filtered to just snapshots that have no children. Likewise, if --no-leaves is specified, the list will be filtered to just snapshots with children. (Note that omitting both options does no filtering, while providing both options will either produce the same list or error out depending on whether the server recognizes the flags). Filtering options are not compatible with --tree.
If --metadata is specified, the list will be filtered to just snapshots that involve libvirt metadata, and thus would prevent undefine of a persistent domain, or be lost on destroy of a transient domain. Likewise, if --no-metadata is specified, the list will be filtered to just snapshots that exist without the need for libvirt metadata.
If --inactive is specified, the list will be filtered to snapshots that were taken when the domain was shut off. If --active is specified, the list will be filtered to snapshots that were taken when the domain was running, and where the snapshot includes the memory state to revert to that running state. If --disk-only is specified, the list will be filtered to snapshots that were taken when the domain was running, but where the snapshot includes only disk state.
If --internal is specified, the list will be filtered to snapshots that use internal storage of existing disk images. If --external is specified, the list will be filtered to snapshots that use external files for disk images or memory state.
Normally, reverting to a snapshot leaves the domain in the state it was at the time the snapshot was created, except that a disk snapshot with no vm state leaves the domain in an inactive state. Passing either the --running or --paused flag will perform additional state changes (such as booting an inactive domain, or pausing a running domain). Since transient domains cannot be inactive, it is required to use one of these flags when reverting to a disk snapshot of a transient domain.
There are two cases where a snapshot revert involves extra risk, which requires the use of --force to proceed. One is the case of a snapshot that lacks full domain information for reverting configuration (such as snapshots created prior to libvirt 0.9.5); since libvirt cannot prove that the current configuration matches what was in use at the time of the snapshot, supplying --force assures libvirt that the snapshot is compatible with the current configuration (and if it is not, the domain will likely fail to run). The other is the case of reverting from a running domain to an active state where a new hypervisor has to be created rather than reusing the existing hypervisor, because it implies drawbacks such as breaking any existing VNC or Spice connections; this condition happens with an active snapshot that uses a provably incompatible configuration, as well as with an inactive snapshot that is combined with the --start or --pause flag.
If --metadata is specified, then only delete the snapshot metadata maintained by libvirt, while leaving the snapshot contents intact for access by external tools; otherwise deleting a snapshot also removes the data contents from that point in time.
The following commands manipulate network filters. Network filters allow filtering of the network traffic coming from and going to virtual machines. Individual network traffic filters are written in XML and may contain references to other network filters, describe traffic filtering rules, or contain both. Network filters are referenced by virtual machines from within their interface description. A network filter may be referenced by multiple virtual machines' interfaces.
This is equivalent to:
virsh nwfilter-dumpxml myfilter > myfilter.xml
vi myfilter.xml (or make changes with your other text editor)
virsh nwfilter-define myfilter.xml
except that it does some error checking. The new network filter may be rejected due to the same reason as mentioned in nwfilter-define.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
NOTE: Use of the following commands is strongly discouraged. They can cause libvirt to become confused and do the wrong thing on subsequent operations. Once you have used this command, please do not report problems to the libvirt developers; the reports will be ignored.
$ qemu-kvm -cdrom ~/demo.iso \
-monitor unix:/tmp/demo,server,nowait \
-name foo \
-uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea &
$ QEMUPID=$!
$ virsh qemu-attach $QEMUPID
Not all functions of libvirt are expected to work reliably after attaching to an externally launched QEMU process. There may be issues with the guest ABI changing upon migration, and hotunplug may not work.
The following environment variables can be set to alter the behaviour of "virsh"
DEBUG - Messages at ALL levels get logged
INFO - Logs messages at levels INFO, NOTICE, WARNING and ERROR
NOTICE - Logs messages at levels NOTICE, WARNING and ERROR
WARNING - Logs messages at levels WARNING and ERROR
ERROR - Messages at only ERROR level gets logged.
Messages at level DEBUG or above
Messages at level INFO or above
Messages at level WARNING or above
Messages at level ERROR or above
For further information about debugging options consult "http://libvirt.org/logging.html"
Report any bugs discovered to the libvirt community via the mailing list "http://libvirt.org/contact.html" or bug tracker "http://libvirt.org/bugs.html". Alternatively report bugs to your software distributor / vendor.
Please refer to the AUTHORS file distributed with libvirt. Based on the xm man page by: Sean Dague <sean at dague dot net> Daniel Stekloff <dsteklof at us dot ibm dot com>
Copyright (C) 2005, 2007-2010 Red Hat, Inc., and the authors listed in the libvirt AUTHORS file.
virsh is distributed under the terms of the GNU LGPL v2+. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
virt-install(1), virt-xml-validate(1), virt-top(1), virt-df(1), <http://www.libvirt.org/>