Virsh commands: Difference between revisions

From DISI
Jump to navigation Jump to search
(Created libvirt virsh command list)
 
No edit summary
 
Line 15: Line 15:
Adding a network interface to a VM
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
  virsh attach-interface --domain <vm_name> --type <bridge/network> --source <source-device> --model virtio --mac <insert-whatever-mac-address> --config
To detach a virtual cdrom/iso file from a VM
sudo virsh detach-disk <vmname> <full path on server to iso/cd image file> --config

Latest revision as of 19:47, 4 February 2019

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

To detach a virtual cdrom/iso file from a VM

sudo virsh detach-disk <vmname> <full path on server to iso/cd image file> --config