File rtslib-mount-configfs-fix.patch of Package python-rtslib.1545
Index: rtslib-2.2/rtslib/root.py
===================================================================
--- rtslib-2.2.orig/rtslib/root.py
+++ rtslib-2.2/rtslib/root.py
@@ -25,7 +25,7 @@ from node import CFSNode
from target import Target, FabricModule
from tcm import FileIOBackstore, IBlockBackstore
from tcm import PSCSIBackstore, RDMCPBackstore
-from utils import RTSLibError, RTSLibBrokenLink, modprobe
+from utils import RTSLibError, RTSLibBrokenLink, modprobe, mount_configfs
class RTSRoot(CFSNode):
'''
@@ -64,6 +64,7 @@ class RTSRoot(CFSNode):
'''
super(RTSRoot, self).__init__()
modprobe(self.target_core_mod)
+ mount_configfs()
self._create_in_cfs_ine('any')
def _list_targets(self):
Index: rtslib-2.2/rtslib/utils.py
===================================================================
--- rtslib-2.2.orig/rtslib/utils.py
+++ rtslib-2.2/rtslib/utils.py
@@ -741,6 +741,16 @@ def get_main_ip():
return ip_addr
return None
+def mount_configfs():
+ if not os.path.ismount("/sys/kernel/config"):
+ cmdline = "mount -t configfs none /sys/kernel/config"
+ process = subprocess.Popen(cmdline.split(),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ (stdoutdata, stderrdata) = process.communicate()
+ if process.returncode != 0:
+ raise RTSLibError(stderrdata)
+
def _test():
'''Run the doctests'''
import doctest