Skip to content

Commit

Permalink
CP-31856 - Return nbd socket as parameter to XAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSimsCitrix committed Jan 22, 2020
1 parent a84675b commit 4d7c838
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/blktap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ def _tap_activate(phy_path, vdi_type, sr_uuid, options, pool_size = None):
else:
util.SMlog("tap.activate: Found %s" % tapdisk)

return tapdisk.get_devpath()
return tapdisk

@staticmethod
def _tap_deactivate(minor):
Expand Down Expand Up @@ -1530,10 +1530,12 @@ 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()
back_nbd = 'nbd:unix:/run/blktap-control/nbd%d.%d' % (int(self.tap.pid), int(self.tap.minor))
options = {"rdonly": not writable}
options.update(caching_params)
o_direct, o_direct_reason = self.get_o_direct_capability(options)
struct = { 'params': back_path,
'params_nbd': back_nbd,
'o_direct': o_direct,
'o_direct_reason': o_direct_reason,
'xenstore_data': self.xenstore_data}
Expand Down Expand Up @@ -1659,20 +1661,20 @@ def _activate(self, sr_uuid, vdi_uuid, options):

dev_path = self.setup_cache(sr_uuid, vdi_uuid, options)
if not dev_path:
phy_path = self.PhyLink.from_uuid(sr_uuid, vdi_uuid).readlink()
self.phy_path = self.PhyLink.from_uuid(sr_uuid, vdi_uuid).readlink()
# Maybe launch a tapdisk on the physical link
if self.tap_wanted():
vdi_type = self.target.get_vdi_type()
options["o_direct"] = self.get_o_direct_capability(options)[0]
if vdi_options:
options.update(vdi_options)
dev_path = self._tap_activate(phy_path, vdi_type, sr_uuid,
self.tap = self._tap_activate(self.phy_path, vdi_type, sr_uuid,

options,
self._get_pool_config(sr_uuid).get("mem-pool-size"))
dev_path = self.tap.get_devpath()
else:
dev_path = phy_path # Just reuse phy

return dev_path
dev_path = None

def _attach(self, sr_uuid, vdi_uuid):
attach_info = xmlrpclib.loads(self.target.attach(sr_uuid, vdi_uuid))[0][0]
Expand Down

0 comments on commit 4d7c838

Please sign in to comment.