Skip to content

Commit

Permalink
Add a pausable property to the sync drivers
Browse files Browse the repository at this point in the history
Drivers handling hardware-assisted disks replication are set non-pausable,
other drivers default to pausable.

If pausable and the aggregated service status is not up, the resource status
is n/a.

If not pausable, always evaluate the real resource status.

This patch fixes the undue failback for a service with rollback=false an
instance of which failed to start in the resource just next after a
srdf resource. In this situation, the instance availstatus is still down
because the srdf resource status is n/a due to the paused mecanism, instead
of up.
  • Loading branch information
cvaroqui committed Oct 24, 2018
1 parent c6c2de2 commit 97c297d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lib/resSync.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self,
sync_max_delay=None,
schedule=None,
**kwargs):
self.pausable = True
if sync_max_delay is None:
self.sync_max_delay = 1500
else:
Expand Down Expand Up @@ -170,6 +171,19 @@ def sync_status(self, *args, **kwargs):
return rcStatus.UNDEF

def _status(self, **kwargs):
if self.paused():
return rcStatus.NA
return self.sync_status(**kwargs)

def paused(self):
"""
Return True if the aggregated service status is not up, in which
case we don't care about computing a status for the sync resource.
Drivers with pausable=False are never paused.
"""
if self.pausable:
return False
try:
data = self.svc.node._daemon_status()
except Exception:
Expand All @@ -178,13 +192,13 @@ def _status(self, **kwargs):
svcnames = data["monitor"]["services"]
except (KeyError, TypeError):
# the daemon is not returning proper status data
svcnames = []
svcnames = {}
if self.svc.svcname in svcnames:
avail = data["monitor"]["services"][self.svc.svcname]["avail"]
avail = svcnames[self.svc.svcname]["avail"]
if avail != "up":
self.status_log("paused, service not up", "info")
return rcStatus.NA
return self.sync_status(**kwargs)
return True
return False

@lazy
def last_stats_file(self):
Expand Down
1 change: 1 addition & 0 deletions lib/resSyncHp3par.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self,
rid=rid,
type="sync.hp3par",
**kwargs)
self.pausable = False
self.array = array
self.rcg_names = rcg_names
self.rcg = rcg_names[array]
Expand Down
1 change: 1 addition & 0 deletions lib/resSyncNetapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def __init__(self,
rid=rid,
type="sync.netapp",
**kwargs)
self.pausable = False
self.label = "netapp %s on %s"%(path, ', '.join(filers.values()))
self.filers = filers
self.path = path
Expand Down
1 change: 1 addition & 0 deletions lib/resSyncNexenta.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def __init__(self,
rid=rid,
type="sync.nexenta",
**kwargs)
self.pausable = False
self.label = "nexenta autosync %s"%name
self.autosync = name
self.filers = filers
Expand Down
1 change: 1 addition & 0 deletions lib/resSyncSymSrdfS.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ def __init__(self,
type="sync.symsrdfs",
**kwargs)

self.pausable = False
self.label = "srdf/s symdg %s"%(symdg)
self.symid = symid

Expand Down

0 comments on commit 97c297d

Please sign in to comment.