add a service and script for making sure that VM pools are online
This commit is contained in:
parent
ee93c15da6
commit
7fe6aeb4da
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ALL_OK=false
|
||||
ALL_VIRT_POOLS=("default" "ISOs")
|
||||
|
||||
for POOL in "${ALL_VIRT_POOLS[@]}"; do
|
||||
POOL_OK=false
|
||||
|
||||
while [[ "$POOL_OK" == "false" ]]; do
|
||||
virsh pool-info --pool "$POOL" | grep "State: *running" > /dev/null
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "$POOL: not running"
|
||||
systemctl restart libvirtd && POOL_OK=true
|
||||
else
|
||||
echo "$POOL: OK"
|
||||
POOL_OK=true
|
||||
fi
|
||||
done
|
||||
done
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Ensure that the VM pools are available
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/bash /home/pratham/.scripts/_flameboi/virt/ensure-pool-online-status.sh
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue