Skip to contentSkip to conversation

lio rbd support

PATCH New Mike Christie 1 participant 1 message Jul 29, 2015

lore
Share & tools
lore
#0 lore raw

cover lio rbd support

The following patches implement a LIO RBD backend. Instead of having LIO send bios/requests through the block layer and having rbd translate them to ceph/rados requests, this implements a LIO RBD backend module that translates LIO se_cmds directly to ceph/rados requests.

This patchset also implements native ceph/rados support for WRITE_SAME and COMPARE_AND_WRITE commands. We execute them on the OSD similar to how we execute UNMAP/TRIM/DISCARD requests.

This patchset just only implements single node support. The cluster support will be posted soon. I am currently redoing my patches against Doug's locking API and redoing my PR hooks.

The patches were made over linus's tree pulled today
(last commit 956325bd55bb020e574129c443a2c2c66a8316e7), plus Nick's target-pending tree (last commit 7a14e3c1cfcbdf377098542ba440e1ebb0eeafa4), and Doug's wip-djf-watch-notify2 branch in the ceph client tree which can be found here https://github.com/ceph/ceph-client.

Attached at the patches for rtslib and targetlci to be able to use the rbd module. It was made over Andy's fb branch.

targetcli/ui_backstore.py +51 -0
diff -aurp targetcli-fb-2.1.fb41/targetcli/ui_backstore.py targetcli-fb-2.1.fb41.work/targetcli/ui_backstore.py
@@ -109,6 +109,7 @@ class UIBackstores(UINode):
         UIRDMCPBackstore(self)
         UIFileIOBackstore(self)
         UIBlockBackstore(self)
+        UIRBDBackstore(self)
         UIUserBackedBackstore(self)
 
 
@@ -402,6 +403,41 @@ class UIBlockBackstore(UIBackstore):
             completions = [completions[0] + ' ']
         return completions
 
+class UIRBDBackstore(UIBackstore):
+    '''
+    RBD backstore UI.
+    '''
+    def __init__(self, parent):
+        self.so_cls = UIRBDStorageObject
+        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)
+
+        so = RBDStorageObject(name, dev, readonly=readonly)
+        ui_so = UIRBDStorageObject(so, self)
+        self.setup_model_alias(so)
+        self.shell.log.info("Created RBD storage object %s using %s."
+                            % (name, dev))
+        return self.new_node(ui_so)
+
+    def ui_complete_create(self, parameters, text, current_param):
+        '''
+        Auto-completes the device name
+        '''
+        if current_param != 'dev':
+            return []
+        completions = complete_path(text, stat.S_ISBLK)
+        if len(completions) == 1 and not completions[0].endswith('/'):
+            completions = [completions[0] + ' ']
+        return completions
+
 
 class UIUserBackedBackstore(UIBackstore):
     '''
@@ -543,6 +579,21 @@ class UIBlockStorageObject(UIStorageObje
         return ("%s (%s) %s%s %s" % (so.udev_path, bytes_to_human(so.size),
                                    ro_str, wb_str, so.status), True)
 
+class UIRBDStorageObject(UIStorageObject):
+    def summary(self):
+        so = self.rtsnode
+
+        if so.write_back:
+            wb_str = "write-back"
+        else:
+            wb_str = "write-thru"
+
+        ro_str = ""
+        if so.readonly:
+            ro_str = "ro "
+
+        return ("%s (%s) %s%s %s" % (so.udev_path, bytes_to_human(so.size),
+                                   ro_str, wb_str, so.status), True)
 
 class UIUserBackedStorageObject(UIStorageObject):
     def summary(self):
rtslib/tcm.py +103 -0

121 lines not on this page · raw message