Virsh

From wikieduonline
Revision as of 15:14, 8 December 2019 by Welcome (talk | contribs) (Created page with "<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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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:

Basic Commands

  • virsh
  • virsh -r

All Commands

Getting Information

  • List Running Virtual Machines: /virsh list/[12][13]
    • virsh list --name
    • List all Virtual Machines: virsh list --all
  • View configuration: /virsh dumpxml/ {guest-id, VM_NAME or uuid} > yourfilename.xml[14]
    • Virtual interfaces: virsh domiflist VM_NAME

Network info:

Storage info:


Guest info:

  • virsh version
virsh version
Compiled against library: libvirt 4.0.0
Using library: libvirt 4.0.0
Using API: QEMU 4.0.0
Running hypervisor: QEMU 2.11.1

Operations

/Changing VM running status operations/:


Snapshots:

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 Storage commands/

/Virsh Storage Information/

All Storage commands

KVM virsh Snapshots

/Virsh CPU Commands/

/Virsh Memory Commands/

QEMU

  • virsh qemu-attach QEMU Attach
  • virsh qemu-monitor-command QEMU Monitor Command
  • virsh qemu-monitor-event QEMU Monitor Events
    • virsh qemu-monitor-event VM_MACHINE_NAME
  • virsh qemu-agent-command QEMU Guest Agent Command

Networking

  • virsh net-autostart autostart a network
  • virsh net-create create a network from an XML file
  • virsh net-define define an inactive persistent virtual network or modify an existing persistent one from an XML file
  • virsh net-destroy destroy (stop) a network
  • virsh /net-dhcp-leases/ print lease info for a given network
  • /virsh net-dumpxml/ NET_NAME network information in XML
  • virsh net-edit edit XML configuration for a network
  • virsh net-event Network Events
  • virsh /net-info/ network information
  • virsh /net-list/ list networks
  • virsh net-name convert a network UUID to network name
  • virsh net-start start a (previously defined) inactive network
  • virsh net-undefine undefine a persistent network
  • virsh net-update update parts of an existing network's configuration
  • virsh net-uuid convert a network name to network UUID

Activities

See also

  • 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
  • Advertising: