diff --git a/_service b/_service index 4e6c151..42f10ad 100644 --- a/_service +++ b/_service @@ -3,8 +3,10 @@ git https://github.com/open-iscsi/rtslib-fb.git - rtslib-fb - 2.1.fb67 + python-rtslib-fb + @PARENT_TAG@ + v(\d*\.\d*\.)fb(\d*) + \1\2 v2.1.fb67 enable diff --git a/python-rtslib-fb-2.1.67.tar.xz b/python-rtslib-fb-2.1.67.tar.xz new file mode 100644 index 0000000..6ed640d --- /dev/null +++ b/python-rtslib-fb-2.1.67.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c91cf4dbabde6e97c22232ddf2451565a0fef1f077d98971bfe89b030dcb5c0 +size 39960 diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index fd6d194..17bab91 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Tue Apr 10 16:03:33 UTC 2018 - ddiss@suse.com + +- Merge RBD support from non-fb version (bsc#1079329) + + rbd-support.patch (SLE/Leap only, due to LIO kernel dependency) + + Add explicit Provides for "python-rtslib-rbd" + +------------------------------------------------------------------- +Tue Apr 10 12:41:16 UTC 2018 - ddiss@suse.com + +- Automatically generate version string from upstream tag + + Retain current fb-removed version format used + + Rename rtslib-fb-2.1.fb67.tar.xz to python-rtslib-fb-2.1.67.tar.xz and + cleanup hardcoded duplicate name/version values in spec + ------------------------------------------------------------------- Mon Apr 09 21:41:01 UTC 2018 - lduncan@suse.com diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index b996564..74b47fd 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -16,18 +16,17 @@ # -%define oname rtslib-fb -%define realver 2.1.fb67 %define dbdir %{_sysconfdir}/target %{?!python_module:%define python_module() python-%{**} python3-%{**}} -Name: python-%{oname} +Name: python-rtslib-fb Version: 2.1.67 Release: 0%{?dist} Summary: API for Linux kernel SCSI target (aka LIO) License: Apache-2.0 Group: Development/Languages/Python Url: http://github.com/open-iscsi/rtslib-fb.git -Source: %{oname}-%{realver}.tar.xz +Source: %{name}-%{version}.tar.xz +Patch1: rbd-support.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pyudev} BuildRequires: %{python_module setuptools} @@ -39,6 +38,11 @@ Requires(post): update-alternatives Requires(postun): update-alternatives Provides: python-rtslib = %{version}-%{release} Obsoletes: python-rtslib +%if 0%{?sle_version} == 150000 +# explicit Provides advertising RBD support +Provides: python-rtslib-rbd = %{version} +Obsoletes: python-rtslib-rbd < %{version} +%endif BuildArch: noarch %python_subpackages @@ -48,7 +52,11 @@ SCSI target, present in 3.x Linux kernel versions. rtslib-fb is licensed under the Apache 2.0 license. Contributions are welcome %prep -%setup -q -n %{oname}-%{realver} +%setup -q +%if 0%{?sle_version} == 150000 +# RBD support is dependent on LIO changes present in the SLE/Leap kernel +%patch1 -p1 +%endif %build %python_build diff --git a/rbd-support.patch b/rbd-support.patch new file mode 100644 index 0000000..ae2c2e4 --- /dev/null +++ b/rbd-support.patch @@ -0,0 +1,157 @@ +From 9496352d515b9f440b68c8534e41899cf1a9570e Mon Sep 17 00:00:00 2001 +From: Mike Christie +Date: Wed, 29 Jul 2015 04:28:02 -0500 +Subject: [PATCH] rbd support + +rtslib-fb-rbd-support.patch obtained from: +https://marc.info/?l=ceph-devel&m=143816209010058 + +Reviewed-by: David Disseldorp +--- + rtslib/__init__.py | 1 + + rtslib/tcm.py | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 104 insertions(+) + +diff --git a/rtslib/__init__.py b/rtslib/__init__.py +index 568619e..1a5bee5 100644 +--- a/rtslib/__init__.py ++++ b/rtslib/__init__.py +@@ -32,6 +32,7 @@ from .fabric import FabricModule + + from .tcm import FileIOStorageObject, BlockStorageObject + from .tcm import PSCSIStorageObject, RDMCPStorageObject, UserBackedStorageObject ++from .tcm import RBDStorageObject + from .tcm import StorageObjectFactory + + from .alua import ALUATargetPortGroup +diff --git a/rtslib/tcm.py b/rtslib/tcm.py +index 1aeea23..17df8e9 100644 +--- a/rtslib/tcm.py ++++ b/rtslib/tcm.py +@@ -780,6 +780,107 @@ class BlockStorageObject(StorageObject): + d['dev'] = self.udev_path + return d + ++class RBDStorageObject(StorageObject): ++ ''' ++ An interface to configFS storage objects for RBD backstore. ++ ''' ++ ++ # RBDStorageObject private stuff ++ ++ def __init__(self, name, dev=None, wwn=None, readonly=False, ++ write_back=False): ++ ''' ++ A RBDIOStorageObject can be instantiated in two ways: ++ - B{Creation mode}: If I{dev} is specified, the underlying configFS ++ object will be created with that parameter. ++ No RBDIOStorageObject with the same I{name} can pre-exist in ++ the parent Backstore in that mode. ++ - B{Lookup mode}: If I{dev} is not set, then the ++ RBDIOStorageObject will be bound to the existing configFS ++ object in the parent Backstore having the specified ++ I{name}. The underlying configFS object must already exist in ++ that mode, or instantiation will fail. ++ ++ @param name: The name of the RBDIOStorageObject. ++ @type name: string ++ @param dev: The path to the backend rbd device to be used. ++ - Example: I{dev="/dev/sda"}. ++ - The only device type that is accepted I{TYPE_DISK}. ++ For other device types, use pscsi. ++ @type dev: string ++ @param wwn: T10 WWN Unit Serial, will generate if None ++ @type wwn: string ++ @return: A RBDIOStorageObject object. ++ ''' ++ ++ if dev is not None: ++ super(RBDStorageObject, self).__init__(name, 'create') ++ try: ++ self._configure(dev, wwn, readonly) ++ except: ++ self.delete() ++ raise ++ else: ++ super(RBDStorageObject, self).__init__(name, 'lookup') ++ ++ def _configure(self, dev, wwn, readonly): ++ self._check_self() ++ if get_blockdev_type(dev) != 0: ++ raise RTSLibError("Device %s is not a TYPE_DISK rbd device" % dev) ++ if is_dev_in_use(dev): ++ raise RTSLibError("Cannot configure StorageObject because " ++ + "device %s is already in use" % dev) ++ self._set_udev_path(dev) ++ self._control("udev_path=%s" % dev) ++ self._control("readonly=%d" % readonly) ++ self._enable() ++ ++ super(RBDStorageObject, self)._configure(wwn) ++ ++ def _get_major(self): ++ self._check_self() ++ return int(self._parse_info('Major')) ++ ++ def _get_minor(self): ++ self._check_self() ++ return int(self._parse_info('Minor')) ++ ++ def _get_size(self): ++ # udev_path doesn't work here, what if LV gets renamed? ++ return get_size_for_disk_name(self._parse_info('device')) * int(self._parse_info('SectorSize')) ++ ++ def _get_wb_enabled(self): ++ self._check_self() ++ return bool(int(self.get_attribute("emulate_write_cache"))) ++ ++ def _get_readonly(self): ++ self._check_self() ++ # 'readonly' not present before kernel 3.6 ++ try: ++ return bool(int(self._parse_info('readonly'))) ++ except AttributeError: ++ return False ++ ++ # RBDStorageObject public stuff ++ ++ major = property(_get_major, ++ doc="Get the block device major number") ++ minor = property(_get_minor, ++ doc="Get the block device minor number") ++ size = property(_get_size, ++ doc="Get the block device size") ++ write_back = property(_get_wb_enabled, ++ doc="True if write-back, False if write-through (write cache disabled)") ++ readonly = property(_get_readonly, ++ doc="True if the device is read-only, False if read/write") ++ ++ def dump(self): ++ d = super(RBDStorageObject, self).dump() ++ d['write_back'] = self.write_back ++ d['readonly'] = self.readonly ++ d['wwn'] = self.wwn ++ d['dev'] = self.udev_path ++ return d + + class UserBackedStorageObject(StorageObject): + ''' +@@ -897,6 +998,7 @@ so_mapping = { + "fileio": FileIOStorageObject, + "iblock": BlockStorageObject, + "block": BlockStorageObject, ++ "rbd": RBDStorageObject, + "user": UserBackedStorageObject, + } + +@@ -907,6 +1009,7 @@ bs_params = { + FileIOStorageObject: dict(name='fileio'), + BlockStorageObject: dict(name='block', alt_dirprefix='iblock'), + UserBackedStorageObject: dict(name='user'), ++ RBDStorageObject: dict(name='rbd'), + } + + bs_cache = {} +-- +2.13.6 + diff --git a/rtslib-fb-2.1.fb67.tar.xz b/rtslib-fb-2.1.fb67.tar.xz deleted file mode 100644 index d49703d..0000000 --- a/rtslib-fb-2.1.fb67.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5f7a668677dd8ac266090626184af1e90709b5d3988933b2015771636f157324 -size 39944