Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.4:ARM
targetcli-fb
rbd-support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File rbd-support.patch of Package targetcli-fb
From dc250fa879939702bdf69e561cb9041a57f997ea Mon Sep 17 00:00:00 2001 From: Mike Christie <mchristi@redhat.com> Date: Tue, 10 Apr 2018 17:31:32 +0200 Subject: [PATCH 4/4] rbd support targetcli-fb-rbd.patch obtained from: https://marc.info/?l=ceph-devel&m=143816209010058 [ddiss@suse.de: accept and propagate wwn parameter] Reviewed-by: David Disseldorp <ddiss@suse.de> --- targetcli/ui_backstore.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) --- a/targetcli/ui_backstore.py +++ b/targetcli/ui_backstore.py @@ -29,6 +29,7 @@ import stat from configshell_fb import ExecutionError from rtslib_fb import BlockStorageObject, FileIOStorageObject from rtslib_fb import PSCSIStorageObject, RDMCPStorageObject, UserBackedStorageObject +from rtslib_fb import RBDStorageObject from rtslib_fb import ALUATargetPortGroup from rtslib_fb import RTSLibError from rtslib_fb import RTSRoot @@ -281,6 +282,7 @@ class UIBackstores(UINode): UIRDMCPBackstore(self) UIFileIOBackstore(self) UIBlockBackstore(self) + UIRBDBackstore(self) for name, iface, prop_dict in self._user_backstores(): UIUserBackedBackstore(self, name, iface, prop_dict) @@ -589,6 +591,48 @@ 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, wwn=None): + ''' + Creates an RBD Storage object. I{dev} is the path to the RBD + block device to use. + ''' + self.assert_root() + + ro_string = self.ui_eval_param(readonly, 'string', None) + if ro_string == None: + # attempt to detect block device readonly state via ioctl + readonly = blk_dev_ro_check(dev) + else: + readonly = self.ui_eval_param(readonly, 'bool', False) + + wwn = self.ui_eval_param(wwn, 'string', None) + + so = RBDStorageObject(name, dev, readonly=readonly, wwn=wwn) + 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): ''' @@ -791,6 +835,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):
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor