Hi !

I have a shell script running on all servers which intercepts power off signal 
(in case of power failure).

Is it safe to use direct KVM “virsh” commands to force guest shutdown on oVirt 
nodes, bypassing oVirt engine ?

“shutdown now” directly on oVirt nodes v4.2.6 takes an enormous amount of time 
because for whatever reason guests can’t be suspended. My nodes installed on 
CentOS 7.5, I’m not using pre-packaged version because each consecutive upgrade 
simply wipes out all my mods.

Thanks in advance.
Andrei


PS. I found this script to shutdown KVM guests:
***************************************
#!/bin/bash

# 
https://ask.fedoraproject.org/en/question/8796/make-libvirt-to-shutdown-my-guests-not-suspend/

LIST_VM=`virsh list | grep running | awk '{print $2}'`
TIMEOUT=90
DATE=`date -R`
LOGFILE="/var/log/shutdownkvm.log"

if [ "x$activevm" =  "x" ]
        then
        exit 0
fi

for activevm in $LIST_VM
do
        PIDNO=`ps ax | grep $activevm | grep kvm | cut -c 1-6 | head -n1`
        echo "$DATE : Shutdown : $activevm : $PIDNO" >> $LOGFILE
        virsh shutdown $activevm > /dev/null
        COUNT=0

        while [ "$COUNT" -lt "$TIMEOUT" ]
        do
                ps --pid $PIDNO > /dev/null
                if [ "$?" -eq "1" ]
                then
                        COUNT=110
                else
                        sleep 5
                        COUNT=$(($COUNT+5))
                fi
        done

        if [ $COUNT -lt 110 ]
        then
                echo "$DATE : $activevm not successful force shutdown" >> 
$LOGFILE
                virsh destroy $activevm > /dev/null
        fi
done
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/5VLULJB6A7RSEL5PU4SBXGNTQZCIQBRP/

Reply via email to