Skip to content

Commit

Permalink
[scsi reservation] Reduce ack unit attention maximum duration on a de…
Browse files Browse the repository at this point in the history
…vice (from 10s to 1s)

This patch reduces delay from 1s to 0.1s before next ack unit attention on a device
that reports unit attention.

The new maximum duration for a device is now 1s (10 retries with 0.1s delay)
  • Loading branch information
cgalibern committed Jun 24, 2022
1 parent f94cec0 commit 678a3bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion opensvc/drivers/resource/disk/scsireserv/__init__.py
Expand Up @@ -19,7 +19,6 @@ def __init__(self,
**kwargs):
self.no_preempt_abort = no_preempt_abort
self.devs = {}
self.preempt_timeout = 10
self.prtype = '5'
self.hostid = None
self.peer_resource = peer_resource
Expand Down
10 changes: 8 additions & 2 deletions opensvc/drivers/resource/disk/scsireserv/sg.py
Expand Up @@ -7,6 +7,12 @@
from utilities.proc import justcall, which
from . import BaseDiskScsireserv

# maximum number of unit attention to read from a device during ack_unit_attention()
ACK_UNIT_ATTENTION_RETRY_MAX = 10

# delay to wait before retry ack unit attention on a device that reports unit attention
ACK_UNIT_ATTENTION_RETRY_DELAY = 0.1


# noinspection PyUnusedLocal
def driver_capabilities(node=None):
Expand Down Expand Up @@ -63,7 +69,7 @@ def ack_unit_attention(self, d):
return 0
if self.use_mpathpersist(d):
return 0
i = self.preempt_timeout
i = ACK_UNIT_ATTENTION_RETRY_MAX
self.set_read_only(0)
while i > 0:
i -= 1
Expand All @@ -78,7 +84,7 @@ def ack_unit_attention(self, d):
return 0
if "Unit Attention" in out or ret != 0:
self.log.debug("disk %s reports 'Unit Attention' ... waiting" % d)
time.sleep(1)
time.sleep(ACK_UNIT_ATTENTION_RETRY_DELAY)
continue
break
if i == 0:
Expand Down

0 comments on commit 678a3bd

Please sign in to comment.