Difference between revisions of "Virsh"
(64 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <code>virsh</code><ref>http://manpages.ubuntu.com/manpages/xenial/man1/virsh.1.html</ref><ref> https://github.com/libvirt/libvirt/blob/master/tools/virsh.c</ref> is a command line utility for managing virsh guest domains/virtual machines and the hypervisor<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh</ref>. Can be used to operate vm like create, list, start, [[ | + | {{lowercase}} |
+ | <code>virsh</code><ref>http://manpages.ubuntu.com/manpages/xenial/man1/virsh.1.html</ref><ref> https://github.com/libvirt/libvirt/blob/master/tools/virsh.c</ref> is a command line utility for managing virsh guest domains/virtual machines and the hypervisor<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh</ref>. Can be used to operate vm like create, list, start, [[shutdown]] or suspend and to manage [[Virsh storage information|storage]], [[Virsh Snapshots|snapshots]] and [[checkpoints]]<ref>https://github.com/libvirt/libvirt/commit/689beaa47c51fb49fafa992dd468116b8f6b0782#diff-f41fa7374ab97c527387ea4ce48fd04e</ref> among other actions. <code>[[virt-manager]]</code> is a graphical alternative to virsh. It supports Xen, QEMU, [[KVM]], [[LXC]], [[OpenVZ]], VirtualBox and VMware ESX. | ||
− | <code>virsh</code> is include in <code>[[libvirt|libvirt-client]]</code> package in [[ | + | <code>virsh</code> is include in <code>[[libvirt|libvirt-client]]</code> package in [[RHEL]] and [[Ubuntu]] and uses [[libvirt]] management API. Binaries included: |
− | * virsh | + | *<code>virsh</code> |
− | * [[virt-admin]] | + | *<code>[[virt-admin]]</code> |
− | * [[virt-host-validate]] | + | *<code>[[virt-host-validate]]</code> |
− | * [[virt-login-shell]] | + | *<code>[[virt-login-shell]]</code> |
− | * [[virt-pki-validate]] | + | *<code>[[virt-pki-validate]]</code> |
− | * [[virt-xml-validate]] | + | *<code>[[virt-xml-validate]]</code> |
== Basic Commands == | == Basic Commands == | ||
Line 14: | Line 15: | ||
== All Commands == | == All Commands == | ||
− | * <code>[[virsh autostart]] VM_NAME</code> or <code>[[virsh autostart]] VM_NAME --disable</code> (Related: <code>[[ | + | * <code>[[virsh --connect]]</code> |
+ | ** <code>[[virsh -c]] qemu:///system list</code> | ||
+ | *<code>[[virsh attach-device]]</code> | ||
+ | * <code>[[virsh autostart]] VM_NAME</code> or <code>[[virsh autostart]] VM_NAME --disable</code> (Related: <code>[[virsh start]]</code> and <code>[[virsh pool-autostart]]</code>) | ||
* <code>[[virsh blockcommit]]</code>. Allows Live-disk-backup-with-active-blockcommit <ref> https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit</ref> | * <code>[[virsh blockcommit]]</code>. Allows Live-disk-backup-with-active-blockcommit <ref> https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit</ref> | ||
− | * <code>[[ | + | * <code>[[virsh blockcopy]]</code> |
* <code>[[virsh blockjob]]</code> | * <code>[[virsh blockjob]]</code> | ||
− | * <code>[[/virsh change-media | + | * <code>[[virsh blockresize]]</code> |
− | * <code>[[ | + | * <code>[[virsh change-media]]</code> |
− | * <code>[[/virsh define | + | * <code>[[virsh create]] [[MY_XML_VM_DEFINITION.XML/]]</code> |
− | ** <code>[[ | + | * <code>[[virsh console]] YOUR_VM</code> |
− | ** <code>[[ | + | * <code>[[virsh define]] [[MY_XML_VM_DEFINITION.XML]]</code> (define machine but do not start it) |
− | ** <code>[[ | + | ** <code>[[virsh define]] xmlfile.xml --validate</code> |
− | * <code>[[ | + | ** <code>[[virsh destroy]] VM_MACHINE_NAME </code> (Ungraceful Shutdown but do not destroy data or VM but you can corrupt guest file systems) |
− | **<code>[[ | + | ** <code>[[virsh destroy]] VM_MACHINE_NAME --graceful</code> |
− | * <code>[[ | + | * <code>[[virsh domblklist]] VMNAME</code> |
− | * <code>[[ | + | **<code>[[virsh domblklist]] --details VM_MACHINE_NAME</code> |
− | * <code>[[ | + | * <code>[[virsh domblkstat]] VMNAME</code> |
− | * <code>[[ | + | * <code>[[virsh domblkinfo]] VMNAME BLOCK_DEVICE</code> (BLOCK_DEVICE from [[virsh domblklist]] command) |
− | * <code>[[ | + | * <code>[[virsh domdisplay]]</code> |
− | * <code>[[ | + | * <code>[[virsh domfsfreeze]]</code> Quiesces the guest filesystem in isolation<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-using_the_qemu_guest_virtual_machine_agent_protocol_cli-libvirt_commands</ref> |
− | * <code>[[ | + | * <code>[[virsh domfsthaw]]</code> Quiesces the guest filesystem in isolation<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-using_the_qemu_guest_virtual_machine_agent_protocol_cli-libvirt_commands</ref> |
− | * <code>[[ | + | * <code>[[virsh domid]]</code> |
− | * <code>[[ | + | * <code>[[virsh dominfo]] VMNAME_OR_ID</code> Guess virtual machine information such us state and [[autostart]] configuration. |
+ | * <code>[[virsh dommemstat]]</code> | ||
+ | * <code>[[virsh domname]]</code> | ||
+ | * <code>[[virsh domrename]]</code> (since 2015) | ||
* <code>virsh dump --memory-only --verbose</code> | * <code>virsh dump --memory-only --verbose</code> | ||
− | * <code>[[ | + | * <code>[[virsh dumpxml]] VMNAME</code> - domain information in XML (Can be used to move VMs between hosts <ref>https://serverfault.com/questions/434064/correct-way-to-move-kvm-vm</ref>) |
* <code>[[virsh edit]] VMNAME</code> | * <code>[[virsh edit]] VMNAME</code> | ||
* <code>[[virsh list]]</code> | * <code>[[virsh list]]</code> | ||
** <code>virsh list --name</code> | ** <code>virsh list --name</code> | ||
− | * <code>[[ | + | * <code>[[virsh memtune]]</code> |
* <code>[[virsh migrate]]</code> | * <code>[[virsh migrate]]</code> | ||
* <code>[[virsh pool-autostart]]</code> | * <code>[[virsh pool-autostart]]</code> | ||
− | * <code>[[ | + | * <code>[[virsh pool-build]]</code> |
− | * <code>[[ | + | * <code>[[virsh pool-create]]</code> create '''temporary''' storage pools from command line |
− | * <code>[[ | + | * <code>[[virsh pool-create-as]]</code> create '''temporary''' storage pools from XML file |
− | * <code>[[ | + | * <code>[[virsh pool-define]]</code> (create '''persistent''' storage from options from XML file)<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_virtualization/index#creating-storage-for-virtual-machines-using-the-cli_managing-storage-for-virtual-machines-using-the-cli</ref> |
− | * <code>[[ | + | * <code>[[virsh pool-define-as]]</code> (create '''persistent''' storage from options from command line)<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_virtualization/index#creating-storage-for-virtual-machines-using-the-cli_managing-storage-for-virtual-machines-using-the-cli</ref> |
− | * <code>[[ | + | * <code>[[virsh pool-event]]</code> |
* <code>[[virsh reboot]]</code> | * <code>[[virsh reboot]]</code> | ||
* <code>virsh restore</code> | * <code>virsh restore</code> | ||
− | * <code>virsh resume</code> | + | * <code>[[virsh resume]]</code> |
− | * <code>virsh save</code> | + | * <code>[[virsh save]]</code> |
* <code>virsh set-lifecycle-action</code>. Added in November 2017 (v.3.9.0)<ref>https://libvirt.org/news.html</ref> | * <code>virsh set-lifecycle-action</code>. Added in November 2017 (v.3.9.0)<ref>https://libvirt.org/news.html</ref> | ||
* <code>[[virsh setmaxmem]]</code> | * <code>[[virsh setmaxmem]]</code> | ||
− | * <code>[[ | + | * <code>[[virsh setmem]]</code> |
− | ** <code>[[ | + | ** <code>[[virsh setmem]] —-config</code> |
− | * <code>[[ | + | * <code>[[virsh setvcpus]]</code> |
− | * <code>[[virsh | + | * <code>[[virsh snapshot-create-as]]</code> |
− | * <code>virsh | + | * <code>[[virsh start]]</code> |
− | * <code>virsh | + | * <code>[[virsh suspend]]</code> |
− | * <code>[[ | + | * <code>[[virsh shutdown]]</code> |
− | * <code>[[ | + | * <code>[[virsh undefine]]</code> |
* <code>virsh update-device</code> | * <code>virsh update-device</code> | ||
− | * <code>[[virsh/virsh | + | * <code>[[virsh vcpuinfo]]</code> |
+ | * <code>[[virsh vncdisplay]]</code> | ||
+ | * <code>[[virsh backup-begin]]</code> | ||
+ | * <code>[[virsh checkpoint-create]]</code> | ||
+ | * <code>[[virsh nodedev-list --tree]]</code> | ||
+ | * <code>[[virsh nodedev-dumpxml]]</code> | ||
+ | * <code>[[virsh nodedev-dettach]]</code> | ||
== Getting Information == | == Getting Information == | ||
− | * List Running Virtual Machines: <code>[[virsh list]]</code><ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh</ref><ref>https://help.ubuntu.com/community/KVM/Managing</ref> | + | * List Running Virtual Machines: |
+ | ** <code>[[virsh list]]</code><ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh</ref><ref>https://help.ubuntu.com/community/KVM/Managing</ref> | ||
** <code>virsh list --name</code> | ** <code>virsh list --name</code> | ||
− | ** | + | ** <code>virsh list --all</code> |
− | * <code>[[virsh dominfo]] MY_VM_NAME</code> Guess virtual machine information such us state and [[ | + | * <code>[[virsh dominfo]] MY_VM_NAME</code> Guess virtual machine information such us state and [[autostart]] configuration. |
* <code>[[virsh domstats]]</code> (show all VMs) | * <code>[[virsh domstats]]</code> (show all VMs) | ||
− | * <code>[[virsh domstats]] --list-persistent</code> | + | ** <code>[[virsh domstats]] --list-persistent</code> |
− | * <code>[[virsh domstats]] MY_VM_MACHINE</code> | + | ** <code>[[virsh domstats]] MY_VM_MACHINE</code> |
− | ** <code>virsh domstats MY_VM_MACHINE --state</code> | + | *** <code>virsh domstats MY_VM_MACHINE --state</code> |
− | ** --no-wait option https://libvirt.org/news.html | + | *** --no-wait option https://libvirt.org/news.html |
− | * <code>[[ | + | * <code>[[virsh nodeinfo]]</code> |
− | * View configuration: <code>[[ | + | * View configuration: |
+ | ** <code>[[virsh dumpxml]] {guest-id, VM_NAME or uuid}</code> > yourfilename.xml<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-creating_a_virtual_machine_xml_dump_configuration_file</ref> | ||
** Virtual interfaces: <code>virsh domiflist VM_NAME</code> | ** Virtual interfaces: <code>virsh domiflist VM_NAME</code> | ||
Network info: | Network info: | ||
− | *<code> | + | *<code>[[virsh net-list]]</code> |
− | *<code> | + | *<code>[[virsh net-info]]</code> |
Storage info: | Storage info: | ||
Line 95: | Line 110: | ||
* <code>[[virsh vol-info]] <vol></code> | * <code>[[virsh vol-info]] <vol></code> | ||
+ | [[Virsh display|Display info]]: | ||
+ | * <code>[[virsh vncdisplay]] VM_NAME</code> | ||
+ | * <code>[[virsh domdisplay]] VM_NAME</code> | ||
Guest info: | Guest info: | ||
− | * <code>[[ | + | * <code>[[virsh guestinfo]]</code> v5.7.0 (2019-09-03)<ref>https://fossies.org/linux/libvirt/NEWS</ref> ([[Libvirt Release notes]]) |
− | * virhostuptime (Since August 2019) https://github.com/libvirt/libvirt/commit/8b802f13cb47817706cba101f5d52e2c8957698d#diff-8d027e5576f9d83750bb73c63b12a6e3 | + | * <code>virhostuptime</code> (Since August 2019) https://github.com/libvirt/libvirt/commit/8b802f13cb47817706cba101f5d52e2c8957698d#diff-8d027e5576f9d83750bb73c63b12a6e3 |
* <code>[[virsh version]]</code> | * <code>[[virsh version]]</code> | ||
+ | |||
+ | * <code>[[virsh capabilities]]</code> | ||
== Operations == | == Operations == | ||
Line 107: | Line 127: | ||
{{virsh operations}} | {{virsh operations}} | ||
− | * <code> [[ | + | * <code>[[virsh console]] VM_MACHINE_NAME</code> |
Snapshots: | Snapshots: | ||
− | * [[ | + | * <code>[[virsh snapshot-create]]</code> |
− | * | + | * <code>[[virsh snapshot-create]]</code> --validate (08/2019) <ref>https://libvirt.org/news.html</ref> |
Migrations: | Migrations: | ||
− | * <code>[[ | + | * <code>[[virsh migrate]] --live GuestName DestinationURL</code> |
− | + | * <code>[[virsh migrate]] --offline</code><ref>https://libvirt.org/migration.html#offline</ref> (copying non-shared storage or other file based storages (e.g. UEFI variable storage) is not supported during offline migration) | |
Configuration: | Configuration: | ||
− | * <code>[[ | + | * <code>[[virsh autostart]] VM_MACHINE_NAME</code> |
== [[Virsh Storage commands]] == | == [[Virsh Storage commands]] == | ||
Line 145: | Line 165: | ||
* <code>[[virsh vol-list]] <pool></code> | * <code>[[virsh vol-list]] <pool></code> | ||
− | == [[Virsh | + | == [[Virsh Snapshots]] == |
− | + | {{virsh snapshots TOC}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == [[ | + | == [[Virsh CPU Commands]] == |
− | * <code>[[ | + | * <code>[[virsh cpu-models]] x86_64</code> |
+ | * <code>[[virsh setvcpus]]</code> | ||
== [[Virsh Memory Commands]] == | == [[Virsh Memory Commands]] == | ||
{{virsh memory commands}} | {{virsh memory commands}} | ||
− | == [[ | + | == [[QEMU]] == |
− | + | {{virsh qemu TOC}} | |
− | |||
− | |||
− | |||
− | |||
== Networking == | == Networking == | ||
− | + | {{virsh net TOC}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Activities == | == Activities == | ||
# Review virsh command cheatsheet https://computingforgeeks.com/virsh-commands-cheatsheet/ | # Review virsh command cheatsheet https://computingforgeeks.com/virsh-commands-cheatsheet/ | ||
# Read https://github.com/libvirt/libvirt/blob/master/tools/virsh.c source code. | # Read https://github.com/libvirt/libvirt/blob/master/tools/virsh.c source code. | ||
− | # Enable access to your VM Machines via [[ | + | # Enable access to your VM Machines via [[virsh console]] command |
− | # Learn difference between <code>[[ | + | # Learn difference between <code>[[virsh define]]</code> and <code>[[virsh create]]</code> |
− | # [[ | + | # [[Create Live backups]] with active [[virsh blockcommit]]<ref>https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit</ref> |
− | # [[ | + | # [[Offline Migrate or move a virtual machine between two KVM servers without shared storage]]<ref>https://serverfault.com/questions/434064/correct-way-to-move-kvm-vm</ref>: <code>[[virsh dumpxml]]</code> and <code>[[virsh define]]</code> |
== See also == | == See also == | ||
− | * <code>[[virtinst]]</code> package<ref>https://github.com/virt-manager/virt-manager/tree/master/virtinst</ref>, includes following python binaries: <code>virt-clone</code>, <code>virt-convert</code>, <code>[[virt-install]]</code><ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_virtualization/getting-started-with-virtualization-in-rhel-8_configuring-and-managing-virtualization</ref> | + | * <code>[[virtinst]]</code> package<ref>https://github.com/virt-manager/virt-manager/tree/master/virtinst</ref>, includes following python binaries: <code>[[virt-clone]]</code>, <code>virt-convert</code>, <code>[[virt-install]]</code><ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_virtualization/getting-started-with-virtualization-in-rhel-8_configuring-and-managing-virtualization</ref> |
* [[virt-top]] 'top'-like utility for virtualization stats | * [[virt-top]] 'top'-like utility for virtualization stats | ||
− | * [[ | + | * [[ovirt-RHV module]] |
− | |||
* [[virt-admin]] | * [[virt-admin]] | ||
+ | * {{libvirtd}} | ||
+ | * {{KVM}} | ||
+ | * {{virsh}} | ||
== References == | == References == |
Latest revision as of 20:45, 26 May 2022
virsh
[1][2] is a command line utility for managing virsh guest domains/virtual machines and the hypervisor[3]. Can be used to operate vm like create, list, start, shutdown or suspend and to manage storage, snapshots and checkpoints[4] among other actions. virt-manager
is a graphical alternative to virsh. It supports Xen, QEMU, KVM, LXC, OpenVZ, VirtualBox and VMware ESX.
virsh
is include in libvirt-client
package in RHEL and Ubuntu and uses libvirt management API. Binaries included:
Contents
Basic Commands[edit]
virsh
virsh -r
All Commands[edit]
virsh --connect
virsh -c qemu:///system list
virsh attach-device
virsh autostart VM_NAME
orvirsh autostart VM_NAME --disable
(Related:virsh start
andvirsh pool-autostart
)virsh blockcommit
. Allows Live-disk-backup-with-active-blockcommit [5]virsh blockcopy
virsh blockjob
virsh blockresize
virsh change-media
virsh create MY_XML_VM_DEFINITION.XML/
virsh console YOUR_VM
virsh define MY_XML_VM_DEFINITION.XML
(define machine but do not start it)virsh define xmlfile.xml --validate
virsh destroy VM_MACHINE_NAME
(Ungraceful Shutdown but do not destroy data or VM but you can corrupt guest file systems)virsh destroy VM_MACHINE_NAME --graceful
virsh domblklist VMNAME
virsh domblklist --details VM_MACHINE_NAME
virsh domblkstat VMNAME
virsh domblkinfo VMNAME BLOCK_DEVICE
(BLOCK_DEVICE from virsh domblklist command)virsh domdisplay
virsh domfsfreeze
Quiesces the guest filesystem in isolation[6]virsh domfsthaw
Quiesces the guest filesystem in isolation[7]virsh domid
virsh dominfo VMNAME_OR_ID
Guess virtual machine information such us state and autostart configuration.virsh dommemstat
virsh domname
virsh domrename
(since 2015)virsh dump --memory-only --verbose
virsh dumpxml VMNAME
- domain information in XML (Can be used to move VMs between hosts [8])virsh edit VMNAME
virsh list
virsh list --name
virsh memtune
virsh migrate
virsh pool-autostart
virsh pool-build
virsh pool-create
create temporary storage pools from command linevirsh pool-create-as
create temporary storage pools from XML filevirsh pool-define
(create persistent storage from options from XML file)[9]virsh pool-define-as
(create persistent storage from options from command line)[10]virsh pool-event
virsh reboot
virsh restore
virsh resume
virsh save
virsh set-lifecycle-action
. Added in November 2017 (v.3.9.0)[11]virsh setmaxmem
virsh setmem
virsh setmem —-config
virsh setvcpus
virsh snapshot-create-as
virsh start
virsh suspend
virsh shutdown
virsh undefine
virsh update-device
virsh vcpuinfo
virsh vncdisplay
virsh backup-begin
virsh checkpoint-create
virsh nodedev-list --tree
virsh nodedev-dumpxml
virsh nodedev-dettach
Getting Information[edit]
- List Running Virtual Machines:
virsh list
[12][13]virsh list --name
virsh list --all
virsh dominfo MY_VM_NAME
Guess virtual machine information such us state and autostart configuration.
virsh domstats
(show all VMs)virsh domstats --list-persistent
virsh domstats MY_VM_MACHINE
virsh domstats MY_VM_MACHINE --state
- --no-wait option https://libvirt.org/news.html
- View configuration:
virsh dumpxml {guest-id, VM_NAME or uuid}
> yourfilename.xml[14]- Virtual interfaces:
virsh domiflist VM_NAME
Network info:
Storage info:
virsh pool-list
virsh pool-info <pool>
virsh vol-list <pool>
(Displays Name and Path)virsh vol-list --details <pool>
(Includes also Capacity and Allocation)
virsh vol-info <vol>
virsh vncdisplay VM_NAME
virsh domdisplay VM_NAME
Guest info:
virsh guestinfo
v5.7.0 (2019-09-03)[15] (Libvirt Release notes)
virhostuptime
(Since August 2019) https://github.com/libvirt/libvirt/commit/8b802f13cb47817706cba101f5d52e2c8957698d#diff-8d027e5576f9d83750bb73c63b12a6e3
Operations[edit]
Changing VM running status operations:
- Start VM:
virsh start VM_MACHINE_NAME
- Shutdown VM:
virsh shutdown
(stop) Gracefully VM - Reboot VM:
virsh reboot
Restart VM - Reset VM:
virsh reset
emulates the power reset button on a machine - Resume VM:
virsh resume
- Destroy VM:
virsh destroy VM_NAME
(Ungraceful Shutdown/stop VM. Actually do not destroy data or VM but you can corrupt guest file systems)virsh destroy VM_MACHINE_NAME --graceful
virsh suspend
- Create:
virsh define
virsh undefine
virsh console VM_MACHINE_NAME
Snapshots:
virsh snapshot-create
virsh snapshot-create
--validate (08/2019) [16]
Migrations:
virsh migrate --live GuestName DestinationURL
virsh migrate --offline
[17] (copying non-shared storage or other file based storages (e.g. UEFI variable storage) is not supported during offline migration)
Configuration:
virsh autostart VM_MACHINE_NAME
Virsh Storage commands[edit]
Virsh Storage Information[edit]
virsh domblklist VMNAME
virsh domblkinfo
virsh pool-list
virsh pool-list --all --details
virsh pool-info <pool>
virsh vol-info <vol>
virsh vol-list <pool>
(Displays Name and Path)virsh vol-list --details <pool>
(Includes also Capacity and Allocation)
All Storage commands[edit]
virsh domblklist VMNAME
virsh domblkinfo
virsh pool-autostart
virsh pool-build
virsh pool-create
create temporary storage pools from command linevirsh pool-create-as
create temporary storage pools from XML filevirsh pool-define
(create persistent storage from options from XML file)[18]virsh pool-define-as
(create persistent storage from options from command line)[19]virsh pool-event
virsh pool-event --list
virsh pool-event --event lifecycle
virsh pool-event --event refresh
virsh pool-list
virsh pool-info <pool>
virsh pool-start <pool>
virsh vol-clone
virsh vol-create-as
virsh vol-info --pool POOL_NAME VOL_NAME
virsh vol-list <pool>
Virsh Snapshots[edit]
virsh snapshot-create
Create a snapshot from XML. See also:qemu-img
andqemu-img info
virsh snapshot-create-as
Create a snapshot from a set of args.virsh snapshot-current
Get or set the current snapshotvirsh snapshot-dumpxml VM_MACHINE_NAME SNAPSHOT_NAME
Dump XML for a domain snapshotvirsh snapshot-edit
edit XML for a snapshotvirsh snapshot-info
snapshot information. (virsh snapshot-info --domain DOMAIN_NAME --snapshotname SNAPSHOT_NAME)virsh snapshot-list VM_MACHINE_NAME
List snapshots for a domainvirsh snapshot-parent
Get the name of the parent of a snapshotvirsh snapshot-revert
(Destructive action) revert a domain to a snapshotvirsh snapshot-delete
Delete a domain snapshot
Virsh CPU Commands[edit]
virsh cpu-models x86_64
virsh setvcpus
Virsh Memory Commands[edit]
virsh Memory Commands: virsh setmaxmem
, virsh setmem
, virsh dommemstat
QEMU[edit]
virsh qemu-attach
QEMU Attachvirsh qemu-monitor-command
QEMU Monitor Commandvirsh qemu-monitor-event
QEMU Monitor Eventsvirsh qemu-monitor-event VM_MACHINE_NAME
virsh qemu-agent-command
QEMU Guest Agent Command
Networking[edit]
virsh domifaddr
virsh domiflist
virsh net-autostart
autostart a networkvirsh net-create
create a network from an XML filevirsh net-define
define an inactive persistent virtual network or modify an existing persistent one from an XML filevirsh net-destroy
destroy (stop) a networkvirsh net-dhcp-leases
print DHCP lease info for a given networkvirsh net-dumpxml
NET_NAME network information in XMLvirsh net-edit
edit XML configuration for a networkvirsh net-event
Network Eventsvirsh net-info
network informationvirsh net-list
list networksvirsh net-name
convert a network UUID to network namevirsh net-start
start a (previously defined) inactive networkvirsh net-undefine
undefine a persistent networkvirsh net-update
update parts of an existing network's configurationvirsh net-uuid
convert a network name to network UUID
Activities[edit]
- Review virsh command cheatsheet https://computingforgeeks.com/virsh-commands-cheatsheet/
- Read https://github.com/libvirt/libvirt/blob/master/tools/virsh.c source code.
- Enable access to your VM Machines via virsh console command
- Learn difference between
virsh define
andvirsh create
- Create Live backups with active virsh blockcommit[20]
- Offline Migrate or move a virtual machine between two KVM servers without shared storage[21]:
virsh dumpxml
andvirsh define
See also[edit]
virtinst
package[22], includes following python binaries:virt-clone
,virt-convert
,virt-install
[23]- virt-top 'top'-like utility for virtualization stats
- ovirt-RHV module
- virt-admin
- libvirtd:
systemctl status libvirtd
,systemctl status libvirt-guests
, Libvirt release notes, logs,libvirtd.conf
,/etc/libvirt/
,/var/log/libvirt/
- KVM, Installation, QEMU,
virsh
,virtinst
,libguestfs-tools
, libvirt, qemu, Red Hat Virtualization (RHV), MacVTap, Virtio, oVirt, KVM services, KVM networking, KVM graphics, CPU, KVM on ARM virsh
: Storage information, Connecting, Operations, Memory, Snapshots, Networking, CPU, release notes,virsh nodedev-list
References[edit]
- ↑ http://manpages.ubuntu.com/manpages/xenial/man1/virsh.1.html
- ↑ https://github.com/libvirt/libvirt/blob/master/tools/virsh.c
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh
- ↑ https://github.com/libvirt/libvirt/commit/689beaa47c51fb49fafa992dd468116b8f6b0782#diff-f41fa7374ab97c527387ea4ce48fd04e
- ↑ https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-using_the_qemu_guest_virtual_machine_agent_protocol_cli-libvirt_commands
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-using_the_qemu_guest_virtual_machine_agent_protocol_cli-libvirt_commands
- ↑ https://serverfault.com/questions/434064/correct-way-to-move-kvm-vm
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_virtualization/index#creating-storage-for-virtual-machines-using-the-cli_managing-storage-for-virtual-machines-using-the-cli
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_virtualization/index#creating-storage-for-virtual-machines-using-the-cli_managing-storage-for-virtual-machines-using-the-cli
- ↑ https://libvirt.org/news.html
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh
- ↑ https://help.ubuntu.com/community/KVM/Managing
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-creating_a_virtual_machine_xml_dump_configuration_file
- ↑ https://fossies.org/linux/libvirt/NEWS
- ↑ https://libvirt.org/news.html
- ↑ https://libvirt.org/migration.html#offline
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_virtualization/index#creating-storage-for-virtual-machines-using-the-cli_managing-storage-for-virtual-machines-using-the-cli
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_virtualization/index#creating-storage-for-virtual-machines-using-the-cli_managing-storage-for-virtual-machines-using-the-cli
- ↑ https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit
- ↑ https://serverfault.com/questions/434064/correct-way-to-move-kvm-vm
- ↑ https://github.com/virt-manager/virt-manager/tree/master/virtinst
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_virtualization/getting-started-with-virtualization-in-rhel-8_configuring-and-managing-virtualization
Script error: No such module "Check for unknown parameters".
Advertising: