virsh命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了virsh命令相关的知识,希望对你有一定的参考价值。

 

查看虚拟机:

[[email protected] ~]# virsh list

 Id    Name                           State

----------------------------------------------------

 4     ubuntu16                      running

 

开启虚拟机:

vish start ubuntu16 

关机需要借助acpid

[[email protected] ~]# yum install -y acpid

[[email protected] ~]# reboot

[[email protected] ~]# /etc/init.d/acpid start

[[email protected] ~]# chkconfig acpid on

关机:

[[email protected] ~]# virsh shutdown ubuntu16

Domain ubuntu16 is being shutdown

断电:

[[email protected] ~]# virsh destroy ubuntu16

Domain unbuntu16 destroyed

挂起:

[[email protected] ~]# virsh suspend ubuntu16

恢复:

[[email protected] ~]# virsh resume ubuntu16

 

 

通过配置文件启动虚拟机:

[[email protected] ~]# virsh create /etc/libvirt/qemu/ubuntu16.xml

Domain ubuntu16 created from /etc/libvirt/qemu/ubuntu16.xml

 

开机启动:

[[email protected] ~]# virsh autostart ubuntu16

Domain ubuntu16 marked as autostarted

 

查看开机启动:

[[email protected] autostart]# pwd

/etc/libvirt/qemu/autostart

[[email protected] autostart]# ls

ubuntu16.xml

 

以上是关于virsh命令的主要内容,如果未能解决你的问题,请参考以下文章

virsh的详细命令解析

05.virsh命令的常用操作(kvm)

3 kvm之virsh管理命令

virsh命令行管理工具

text virsh kvm命令集

virsh命令