virsh命令
查看虚拟机:
[root@super67 ~]# virsh list
Id Name State
----------------------------------------------------
4 ubuntu16 running
开启虚拟机:
vish start ubuntu16
关机需要借助acpid
[root@super67 ~]# yum install -y acpid
[root@super67 ~]# reboot
[root@super67 ~]# /etc/init.d/acpid start
[root@super67 ~]# chkconfig acpid on
关机:
[root@super67 ~]# virsh shutdown ubuntu16
Domain ubuntu16 is being shutdown
断电:
[root@super67 ~]# virsh destroy ubuntu16
Domain unbuntu16 destroyed
挂起:
[root@super67 ~]# virsh suspend ubuntu16
恢复:
[root@super67 ~]# virsh resume ubuntu16
通过配置文件启动虚拟机:
[root@super67 ~]# virsh create /etc/libvirt/qemu/ubuntu16.xml
Domain ubuntu16 created from /etc/libvirt/qemu/ubuntu16.xml
开机启动:
[root@super67 ~]# virsh autostart ubuntu16
Domain ubuntu16 marked as autostarted
查看开机启动:
[root@super67 autostart]# pwd
/etc/libvirt/qemu/autostart
[root@super67 autostart]# ls
ubuntu16.xml
--------------------------------------
看看别人总结的:
虚拟机名字为redhat: