Skip to content

Commit

Permalink
Remove the MonitorAction exception
Browse files Browse the repository at this point in the history
Now that the daemon monitor is responsible of executing the monitor actions,
we can remove the MonitorAction exception, the resource_monitor raised to
trigger the toc action.

Also remove all catchers, and update the 'resource monitor' action
documentation to reflect its reduced role.
  • Loading branch information
cvaroqui committed Jul 21, 2017
1 parent b8a00b7 commit 1e526a4
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 28 deletions.
10 changes: 1 addition & 9 deletions lib/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def __str__(self):
return self.nodename

def __init__(self):
self.ex_monitor_action_exit_code = 251
self.config = None
self.auth_config = None
self.clusters = None
Expand Down Expand Up @@ -1794,9 +1793,6 @@ def service_action_worker(self, svc, action, options):
"""
try:
ret = svc.action(action, options)
except ex.MonitorAction:
self.close()
sys.exit(self.ex_monitor_action_exit_code)
finally:
self.close()
sys.exit(1)
Expand Down Expand Up @@ -2327,18 +2323,14 @@ def do_svcs_action(self, action, options):
if not need_aggregate:
print("%s: %s" % (svc.svcname, exc), file=sys.stderr)
continue
except ex.MonitorAction:
svc.action('toc')
except ex.excSignal:
break

if self.can_parallel(action, options):
for svcname in data.procs:
data.procs[svcname].join()
ret = data.procs[svcname].exitcode
if ret == self.ex_monitor_action_exit_code:
data.svcs[svcname].action('toc')
elif ret > 0:
if ret > 0:
# r is negative when data.procs[svcname] is killed by signal.
# in this case, we don't want to decrement the err counter.
err += ret
Expand Down
7 changes: 0 additions & 7 deletions lib/rcExceptions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
class MonitorAction(Exception):
"""
A class dedicated to propagate up the stack a need to run the
resource_monitor action.
"""
pass

class excEncapUnjoignable(Exception):
pass

Expand Down
6 changes: 0 additions & 6 deletions lib/svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,6 @@ def scheduler(self):
self.compliance_auto()
else:
self.action(action)
except ex.MonitorAction as exc:
self.svcunlock()
self.action("toc")
except ex.excError as exc:
self.log.error(exc)
except:
Expand Down Expand Up @@ -3730,9 +3727,6 @@ def call_action(action):
except ex.excSignal:
self.log.error("interrupted by signal")
err = 1
except ex.MonitorAction:
self.svcunlock()
raise
except:
err = 1
self.save_exc()
Expand Down
4 changes: 2 additions & 2 deletions lib/svcmgr_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@
],
},
'resource_monitor': {
'msg': 'detect monitored resource failures and trigger '
'monitor_action',
'msg': 'refresh only monitored resource status. This action is '
'scheduleable, usually every minute.',
'options': ACTION_OPTS,
},
'stonith': {
Expand Down
2 changes: 1 addition & 1 deletion usr/share/man/man1/nodemgr.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH NODEMGR 1 2017\-07\-19
.TH NODEMGR 1 2017\-07\-21
.SH NAME
nodemgr - OpenSVC agent's node management command.
.SH SYNOPSIS
Expand Down
31 changes: 29 additions & 2 deletions usr/share/man/man1/svcmgr.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH SVCMGR 1 2017\-07\-19
.TH SVCMGR 1 2017\-07\-21
.SH NAME
svcmgr - OpenSVC agent's services instances management command.
.SH SYNOPSIS
Expand Down Expand Up @@ -1609,6 +1609,9 @@ clear the monitor status of the service on the node pointed by --node. If --node
.B --node=NODE
the node to send a request to. if not specified the local node is targeted.
.TP
.B --local
execute the service action via the daemon, on the local service instances only, ignoring cluster-wide considerations.
.TP
.B -s PARM_SVCS, --service=PARM_SVCS
comma-separated list of service to operate on
.TP
Expand Down Expand Up @@ -1982,6 +1985,12 @@ comma-separated list of resource tags to limit action to. The + separator can be
.B --disable-rollback
Exit without resource activation rollback on start action error
.TP
.B --time=TIME
A duration expression like '1m5s'. The maximum wait time for an async action to finish. Default is 300 seconds.
.TP
.B --wait
Wait for asynchronous action termination
.TP
.B -s PARM_SVCS, --service=PARM_SVCS
comma-separated list of service to operate on
.TP
Expand Down Expand Up @@ -2147,6 +2156,12 @@ comma-separated list of resource tags to limit action to. The + separator can be
.B --disable-rollback
Exit without resource activation rollback on start action error
.TP
.B --time=TIME
A duration expression like '1m5s'. The maximum wait time for an async action to finish. Default is 300 seconds.
.TP
.B --wait
Wait for asynchronous action termination
.TP
.B --to=PARM_DESTINATION_NODE
remote node to start or migrate the service to
.TP
Expand Down Expand Up @@ -3247,7 +3262,7 @@ show this help message and exit
\fBsvcmgr resource monitor\fP
.RS

detect monitored resource failures and trigger monitor_action
refresh only monitored resource status. This action is scheduleable, usually every minute.

.TP
.B --dry-run
Expand Down Expand Up @@ -4878,6 +4893,12 @@ comma-separated list of resource tags to limit action to. The + separator can be
.B --disable-rollback
Exit without resource activation rollback on start action error
.TP
.B --time=TIME
A duration expression like '1m5s'. The maximum wait time for an async action to finish. Default is 300 seconds.
.TP
.B --wait
Wait for asynchronous action termination
.TP
.B --to=PARM_DESTINATION_NODE
remote node to start or migrate the service to
.TP
Expand Down Expand Up @@ -5934,6 +5955,12 @@ comma-separated list of resource tags to limit action to. The + separator can be
.B --disable-rollback
Exit without resource activation rollback on start action error
.TP
.B --time=TIME
A duration expression like '1m5s'. The maximum wait time for an async action to finish. Default is 300 seconds.
.TP
.B --wait
Wait for asynchronous action termination
.TP
.B -s PARM_SVCS, --service=PARM_SVCS
comma-separated list of service to operate on
.TP
Expand Down
2 changes: 1 addition & 1 deletion usr/share/man/man1/svcmon.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH SVCMON 1 2017\-07\-19
.TH SVCMON 1 2017\-07\-21
.SH NAME
svcmon - OpenSVC agent's services instances status requesting command.
.SH SYNOPSIS
Expand Down

0 comments on commit 1e526a4

Please sign in to comment.