kvm_tips

Install

1
yum -y install qemu-kvm libvirt virt-install bridge-utils

KVM Multipath

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/kvm/fileA.qcow2'/>
<target dev='sda' bus='scsi'/>
<serial>0002</serial>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/kvm/fileA.qcow2'/>
<target dev='sdb' bus='scsi'/>
<serial>0002</serial>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>

Snapshot

1
2
3
4
5
6
7
8
9
10
11
12
13
# list
qemu-img snapshot -l /kvm/fileA.qcow2
ID ...
1 ...

# create
qemu-img snapshot -c first /kvm/fileA.qcow2

# recovery
qemu-img snapshot -a 1 /kvm/fileA.qcow2

# Delete
qemu-img snapshot -d 1 /kvm/fileA.qcow2

Create convert base image

1
2
3
4
5
qemu-img create -f qed vm1.qed 80G
qemu-img convert -f vmdk -O raw centos7.vmdk centos7.img
#Base images
qemu-img create -b centos6-base.qed -f qed centos6-tmp.qed
qemu-img rebase -u -b centos-6.qed ./kvm1.qed

Virt-manager show unreadable code

1
2
3
yum -y install dejavu-sans-fonts
# if you need Chinese
yum -y install ghostscript-chinese-zh_CN