Skip to content

Commit

Permalink
fix(LargeBlock): some style changes
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Thenot <[email protected]>
  • Loading branch information
Nambrok committed Mar 19, 2024
1 parent 610ea13 commit 1fa7fee
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions drivers/LargeBlockSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def handles(srtype):
return srtype == LargeBlockSR.DRIVER_TYPE

def load(self, sr_uuid):
super(LargeBlockSR, self).load(sr_uuid=sr_uuid)
super(LargeBlockSR, self).load(sr_uuid)
self.is_deleting = False
self.vgname = LARGEBLOCK_PREFIX + sr_uuid
self.remotepath = os.path.join("/dev", self.vgname, sr_uuid)
Expand Down Expand Up @@ -90,7 +90,7 @@ def delete(self, sr_uuid):
self.is_deleting = True
try:
self._create_emulated_device()
super(LargeBlockSR, self).delete(sr_uuid=sr_uuid)
super(LargeBlockSR, self).delete(sr_uuid)
except SR.SROSError as e:
util.SMlog(e)
finally:
Expand Down Expand Up @@ -152,10 +152,7 @@ def _is_vg_connection_correct(self):
output = util.pread2(["vgs", "--noheadings", "-o", "vg_name,devices", self.vgname]).split()
if self.vgname == output[0]:
output[1] = output[1].split("(")[0]
if re.match(r"(.*\.512)|(/dev/loop[0-9]+)", output[1]):
return True
else:
return False
return bool(re.match(r"(.*\.512)|(/dev/loop[0-9]+)", output[1]))

def _redo_vg_connection(self):
"""
Expand All @@ -168,10 +165,8 @@ def _redo_vg_connection(self):

util.SMlog("Reconnecting VG {} to use emulated device".format(self.vgname))
try:
cmd = ["vgchange", "-an", self.vgname]
util.pread2(cmd)
cmd = ["vgchange", "-ay", self.vgname, "--config", "devices{ global_filter = [ \"r|^/dev/nvme.*|\", \"a|/dev/loop.*|\" ] }"]
util.pread2(cmd)
util.pread2(["vgchange", "-an", self.vgname])
util.pread2(["vgchange", "-ay", self.vgname, "--config", "devices{ global_filter = [ \"r|^/dev/nvme.*|\", \"a|/dev/loop.*|\" ] }"])
except util.CommandException as e:
util.SMlog("Failed to reconnect the VolumeGroup {}, error: {}".format(self.vgname, e))

Expand Down

0 comments on commit 1fa7fee

Please sign in to comment.