Hi again,

Can you please try this (very minimal) patch.
Florian, please very once you find time.

Cheers,

Dejan

On Fri, Jun 24, 2011 at 02:14:22PM +0200, Dejan Muhamedagic wrote:
> Hi Dominik,
> 
> On Fri, Jun 24, 2011 at 12:33:42PM +0200, Dominik Klein wrote:
> > This fixes the issue described yesterday.
> > 
> > Comments?
> 
> It's not really necessary to introduce a new parameter. See for
> instance oracle or apache RA how they manage that. A quote from
> oracle:
> 
> 681 LSB_STATUS_STOPPED=3
> 682 testoraenv
> 683 rc=$?
> 684 if [ $rc -ne 0 ]; then
> 685     ocf_log info "Oracle environment for SID $ORACLE_SID does not exist"
> 686     case "$1" in
> 687         stop) exit $OCF_SUCCESS;;
> 688         monitor) exit $OCF_NOT_RUNNING;;
> 689         status) exit $LSB_STATUS_STOPPED;;
> 690         *)
> 691             ocf_log err "Oracle environment for SID $ORACLE_SID broken"
> 692             exit $rc
> 693         ;;
> 694     esac
> 695 fi
> 
> It should probably be changed a bit for the monitor action, sth
> like:
> 
>     monitor) is_ocf_probe && exit $OCF_NOT_RUNNING || exit $OCF_ERR_GENERIC;;
> 
> Though as it is, it'll work correctly.
> 
> Cheers,
> 
> Dejan
> 
> > Regards
> > Dominik
> 
> > exporting patch:
> > # HG changeset patch
> > # User Dominik Klein <dominik.kl...@gmail.com>
> > # Date 1308909599 -7200
> > # Node ID 2b1615aaca2c90f2f4ab93eb443e5902906fb28a
> > # Parent  7a11934b142d1daf42a04fbaa0391a3ac47cee4c
> > RA VirtualDomain: Fix probe if config is not on shared storage
> > 
> > diff -r 7a11934b142d -r 2b1615aaca2c heartbeat/VirtualDomain
> > --- a/heartbeat/VirtualDomain       Fri Feb 25 12:23:17 2011 +0100
> > +++ b/heartbeat/VirtualDomain       Fri Jun 24 11:59:59 2011 +0200
> > @@ -19,9 +19,11 @@
> >  # Defaults
> >  OCF_RESKEY_force_stop_default=0
> >  OCF_RESKEY_hypervisor_default="$(virsh --quiet uri)"
> > +OCF_RESKEY_config_on_shared_storage_default=1
> >  
> >  : ${OCF_RESKEY_force_stop=${OCF_RESKEY_force_stop_default}}
> >  : ${OCF_RESKEY_hypervisor=${OCF_RESKEY_hypervisor_default}}
> > +: 
> > ${OCF_RESKEY_config_on_shared_storage=${OCF_RESKEY_config_on_shared_storage_default}}
> >  #######################################################################
> >  
> >  ## I'd very much suggest to make this RA use bash,
> > @@ -421,8 +423,8 @@
> >      # check if we can read the config file (otherwise we're unable to
> >      # deduce $DOMAIN_NAME from it, see below)
> >      if [ ! -r $OCF_RESKEY_config ]; then
> > -   if ocf_is_probe; then
> > -       ocf_log info "Configuration file $OCF_RESKEY_config not readable 
> > during probe."
> > +   if ocf_is_probe && ocf_is_true $OCF_RESKEY_config_on_shared_storage; 
> > then
> > +       ocf_log info "Configuration file $OCF_RESKEY_config not readable 
> > during probe. Assuming it is on shared storage and therefore reporting VM 
> > is not running."
> >     else
> >         ocf_log error "Configuration file $OCF_RESKEY_config does not exist 
> > or is not readable."
> >         return $OCF_ERR_INSTALLED
> 
> > exporting patch:
> > # HG changeset patch
> > # User Dominik Klein <dominik.kl...@gmail.com>
> > # Date 1308911272 -7200
> > # Node ID 312adf2449eb59dcc41686626b1726428d13227b
> > # Parent  2b1615aaca2c90f2f4ab93eb443e5902906fb28a
> > RA VirtualDomain: Add metadata for the new parameter
> > 
> > diff -r 2b1615aaca2c -r 312adf2449eb heartbeat/VirtualDomain
> > --- a/heartbeat/VirtualDomain       Fri Jun 24 11:59:59 2011 +0200
> > +++ b/heartbeat/VirtualDomain       Fri Jun 24 12:27:52 2011 +0200
> > @@ -119,6 +119,16 @@
> >  <content type="string" default="" />
> >  </parameter>
> >  
> > +<parameter name="config_on_shared_storage" unique="0" required="0">
> > +<longdesc lang="en">
> > +If your VMs configuration file is _not_ on shared storage, so that the 
> > config 
> > +file not being in place during a probe means that the VM is not 
> > installed/runnable
> > +on that node, set this to 0.
> > +</longdesc>
> > +<shortdesc lang="en">Set to 0 if your VMs config file is not on shared 
> > storage</shortdesc>
> > +<content type="boolean" default="1" />
> > +</parameter>
> > +
> >  </parameters>
> >  
> >  <actions>
> 
> > _______________________________________________________
> > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
> 
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
index d9fd373..0786944 100755
--- a/heartbeat/VirtualDomain
+++ b/heartbeat/VirtualDomain
@@ -453,8 +453,9 @@ VirtualDomain_Validate_All || exit $?
 # unable to get the domain name. Thus, we also can't check whether the
 # domain is running. The only thing we can do here is to assume that
 # it is not running.
-if ocf_is_probe && [ ! -r $OCF_RESKEY_config ]; then
-    exit $OCF_NOT_RUNNING
+if [ ! -r $OCF_RESKEY_config ]; then
+    ocf_is_probe && exit $OCF_NOT_RUNNING
+    [ "$__OCF_ACTION" = "stop" ] && exit $OCF_SUCCESS
 fi
 
 # Define the domain on startup, and re-define whenever someone deleted
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to