KVM (Kernel-based Virtual Machine)
## VM Remove
virsh undefine test101
virsh undefine test102 --managed-save
virsh undefine test103 --remove-all-storage
rm -f /opt/kvm/test10[1-3].qcow2
## VM Clone
virt-clone --original template --name test101 --file /opt/kvm/test101.qcow2
virt-clone --original template --name test102 --file /opt/kvm/test102.qcow2
virt-clone --original template --name test103 --file /opt/kvm/test103.qcow2
################################################################################
## VM Console & Initialize (CentOS 6)
virsh start test101 && virsh console test101
NNAME=test101
NIP=10.59.72.101
sed -i "/^HOSTNAME/ s/template/$NNAME/" /etc/sysconfig/network
sed -i "/^IPADDR/ s/10.59.72.100/$NIP/" /etc/sysconfig/network-scripts/ifcfg-eth0
cat /dev/null >/etc/udev/rules.d/70-persistent-net.rules
init 6
################################################################################
## VM Console & Initialize (CentOS 7)
virsh start test104 && virsh console test104
NNAME=test104
NIP=10.59.72.104
hostnamectl set-hostname "$NNAME"
sed -i "/^IPADDR/ s/10.59.72.110/$NIP/" /etc/sysconfig/network-scripts/ifcfg-eth0
init 6
################################################################################
Attach Disk
## RAW (vdb)
qemu-img create -f raw /opt/kvm/test101-vdb.raw 200G
virsh attach-disk --domain test101 --source /opt/kvm/test101-vdb.raw --target vdb --persistent
## QCOW2 (vdc)
qemu-img create -f qcow2 /opt/kvm/test101-vdc.qcow2 200G
virsh attach-disk test101 /opt/kvm/test101-vdc.qcow2 vdc --persistent --driver qemu --subdriver qcow2
Attach Interface
## Bridge (br1)
virsh attach-interface --domain test101 --type bridge --source br1 --model virtio --config