[Pacemaker] Patches for VirtualDomain RA

Michael Schwartzkopff misch at clusterbau.com
Mon Aug 1 11:30:00 UTC 2011


Hi,

I hope I found the correct list. Playing with the VirtualDomain RA I found two 
problems. Please find the description and patches below.


1) During stop operation libvirt occasionally returns an error because the 
state cannot be determined just the moment the machine is shut down. This 
patch makes the RA try to get the state again one time. If the machine is down 
then everything is OK.

--- /root/VirtualDomain 2011-07-29 08:39:30.652675972 +0200
+++ /usr/lib/ocf/resource.d/heartbeat/VirtualDomain     2011-07-29 
10:08:24.712790703 +0200
@@ -149,6 +149,7 @@
 VirtualDomain_Status() {
     rc=$OCF_ERR_GENERIC
     status="no state"
+    bail_wait="yes";
     while [ "$status" = "no state" ]; do
         status="`virsh $VIRSH_OPTIONS domstate $DOMAIN_NAME`"
         case "$status" in
@@ -177,8 +178,13 @@
                    # During the stop operation, we want to bail out
                    # quickly, so as to be able to force-stop (destroy)
                    # the domain if necessary.
-                   ocf_log error "Virtual domain $DOMAIN_NAME has no state 
during 
stop operation, bailing out."
-                   return $OCF_ERR_GENERIC;
+                   ocf_log info "Virtual domain $DOMAIN_NAME has no state 
during 
stop operation."
+                   if [ "$bail_wait" = "no" ]; then
+                       ocf_log error "Virtual domain $DOMAIN_NAME has no 
state 
during stop operation, bailing out."
+                       return $OCF_ERR_GENERIC;
+                   fi
+                   bail_wait="no"
+                   sleep 1
                else
                    # During all other actions, we just wait and try
                    # again, relying on the CRM/LRM to time us out if

2) The next problem is that a graceful shutdown sometimes does not work when 
the machine just booted. This patch makes the RA send a shutdown command every 
10 seconds while shutting down the machine. This catches the boot problem.

@@ -234,6 +240,9 @@
                shutdown_timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000)-5))
                # Loop on status for $shutdown_timeout seconds
                for i in `seq $shutdown_timeout`; do
+                   if [ $((i%10)) -eq 0 ]; then
+                       virsh $VIRSH_OPTIONS shutdown ${DOMAIN_NAME}
+                   fi
                    VirtualDomain_Status
                    status=$?
                    case $status in

Greetings,

-- 
Dr. Michael Schwartzkopff
Guardinistr. 63
81375 München

Tel: (0163) 172 50 98
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20110801/cf0ad8c6/attachment-0003.sig>


More information about the Pacemaker mailing list