Skip to content

Commit

Permalink
CA-335721: Add missing case blktap2 for cached devices.
Browse files Browse the repository at this point in the history
Signed-off-by: ben sims <ben.sims@citrix.com>
  • Loading branch information
BenSimsCitrix committed Mar 4, 2020
1 parent 1c1d97c commit 1561a43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/blktap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ def attach(self, sr_uuid, vdi_uuid, writable, activate = False, caching_params =

# Return backend/ link
back_path = self.BackendLink.from_uuid(sr_uuid, vdi_uuid).path()
if self.tap:
if self.tap_wanted():
# Only have NBD if we also have a tap
nbd_path =\
"nbd:unix:" + VDI.NBDLink.from_uuid(sr_uuid, vdi_uuid).path()
Expand Down Expand Up @@ -1768,7 +1768,7 @@ def _deactivate(self, sr_uuid, vdi_uuid, caching_params):
return

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

Expand Down Expand Up @@ -2004,6 +2004,7 @@ def _setup_cache(self, session, sr_uuid, vdi_uuid, local_sr_uuid,
util.SMlog("Local read cache: %s, local leaf: %s" % \
(read_cache_path, local_leaf_path))

self.tap = leaf_tapdisk
return leaf_tapdisk.get_devpath()

def remove_cache(self, sr_uuid, vdi_uuid, params):
Expand Down

0 comments on commit 1561a43

Please sign in to comment.