Virsh commands

From DISI
Revision as of 17:15, 9 October 2017 by Benrwong (talk | contribs) (Created libvirt virsh command list)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

virsh is command line tool for the libvirt API which allows us to interact with Linux kernel virtual machines (KVM)

Handy Commands

To list all virtual machines and their state on hypervisor

virsh list --all

To start a powered down virtual machine

virsh start <vm_name>

To force shutdown a virtual machine (pulling the plug on a VM)

virsh destroy --graceful <vm_name>

To view virtual machine network interfaces

virsh domiflist <vm_name>

Adding a network interface to a VM

virsh attach-interface --domain <vm_name> --type <bridge/network> --source <source-device> --model virtio --mac <insert-whatever-mac-address> --config