Skip to content

Commit

Permalink
Merge pull request #621 from cvaroqui/20230626-scsipr-ack-fix
Browse files Browse the repository at this point in the history
20230626 scsipr ack fix
  • Loading branch information
cvaroqui committed Jun 27, 2023
2 parents 35969d0 + f0d8205 commit e4c3169
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -15,8 +15,6 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: 2.7
PYTEST_EXTRA_ARGS: ""
- python-version: 3.7
PYTEST_EXTRA_ARGS: "--cov"

Expand Down Expand Up @@ -55,8 +53,6 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: 2.7
PYTEST_EXTRA_ARGS: ""
- python-version: 3.7
PYTEST_EXTRA_ARGS: "--cov"

Expand Down
8 changes: 5 additions & 3 deletions opensvc/drivers/resource/disk/scsireserv/__init__.py
Expand Up @@ -233,12 +233,14 @@ def clear(self):
r = 0
for d in self.devs:
try:
if not self.disk_reserved(d):
continue
r += getattr(self, "disk_clear_reservation")(d)
if self.disk_reserved(d):
r += getattr(self, "disk_clear_reservation")(d)
elif self.disk_registered(d):
r += self.disk_unregister(d)
except ex.ScsiPrNotsupported as exc:
self.log.warning(str(exc))
continue

return r


Expand Down
17 changes: 15 additions & 2 deletions opensvc/drivers/resource/disk/scsireserv/sg.py
Expand Up @@ -124,6 +124,7 @@ def read_registrations(self):
n_registered += out.count(self.hostid)
else:
for path in paths:
self.ack_unit_attention(path)
ret, out, err = self.read_path_registrations(path)
if ret != 0:
continue
Expand Down Expand Up @@ -193,7 +194,10 @@ def disk_unregister(self, disk):
if self.use_mpathpersist(disk):
return self.mpath_unregister(disk)
else:
return self.path_unregister(disk)
ret = 0
for path in self.devs[disk]:
ret += self.path_unregister(path)
return ret

def mpath_unregister(self, disk):
self.set_read_only(0)
Expand Down Expand Up @@ -301,7 +305,16 @@ def disk_clear_reservation(self, disk):
if self.use_mpathpersist(disk):
return self.mpath_clear_reservation(disk)
else:
return self.path_clear_reservation(disk)
ret = self.path_clear_reservation(disk)
if ret == 24:
self.log.warning("clear %s failed, will try clear on sub devs" % disk)
for path in self.devs[disk]:
sub_ret = self.path_clear_reservation(path)
if sub_ret != 0:
self.log.warning("clear %s sub device %s failed" % (disk, path))
continue
return sub_ret
return ret

def mpath_clear_reservation(self, disk):
cmd = ["mpathpersist", "--out", "--clear", "--param-rk=" + self.hostid, disk]
Expand Down

0 comments on commit e4c3169

Please sign in to comment.