#!bin/bash
case "$1" in
start)
echo start $2 ...
virsh start $2 &> /dev/null
;;
poweroff)
echo poweroff $2 ...
virsh destroy $2 &> /dev/null
;;
reboot)
echo reboot $2 ...
virsh destroy $2 &> /dev/null
virsh start $2 &> /dev/null
;;
view)
echo view $2 ...
virt-viewer $2 &> /dev/null
;;
reset)
echo reset $2 ...
virsh destroy $2 &> /dev/null
virsh undefine $2 &> /dev/null
qemu-img create -f qcow2 -b /var/lib/libvirt/p_w_picpaths/vm1.qcow2 /var/lib/libvirt/p_w_picpaths/$2.qcow2
virt-install \
--name $2 \
--ram 1000 \
--disk /var/lib/libvirt/p_w_picpaths/$2.qcow2 \
--import &> /dev/null &
echo created $2 successful !!!
esac