Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions drivers/blktap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,12 @@ class SymLink(Link):
def readlink(self):
return os.readlink(self.path())

def realpath(self):
return os.path.realpath(self.path())

def is_block(self):
return S_ISBLK(os.stat(self.realpath()).st_mode)

def symlink(self):
return self.path

Expand Down Expand Up @@ -1487,6 +1493,13 @@ def attach(self, sr_uuid, vdi_uuid, writable, activate = False):
{"rdonly": not writable})
self.BackendLink.from_uuid(sr_uuid, vdi_uuid).mklink(dev_path)

# Decide whether to use tapdisk3 or blkback
if (self.target.get_vdi_type() == "aio") and \
(self.target.vdi.sr.handles("lvm")):
self.xenstore_data['backend-kind'] = 'vbd'
else:
self.xenstore_data['backend-kind'] = 'vbd3'

# Return backend/ link
back_path = self.BackendLink.from_uuid(sr_uuid, vdi_uuid).path()
struct = { 'params': back_path,
Expand Down Expand Up @@ -1571,8 +1584,14 @@ def _activate_locked(self, sr_uuid, vdi_uuid, options):
break
raise

# Link backend directly to RAW LV VDIs
phy_dev = self.PhyLink.from_uuid(sr_uuid, vdi_uuid)
if phy_dev.is_block() and self.target.get_vdi_type() == "aio":
dev_path = phy_dev.realpath()

# Link result to backend/
self.BackendLink.from_uuid(sr_uuid, vdi_uuid).mklink(dev_path)

return True

def _activate(self, sr_uuid, vdi_uuid, options):
Expand Down