-
Notifications
You must be signed in to change notification settings - Fork 1
/
virsh.cheat
58 lines (41 loc) · 1.45 KB
/
virsh.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% virsh, pushou
# Connect to a local hypervisor
virsh -c qemu:///system list --all
# Connect to a hypervisor session on a remote Linux
virsh --connect qemu+ssh://<USERNAME>@<IP_ADDRESS>/system
# Connect to a hypervisor session on a remote mac (user network => session)
connect qemu+ssh://<USERNAME>@<IP_ADDRESS>/session?socket=/usr/local/var/run/libvirt/libvirt-sock
# list interfaces
virsh -c qemu:///system iface-list --all
# List all domains
virsh list --all
# List all network
virsh net-list --all
# Node info
virsh nodeinfo
# pool list
virsh pool-list --details
# system socket
export LIBVIRT_DEFAULT_URI=qemu:///system
virsh list --all
# volume delete from pool
sudo virsh pool-list
sudo virsh vol-list --pool default
sudo virsh vol-delete test_vol2.qcow2 --pool default
sudo virsh pool-refresh default
sudo virsh vol-list default
# quit console (FRENCH Keyboard)
CTRL+Shift+5
CTRL+Shift+$€*
# stop all VM
for i in $(sudo virsh list | grep running | awk '{print $2}') ─╯
do
sudo virsh shutdown $i
done
# Create a guest from a configuration file
virsh create <path_to_config_file_xml>
# start stop shutdown destroy reboot undefine edit dumpxml save a guest
virsh <COMMAND> <domain>
# Delete a running guest && purge storage
virsh destroy <domain> && virsh undefine <domain> --remove-all-storage
$ COMMAND: echo 'start stop shutdown destroy reboot undefine edit dumpxml save' | tr ' ' '\n'