File targetcli-fb-rbd.patch of Package targetcli
Patche backported to SLE12 targetcli, obtained from:
http://permalink.gmane.org/gmane.comp.file-systems.ceph.devel/26263
Index: targetcli-2.1/targetcli/ui_backstore.py
===================================================================
--- targetcli-2.1.orig/targetcli/ui_backstore.py
+++ targetcli-2.1/targetcli/ui_backstore.py
@@ -21,8 +21,10 @@ from ui_node import UINode, UIRTSLibNode
from rtslib import RTSRoot
from rtslib import FileIOBackstore, IBlockBackstore
from rtslib import PSCSIBackstore, RDMCPBackstore
+from rtslib import RBDBackstore
from rtslib import FileIOStorageObject, IBlockStorageObject
from rtslib import PSCSIStorageObject, RDMCPStorageObject
+from rtslib import RBDStorageObject
from rtslib.utils import get_block_type, is_disk_partition
from rtslib.utils import convert_human_to_bytes, convert_bytes_to_human
from configshell import ExecutionError
@@ -56,6 +58,7 @@ class UIBackstores(UINode):
UIRDMCPBackstore(self)
UIFileIOBackstore(self)
UIIBlockBackstore(self)
+ UIRBDBackstore(self)
class UIBackstore(UINode):
'''
@@ -397,6 +400,34 @@ class UIIBlockBackstore(UIBackstore):
% (name, dev))
return self.new_node(ui_so)
+class UIRBDBackstore(UIBackstore):
+ '''
+ RBD backstore UI.
+ '''
+ def __init__(self, parent):
+ UIBackstore.__init__(self, 'rbd', parent)
+
+ def ui_command_create(self, name, dev, readonly=None):
+ '''
+ Creates an RBD Storage object. I{dev} is the path to the RBD
+ block device to use.
+ '''
+ self.assert_root()
+
+ readonly = self.ui_eval_param(readonly, 'bool', False)
+
+ backstore = RBDBackstore(self.next_hba_index(), mode='any')
+ try:
+ so = RBDStorageObject(backstore, name, dev, readonly=readonly)
+ except Exception, exception:
+ backstore.delete()
+ raise exception
+
+ ui_so = UIStorageObject(so, self)
+ self.shell.log.info("Created RBD storage object %s using %s."
+ % (name, dev))
+ return self.new_node(ui_so)
+
class UIStorageObject(UIRTSLibNode):
'''