KVM实例的自启动
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KVM实例的自启动相关的知识,希望对你有一定的参考价值。
让KVM实例在Host OS启动时,KVM里面的虚拟机也跟着自动启动,不需要我们人工的参与。在KVM服务器启动后或者libvirtd重新启动后,KVM虚拟机自动启动,运行以下步骤:
(1)开启VM的自动启动
[email protected]:~# virsh autostart kvm1
Domain kvm1 marked as autostarted
(2)获得实例的详细信息
[email protected]:~# virsh dominfo kvm1
Id: 31
Name: kvm1
UUID: 6ad84d8a-229d-d1f6-ecfc-d29a25fcfa03
OS Type: hvm
State: running
CPU(s): 2
CPU time: 10.9s
Max memory: 2097152 KiB
Used memory: 1048576 KiB
Persistent: yes
Autostart: enable
Managed save: no
Security model: none
Security DOI: 0
(3)停止运行的实例并确保它是处理shut off的状态
[email protected]:~# virsh destroy kvm1
Domain kvm1 destroyed
[email protected]:~# virsh list --all
Id Name State
----------------------------------------------------
- kvm1 shut off
(4)停止libvirt的进程,并确保它没有运行。
[email protected]:~# /etc/init.d/libvirt-bin stop
libvirt-bin stop/waiting
[email protected]:~# pgrep -lfa libvirtd
(5)开启libvirt的进程
[email protected]:~# /etc/init.d/libvirt-bin start
libvirt-bin start/running, process 6639
(6)列出运行的实例
[email protected]:~# virsh list --all
Id Name State
----------------------------------------------------
2 kvm1 running
(7)关闭autostart选项
[email protected]:~# virsh autostart kvm1 --disable
Domain kvm1 unmarked as autostarted
(8)确保我们的改变是否生效
[email protected]:~# virsh dominfo kvm1 | grep -i autostart
Autostart: disable
以上是关于KVM实例的自启动的主要内容,如果未能解决你的问题,请参考以下文章