來賓 KVM/libvirt 延遲啟動

來賓 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 配置,但隨後什麼也不會啟動(並不奇怪)。

有人能做到這一點或有替代方法嗎?

我知道我可以重定向模擬器路徑以在腳本中引入延遲,但這會影響新來賓的創建,而這不是選項。

謝謝。

相關內容