Skip to content
Snippets Groups Projects
Commit 489587e3 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

nvmet: load the nvmet module if not already loaded


Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 927e666c
No related branches found
No related tags found
No related merge requests found
......@@ -196,9 +196,28 @@ class CFSNode(object):
class Root(CFSNode):
def __init__(self):
super(Root, self).__init__()
if not os.path.isdir(self.configfs_dir):
self._modprobe('nvmet')
if not os.path.isdir(self.configfs_dir):
raise CFSError("%s does not exist. Giving up." %
self.configfs_dir)
self._path = self.configfs_dir
self._create_in_cfs('lookup')
def _modprobe(self, modname):
try:
from kmodpy import kmod
try:
kmod.Kmod().modprobe(modname, quiet=True)
except kmod.KmodError:
pass
except ImportError:
pass
def _list_subsystems(self):
self._check_self()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment