标签:linux运维
#!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/images/vm1.qcow2 /var/lib/libvirt/images/$2.qcow2
virt-install \
--name $2 \
--ram 1000 \
--disk /var/lib/libvirt/images/$2.qcow2 \
--import &> /dev/null &
echo created $2 successful !!!
esac
标签:linux运维
原文地址:http://12113775.blog.51cto.com/12103775/1863558