Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-06-01 Thread Anders Widell
Ok I think 2. is a good solution. It is more generic and doesn't treat 
opensafd in any special way compared to the other init scripts that are 
installed on the system.


/ Anders Widell


On 06/01/2017 10:52 AM, Rafael Odzakow wrote:

1. Not possible, check my other response.

2. I am OK with that solution.


On 06/01/2017 10:33 AM, Anders Widell wrote:

Hi!

Can't you return 150 from the opensafd stop command instead? Then the 
caller will know that he has to retry opensafd stop. Or maybe put the 
retry inside the opensafd script?


/ Anders W


On 05/19/2017 12:46 PM, Rafael Odzakow wrote:

Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
  src/nid/opensafd.in | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..c93cca7e1 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -326,8 +326,14 @@ forcereload() {
  }
status() {
+
  amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-if [ -n "$amfpid" ]; then
+
+if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in 
progress"
+# LSB defines 150-199 as application reserved exit 
codes

+RETVAL=150
+elif [ -n "$amfpid" ]; then
  amf-state siass ha
  RETVAL=$?
  else







--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-06-01 Thread Rafael Odzakow

Only thing you are telling me is to ignore the implementation.


It seems you still do not fully understand the issue. I am done 
repeating myself.



On 06/01/2017 12:17 PM, Hans Nordebäck wrote:
Again, opensaf status returns either 0 "opensaf system is running" or 
3 "opensaf system is not running".
As I also commented before, what is the problem you are trying to 
solve? If SMF orders reboot and
opensaf stop fails the node will be rebooted anyway, you replied ... " 
opensafd but from services that can not handle a abrupt reboot."
Which services are you referring to? The system may be abrubtly 
rebooted at any time.


 /Hans

-Original Message-
From: Rafael Odzakow
Sent: den 1 juni 2017 10:41
To: Hans Nordebäck ; Anders Widell 


Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] base: Improve state report for opensafd [#2459]

This "definition" is flawed.


opensafd stop is issued by the system when a node receives the reboot 
command. It is not directly called by SMF.


As the issuer of the reboot command SMF needs to know if the stop is 
possible to execute because a prior start might still be ongoing.


With your suggestion Hans SMF would also find out the status of AMF 
pid and amf-status command. I do not like to drag in unnecessary 
dependencies.




On 05/31/2017 01:59 PM, Hans Nordebäck wrote:
> opensafd status reports if opensaf is running or not. There is a
> "window" from where amfnd is up and til the
>
> "lockfile_inprogress" is removed. This "window" is handled with the
> suggested change.
>
> The definition of a running opensaf is that amfnd is running and now
> also that
>
> the "lockfile_inprogress" file does not exist. If amfnd stops running
> the node will immediately be rebooted.
>
> It is not necessary to check all services.
>
> /Hans
>
>
>
> On 05/31/2017 01:35 PM, Rafael Odzakow wrote:
>> I don't agree with this suggestion having AMF in the status report of
>> opensafd init script does not fit in here. AMF is not OpenSAF it is
>> only a subset.
>>
>> - Either have all services report status, or
>>
>> - Have only the init script reports it internal status
>>
>> The patch is avoiding this issue by creating a new return code
>> because a real solution would be NBC. But as this script is pretty
>> central to OpenSAF I am thinḱing NBC route would be better.
>>
>>
>> On 05/31/2017 12:42 PM, Hans Nordebäck wrote:
>>> Hi Rafael,
>>>
>>> not tested, but perhaps we can do this check instead?:
>>>
>>> status() {
>>>
>>> amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
>>>
>>> if [[ -n "$amfpid" && ! -f "$lockfile_inprogress" ]; then
>>> amf-state siass ha
>>> RETVAL=$?
>>> else
>>> echo "The OpenSAF HA Framework is not running"
>>> RETVAL=3
>>> fi
>>>
>>> return $RETVAL
>>> }
>>>
>>> /Hans
>>>
>>>
>>> On 05/19/2017 12:46 PM, Rafael Odzakow wrote:
 Internally opensafd creates a lock file during start/stop to avoid
 parallel execution. To allow others to query the state this ticket
 will
 use the opensafd lockfile to report the status of start/stop when
 requested with "opensafd status"
 ---
   src/nid/opensafd.in | 8 +++-
   1 file changed, 7 insertions(+), 1 deletion(-)

 diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
 index e7683bd7e..c93cca7e1 100644
 --- a/src/nid/opensafd.in
 +++ b/src/nid/opensafd.in
 @@ -326,8 +326,14 @@ forcereload() {
   }
 status() {
 +
   amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
 -if [ -n "$amfpid" ]; then
 +
 +if [ -e "$lockfile_inprogress" ]; then
 +echo "Lockfile taken, OpenSAF start/stop is in
 progress"
 +# LSB defines 150-199 as application reserved exit
 codes
 +RETVAL=150
 +elif [ -n "$amfpid" ]; then
   amf-state siass ha
   RETVAL=$?
   else
>>>
>>
>>
>




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-06-01 Thread Hans Nordebäck
Again, opensaf status returns either 0 "opensaf system is running" or 3 
"opensaf system is not running".
As I also commented before, what is the problem you are trying to solve? If SMF 
orders reboot and 
opensaf stop fails the node will be rebooted anyway, you replied ... " opensafd 
but from services that can not handle a abrupt reboot."
Which services are you referring to? The system may be abrubtly rebooted at any 
time.

 /Hans

-Original Message-
From: Rafael Odzakow 
Sent: den 1 juni 2017 10:41
To: Hans Nordebäck ; Anders Widell 

Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] base: Improve state report for opensafd [#2459]

This "definition" is flawed.


opensafd stop is issued by the system when a node receives the reboot command. 
It is not directly called by SMF.

As the issuer of the reboot command SMF needs to know if the stop is possible 
to execute because a prior start might still be ongoing.

With your suggestion Hans SMF would also find out the status of AMF pid and 
amf-status command. I do not like to drag in unnecessary dependencies.



On 05/31/2017 01:59 PM, Hans Nordebäck wrote:
> opensafd status reports if opensaf is running or not. There is a 
> "window" from where amfnd is up and til the
>
> "lockfile_inprogress" is removed. This "window" is handled with the 
> suggested change.
>
> The definition of a running opensaf is that amfnd is running and now 
> also that
>
> the "lockfile_inprogress" file does not exist. If amfnd stops running 
> the node will immediately be rebooted.
>
> It is not necessary to check all services.
>
> /Hans
>
>
>
> On 05/31/2017 01:35 PM, Rafael Odzakow wrote:
>> I don't agree with this suggestion having AMF in the status report of 
>> opensafd init script does not fit in here. AMF is not OpenSAF it is 
>> only a subset.
>>
>> - Either have all services report status, or
>>
>> - Have only the init script reports it internal status
>>
>> The patch is avoiding this issue by creating a new return code 
>> because a real solution would be NBC. But as this script is pretty 
>> central to OpenSAF I am thinḱing NBC route would be better.
>>
>>
>> On 05/31/2017 12:42 PM, Hans Nordebäck wrote:
>>> Hi Rafael,
>>>
>>> not tested, but perhaps we can do this check instead?:
>>>
>>> status() {
>>>
>>> amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
>>>
>>> if [[ -n "$amfpid" && ! -f "$lockfile_inprogress" ]; then
>>> amf-state siass ha
>>> RETVAL=$?
>>> else
>>> echo "The OpenSAF HA Framework is not running"
>>> RETVAL=3
>>> fi
>>>
>>> return $RETVAL
>>> }
>>>
>>> /Hans
>>>
>>>
>>> On 05/19/2017 12:46 PM, Rafael Odzakow wrote:
 Internally opensafd creates a lock file during start/stop to avoid
 parallel execution. To allow others to query the state this ticket 
 will
 use the opensafd lockfile to report the status of start/stop when
 requested with "opensafd status"
 ---
   src/nid/opensafd.in | 8 +++-
   1 file changed, 7 insertions(+), 1 deletion(-)

 diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
 index e7683bd7e..c93cca7e1 100644
 --- a/src/nid/opensafd.in
 +++ b/src/nid/opensafd.in
 @@ -326,8 +326,14 @@ forcereload() {
   }
 status() {
 +
   amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
 -if [ -n "$amfpid" ]; then
 +
 +if [ -e "$lockfile_inprogress" ]; then
 +echo "Lockfile taken, OpenSAF start/stop is in 
 progress"
 +# LSB defines 150-199 as application reserved exit 
 codes
 +RETVAL=150
 +elif [ -n "$amfpid" ]; then
   amf-state siass ha
   RETVAL=$?
   else
>>>
>>
>>
>


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-06-01 Thread Rafael Odzakow

1. Not possible, check my other response.

2. I am OK with that solution.


On 06/01/2017 10:33 AM, Anders Widell wrote:

Hi!

Can't you return 150 from the opensafd stop command instead? Then the 
caller will know that he has to retry opensafd stop. Or maybe put the 
retry inside the opensafd script?


/ Anders W


On 05/19/2017 12:46 PM, Rafael Odzakow wrote:

Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
  src/nid/opensafd.in | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..c93cca7e1 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -326,8 +326,14 @@ forcereload() {
  }
status() {
+
  amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-if [ -n "$amfpid" ]; then
+
+if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in 
progress"
+# LSB defines 150-199 as application reserved exit 
codes

+RETVAL=150
+elif [ -n "$amfpid" ]; then
  amf-state siass ha
  RETVAL=$?
  else





--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-06-01 Thread Anders Widell

Hi!

Can't you return 150 from the opensafd stop command instead? Then the 
caller will know that he has to retry opensafd stop. Or maybe put the 
retry inside the opensafd script?


/ Anders W


On 05/19/2017 12:46 PM, Rafael Odzakow wrote:

Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
  src/nid/opensafd.in | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..c93cca7e1 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -326,8 +326,14 @@ forcereload() {
  }
  
  status() {

+
amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-   if [ -n "$amfpid" ]; then
+
+   if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in progress"
+# LSB defines 150-199 as application reserved exit codes
+RETVAL=150
+elif [ -n "$amfpid" ]; then
amf-state siass ha
RETVAL=$?
else



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-31 Thread Hans Nordebäck
opensafd status reports if opensaf is running or not. There is a 
"window" from where amfnd is up and til the


"lockfile_inprogress" is removed. This "window" is handled with the 
suggested change.


The definition of a running opensaf is that amfnd is running and now 
also that


the "lockfile_inprogress" file does not exist. If amfnd stops running 
the node will immediately be rebooted.


It is not necessary to check all services.

/Hans



On 05/31/2017 01:35 PM, Rafael Odzakow wrote:
I don't agree with this suggestion having AMF in the status report of 
opensafd init script does not fit in here. AMF is not OpenSAF it is 
only a subset.


- Either have all services report status, or

- Have only the init script reports it internal status

The patch is avoiding this issue by creating a new return code because 
a real solution would be NBC. But as this script is pretty central to 
OpenSAF I am thinḱing NBC route would be better.



On 05/31/2017 12:42 PM, Hans Nordebäck wrote:

Hi Rafael,

not tested, but perhaps we can do this check instead?:

status() {

amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`

if [[ -n "$amfpid" && ! -f "$lockfile_inprogress" ]; then
amf-state siass ha
RETVAL=$?
else
echo "The OpenSAF HA Framework is not running"
RETVAL=3
fi

return $RETVAL
}

/Hans


On 05/19/2017 12:46 PM, Rafael Odzakow wrote:

Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
  src/nid/opensafd.in | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..c93cca7e1 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -326,8 +326,14 @@ forcereload() {
  }
status() {
+
  amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-if [ -n "$amfpid" ]; then
+
+if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in 
progress"
+# LSB defines 150-199 as application reserved exit 
codes

+RETVAL=150
+elif [ -n "$amfpid" ]; then
  amf-state siass ha
  RETVAL=$?
  else








--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-31 Thread Rafael Odzakow
I don't agree with this suggestion having AMF in the status report of 
opensafd init script does not fit in here. AMF is not OpenSAF it is only 
a subset.


- Either have all services report status, or

- Have only the init script reports it internal status

The patch is avoiding this issue by creating a new return code because a 
real solution would be NBC. But as this script is pretty central to 
OpenSAF I am thinḱing NBC route would be better.



On 05/31/2017 12:42 PM, Hans Nordebäck wrote:

Hi Rafael,

not tested, but perhaps we can do this check instead?:

status() {

amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`

if [[ -n "$amfpid" && ! -f "$lockfile_inprogress" ]; then
amf-state siass ha
RETVAL=$?
else
echo "The OpenSAF HA Framework is not running"
RETVAL=3
fi

return $RETVAL
}

/Hans


On 05/19/2017 12:46 PM, Rafael Odzakow wrote:

Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
  src/nid/opensafd.in | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..c93cca7e1 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -326,8 +326,14 @@ forcereload() {
  }
status() {
+
  amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-if [ -n "$amfpid" ]; then
+
+if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in 
progress"
+# LSB defines 150-199 as application reserved exit 
codes

+RETVAL=150
+elif [ -n "$amfpid" ]; then
  amf-state siass ha
  RETVAL=$?
  else






--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-19 Thread Rafael Odzakow
Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
 src/nid/opensafd.in | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..c93cca7e1 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -326,8 +326,14 @@ forcereload() {
 }
 
 status() {
+
amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-   if [ -n "$amfpid" ]; then
+
+   if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in progress"
+# LSB defines 150-199 as application reserved exit codes
+RETVAL=150
+elif [ -n "$amfpid" ]; then
amf-state siass ha
RETVAL=$?
else
-- 
2.11.0


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-17 Thread Rafael Odzakow
The node is only allowed to be rebooted by the campaign during this 
scenario. In some rare cases SMF will reboot a node several times.

This problem is shows the message "opensafd start/stop already in 
progress". The follow up errors are not from opensafd but from services 
that can not handle a abrupt reboot.


On 05/17/2017 12:26 PM, Hans Nordebäck wrote:
> Hi Rafael,
>
> not sure if checking status of OpenSAF before ordering a reboot will 
> have any effect as the result
>
> of the call will only be momentarily accurate. Is the problem this 
> ticket address when SMF is ordering a
>
> reboot of a not fully started OpenSAF, and the "opensafd start/stop 
> already in progress" message in the syslog?
>
> If so, is this a problem, as a reboot has been ordered and will be 
> performed but without running opensafd stop?
>
> Perhaps we can change severity of the opensafd log messages instead?
>
> /Thanks HansN
>
>
> On 05/15/2017 03:56 PM, Rafael Odzakow wrote:
>> Internally opensafd creates a lock file during start/stop to avoid
>> parallel execution. To allow others to query the state this ticket will
>> use the opensafd lockfile to report the status of start/stop when
>> requested with "opensafd status"
>> ---
>>   src/nid/opensafd.in | 19 ++-
>>   1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
>> index e7683bd7e..54841c372 100644
>> --- a/src/nid/opensafd.in
>> +++ b/src/nid/opensafd.in
>> @@ -12,6 +12,17 @@
>>   # Description: Start and stop the OpenSAF node
>>   ### END INIT INFO
>>   +# Exit codes:
>> +# 0: OK
>> +# 1: General error
>> +# 2: Argument error
>> +#
>> +# 'status' exit codes:
>> +# 0: OK
>> +# 1: AMF state error
>> +# 3: No AMF PID found
>> +# 4: Lockfile is taken, opensafd start/stop is in progress
>> +
>>   osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
>>   osafprog="opensafd"
>>   osafprog_inprogress="opensafd_inprogress"
>> @@ -326,9 +337,15 @@ forcereload() {
>>   }
>> status() {
>> +
>>   amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
>> -if [ -n "$amfpid" ]; then
>> +
>> +if [ -e "$lockfile_inprogress" ]; then
>> +echo "Lockfile taken, OpenSAF start/stop is in 
>> progress"
>> +RETVAL=4
>> +elif [ -n "$amfpid" ]; then
>>   amf-state siass ha
>> +# Two possible error codes: 0 or 1
>>   RETVAL=$?
>>   else
>>   echo "The OpenSAF HA Framework is not running"
>



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-17 Thread Rafael Odzakow
Will do thanks.


On 05/17/2017 12:43 PM, Anders Widell wrote:
> The exit codes for an init script are defined by LSB:
>
> http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
>  
>
>
> so if we are going to touch the init scipt, I think we ought to align 
> the exit codes to the above specification.
>
> regards,
>
> Anders Widell
>
>
> On 05/17/2017 12:26 PM, Hans Nordebäck wrote:
>> Hi Rafael,
>>
>> not sure if checking status of OpenSAF before ordering a reboot will 
>> have any effect as the result
>>
>> of the call will only be momentarily accurate. Is the problem this 
>> ticket address when SMF is ordering a
>>
>> reboot of a not fully started OpenSAF, and the "opensafd start/stop 
>> already in progress" message in the syslog?
>>
>> If so, is this a problem, as a reboot has been ordered and will be 
>> performed but without running opensafd stop?
>>
>> Perhaps we can change severity of the opensafd log messages instead?
>>
>> /Thanks HansN
>>
>>
>> On 05/15/2017 03:56 PM, Rafael Odzakow wrote:
>>> Internally opensafd creates a lock file during start/stop to avoid
>>> parallel execution. To allow others to query the state this ticket will
>>> use the opensafd lockfile to report the status of start/stop when
>>> requested with "opensafd status"
>>> ---
>>>   src/nid/opensafd.in | 19 ++-
>>>   1 file changed, 18 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
>>> index e7683bd7e..54841c372 100644
>>> --- a/src/nid/opensafd.in
>>> +++ b/src/nid/opensafd.in
>>> @@ -12,6 +12,17 @@
>>>   # Description: Start and stop the OpenSAF node
>>>   ### END INIT INFO
>>>   +# Exit codes:
>>> +# 0: OK
>>> +# 1: General error
>>> +# 2: Argument error
>>> +#
>>> +# 'status' exit codes:
>>> +# 0: OK
>>> +# 1: AMF state error
>>> +# 3: No AMF PID found
>>> +# 4: Lockfile is taken, opensafd start/stop is in progress
>>> +
>>>   osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
>>>   osafprog="opensafd"
>>>   osafprog_inprogress="opensafd_inprogress"
>>> @@ -326,9 +337,15 @@ forcereload() {
>>>   }
>>> status() {
>>> +
>>>   amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
>>> -if [ -n "$amfpid" ]; then
>>> +
>>> +if [ -e "$lockfile_inprogress" ]; then
>>> +echo "Lockfile taken, OpenSAF start/stop is in 
>>> progress"
>>> +RETVAL=4
>>> +elif [ -n "$amfpid" ]; then
>>>   amf-state siass ha
>>> +# Two possible error codes: 0 or 1
>>>   RETVAL=$?
>>>   else
>>>   echo "The OpenSAF HA Framework is not running"
>>
>
>



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-17 Thread Anders Widell
The exit codes for an init script are defined by LSB:

http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

so if we are going to touch the init scipt, I think we ought to align 
the exit codes to the above specification.

regards,

Anders Widell


On 05/17/2017 12:26 PM, Hans Nordebäck wrote:
> Hi Rafael,
>
> not sure if checking status of OpenSAF before ordering a reboot will 
> have any effect as the result
>
> of the call will only be momentarily accurate. Is the problem this 
> ticket address when SMF is ordering a
>
> reboot of a not fully started OpenSAF, and the "opensafd start/stop 
> already in progress" message in the syslog?
>
> If so, is this a problem, as a reboot has been ordered and will be 
> performed but without running opensafd stop?
>
> Perhaps we can change severity of the opensafd log messages instead?
>
> /Thanks HansN
>
>
> On 05/15/2017 03:56 PM, Rafael Odzakow wrote:
>> Internally opensafd creates a lock file during start/stop to avoid
>> parallel execution. To allow others to query the state this ticket will
>> use the opensafd lockfile to report the status of start/stop when
>> requested with "opensafd status"
>> ---
>>   src/nid/opensafd.in | 19 ++-
>>   1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
>> index e7683bd7e..54841c372 100644
>> --- a/src/nid/opensafd.in
>> +++ b/src/nid/opensafd.in
>> @@ -12,6 +12,17 @@
>>   # Description: Start and stop the OpenSAF node
>>   ### END INIT INFO
>>   +# Exit codes:
>> +# 0: OK
>> +# 1: General error
>> +# 2: Argument error
>> +#
>> +# 'status' exit codes:
>> +# 0: OK
>> +# 1: AMF state error
>> +# 3: No AMF PID found
>> +# 4: Lockfile is taken, opensafd start/stop is in progress
>> +
>>   osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
>>   osafprog="opensafd"
>>   osafprog_inprogress="opensafd_inprogress"
>> @@ -326,9 +337,15 @@ forcereload() {
>>   }
>> status() {
>> +
>>   amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
>> -if [ -n "$amfpid" ]; then
>> +
>> +if [ -e "$lockfile_inprogress" ]; then
>> +echo "Lockfile taken, OpenSAF start/stop is in 
>> progress"
>> +RETVAL=4
>> +elif [ -n "$amfpid" ]; then
>>   amf-state siass ha
>> +# Two possible error codes: 0 or 1
>>   RETVAL=$?
>>   else
>>   echo "The OpenSAF HA Framework is not running"
>



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-17 Thread Hans Nordebäck
Hi Rafael,

not sure if checking status of OpenSAF before ordering a reboot will 
have any effect as the result

of the call will only be momentarily accurate. Is the problem this 
ticket address when SMF is ordering a

reboot of a not fully started OpenSAF, and the "opensafd start/stop 
already in progress" message in the syslog?

If so, is this a problem, as a reboot has been ordered and will be 
performed but without running opensafd stop?

Perhaps we can change severity of the opensafd log messages instead?

/Thanks HansN


On 05/15/2017 03:56 PM, Rafael Odzakow wrote:
> Internally opensafd creates a lock file during start/stop to avoid
> parallel execution. To allow others to query the state this ticket will
> use the opensafd lockfile to report the status of start/stop when
> requested with "opensafd status"
> ---
>   src/nid/opensafd.in | 19 ++-
>   1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
> index e7683bd7e..54841c372 100644
> --- a/src/nid/opensafd.in
> +++ b/src/nid/opensafd.in
> @@ -12,6 +12,17 @@
>   # Description: Start and stop the OpenSAF node
>   ### END INIT INFO
>   
> +# Exit codes:
> +# 0: OK
> +# 1: General error
> +# 2: Argument error
> +#
> +# 'status' exit codes:
> +# 0: OK
> +# 1: AMF state error
> +# 3: No AMF PID found
> +# 4: Lockfile is taken, opensafd start/stop is in progress
> +
>   osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
>   osafprog="opensafd"
>   osafprog_inprogress="opensafd_inprogress"
> @@ -326,9 +337,15 @@ forcereload() {
>   }
>   
>   status() {
> +
>   amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
> - if [ -n "$amfpid" ]; then
> +
> + if [ -e "$lockfile_inprogress" ]; then
> +echo "Lockfile taken, OpenSAF start/stop is in progress"
> +RETVAL=4
> +elif [ -n "$amfpid" ]; then
>   amf-state siass ha
> +# Two possible error codes: 0 or 1
>   RETVAL=$?
>   else
>   echo "The OpenSAF HA Framework is not running"


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-15 Thread Rafael Odzakow
Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
 src/nid/opensafd.in | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..54841c372 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -12,6 +12,17 @@
 # Description: Start and stop the OpenSAF node
 ### END INIT INFO
 
+# Exit codes:
+# 0: OK
+# 1: General error
+# 2: Argument error
+#
+# 'status' exit codes:
+# 0: OK
+# 1: AMF state error
+# 3: No AMF PID found
+# 4: Lockfile is taken, opensafd start/stop is in progress
+
 osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
 osafprog="opensafd"
 osafprog_inprogress="opensafd_inprogress"
@@ -326,9 +337,15 @@ forcereload() {
 }
 
 status() {
+
amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-   if [ -n "$amfpid" ]; then
+
+   if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in progress"
+RETVAL=4
+elif [ -n "$amfpid" ]; then
amf-state siass ha
+# Two possible error codes: 0 or 1
RETVAL=$?
else
echo "The OpenSAF HA Framework is not running"
-- 
2.11.0


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel