延迟启动 Guest KVM/libvirt

延迟启动 Guest KVM/libvirt

寻找任何指针,任何人都可能必须为 KVM 客户机引入延迟启动,即在启动每个虚拟服务器之间间隔 30 秒,而不是一次启动所有虚拟服务器,这会破坏磁盘,并且实际上最终需要更长的时间才能解决所有问题。

我尝试过的方法是更新 /etc/sysconfig/libvirt-guests,如下所示:

# URIs to check for running guests
# example: URIS='default xen:/// vbox+tcp://host/system lxc:///'
#URIS=default

# action taken on host boot
# - start   all guests which were running on shutdown are started on boot
#           regardless on their autostart settings
# - ignore  libvirt-guests init script won't start any guest on boot, however,
#           guests marked as autostart will still be automatically started by
#           libvirtd
ON_BOOT=ignore

# Number of seconds to wait between each guest start. Set to 0 to allow
# parallel startup.
START_DELAY=180

# action taken on host shutdown
# - suspend   all running guests are suspended using virsh managedsave
# - shutdown  all running guests are asked to shutdown. Please be careful with
#             this settings since there is no way to distinguish between a
#             guest which is stuck or ignores shutdown requests and a guest
#             which just needs a long time to shutdown. When setting
#             ON_SHUTDOWN=shutdown, you must also set SHUTDOWN_TIMEOUT to a
#             value suitable for your guests.
ON_SHUTDOWN=shutdown

# If set to non-zero, shutdown will suspend guests concurrently. Number of
# guests on shutdown at any time will not exceed number set in this variable.
#PARALLEL_SHUTDOWN=0

# Number of seconds we're willing to wait for a guest to shut down. If parallel
# shutdown is enabled, this timeout applies as a timeout for shutting down all
# guests on a single URI defined in the variable URIS. If this is 0, then there
# is no time out (use with caution, as guests might not respond to a shutdown
# request). The default value is 300 seconds (5 minutes).
#SHUTDOWN_TIMEOUT=300

# If non-zero, try to bypass the file system cache when saving and
# restoring guests, even though this may give slower operation for
# some file systems.
#BYPASS_CACHE=0

我已经验证了 libvirt.conf 中的默认 URI 路径也是正确的,并尝试将上述配置文件中的默认值更改为 qemu:///system 和 qemu:///

无论所做的更改如何,所有来宾都会同时启动。

我还尝试删除 /etc/libvirt/qemu/autostart/ 的内容,以防符号链接覆盖 libvirt-guests 配置,但是什么都没有启动(这并不奇怪)。

有人成功了或者有其他方法吗?

我知道我可以重定向模拟器路径以在脚本中引入延迟,但这会影响新客户的创建,而这不是一个选择。

谢谢。

相关内容