Skip to content

Commit

Permalink
CA-335092: after an update we use the new SM but the NBD link won't b…
Browse files Browse the repository at this point in the history
…e there

Signed-off-by: Mark Syms <mark.syms@citrix.com>
  • Loading branch information
MarkSymsCtx committed Mar 13, 2020
1 parent e58e4ad commit 94101a9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/blktap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,11 +1767,6 @@ def _deactivate(self, sr_uuid, vdi_uuid, caching_params):
util.SMlog("Backend path %s does not exist" % back_link.path())
return

nbd_link = VDI.NBDLink.from_uuid(sr_uuid, vdi_uuid)
if (not util.pathexists(nbd_link.path())) and self.tap_wanted():
util.SMlog("Backend path %s does not exist" % nbd_link.path())
return

try:
attach_info_path = "%s.attach_info" % (back_link.path())
os.unlink(attach_info_path)
Expand All @@ -1789,8 +1784,10 @@ def _deactivate(self, sr_uuid, vdi_uuid, caching_params):

# Remove the backend link
back_link.unlink()
util.SMlog("UNLINKING NBD")
nbd_link.rmdirs()
nbd_link = VDI.NBDLink.from_uuid(sr_uuid, vdi_uuid)
if os.path.lexists(nbd_link.path()):
util.SMlog("UNLINKING NBD")
nbd_link.rmdirs()

# Deactivate & detach the physical node
if self.tap_wanted() and self.target.vdi.session is not None:
Expand Down

0 comments on commit 94101a9

Please sign in to comment.