Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions drivers/SR.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def from_uuid(session, sr_uuid):
def block_setscheduler(self, dev):
try:
realdev = os.path.realpath(dev)
disk = util.diskFromPartition(realdev)
disk = util.diskFromPartition(realdev[5:])

# the normal case: the sr default scheduler (typically noop),
# potentially overridden by SR.other_config:scheduler
Expand All @@ -218,7 +218,8 @@ def block_setscheduler(self, dev):
sched = self.sched

# special case: CFQ if the underlying disk holds dom0's file systems.
if disk in util.dom0_disks():
# NVMe doesn't support CFQ
if disk in util.dom0_disks() and not disk.startswith('nvme'):
sched = 'cfq'

util.SMlog("Block scheduler: %s (%s) wants %s" % (dev, disk, sched))
Expand Down
4 changes: 4 additions & 0 deletions drivers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,10 @@ def diskFromPartition(partition):
if True in [partition.startswith(x) for x in ['cciss', 'ida', 'rd']]:
numlen += 1 # need to get rid of trailing 'p'

# is it a NVMe ? nvme0n1p33
if partition.startswith('nvme'):
numlen += 1 # need to get rid of trailing 'p'

# is it a mapper path?
if partition.startswith("mapper"):
if re.search("p[0-9]*$",partition):
Expand Down