On 12/30/2014 04:53 PM, Jonathan Wiltshire wrote: >> > I would like to see the current builds in experimental, be pushed for >> > Jessie. But given the freeze, I want opinion here first. > This isn't enough information for any of us to give you an opinion; please > send source debdiffs. It's probably wise to include some explanation of the > changes, since your changelogs are mostly "new upstream release".
That is the core of the problem. LIO is a fairly new stack. The kernel component was merged, IIRC, around 2 yrs ago. For the management stack, the startup organization behind it has been going rounds. THey have shuffled through licensing, and then Red Hat forked LIO Management tools. I guess all this has led to slow development in the past. Recently, me and Jerome (upstream LIO maintainer) met. Based on our conversation, I uploaded a revised snapshot of LIO. But it had to go into experimental because of the freeze. As requested, I've attached the debdiff for all the conponenets of LIO, i.e. configshell, rtslib and targetcli. I know this request is not in line with freeze policy. But we already have an RC bug against targetcli. So, if we cannot accommodate this exception, I'd rather prefer to see LIO removed for Jessie. Because that'll make the user to explicitly download the package from Sid. Which will have a newer working version. -- Ritesh Raj Sarraf | http://people.debian.org/~rrs Debian - The Universal Operating System
diff -Nru configshell-1.5+git0.0827baa6/configshell/__init__.py configshell-1.6.1~g020d540/configshell/__init__.py --- configshell-1.5+git0.0827baa6/configshell/__init__.py 2014-07-31 22:29:34.000000000 +0530 +++ configshell-1.6.1~g020d540/configshell/__init__.py 2014-12-13 23:04:06.000000000 +0530 @@ -21,7 +21,7 @@ from node import ConfigNode, ExecutionError from prefs import Prefs -__version__ = 'GIT_VERSION' +__version__ = '1.6.1~g020d540' __author__ = "Jerome Martin <j...@risingtidesystems.com>" __url__ = "http://www.risingtidesystems.com" __description__ = "A framework to implement simple but nice CLIs." diff -Nru configshell-1.5+git0.0827baa6/debian/changelog configshell-1.6.1~g020d540/debian/changelog --- configshell-1.5+git0.0827baa6/debian/changelog 2014-09-28 16:06:43.000000000 +0530 +++ configshell-1.6.1~g020d540/debian/changelog 2014-12-17 15:33:47.000000000 +0530 @@ -1,3 +1,13 @@ +configshell (1.6.1~g020d540-1) experimental; urgency=medium + + * [df549bf] Imported Upstream version 1.5+git0.0827baa6 + * [dcfad76] Imported Upstream version 1.6 + * [bde4328] Use verbose mode when building with epydoc + * [fdece36] Imported Upstream version 1.6.1~g020d540 + * [9de2530] Update README.source + + -- Ritesh Raj Sarraf <r...@debian.org> Wed, 17 Dec 2014 15:33:18 +0530 + configshell (1.5+git0.0827baa6-2) unstable; urgency=medium * Upload to unstable diff -Nru configshell-1.5+git0.0827baa6/debian/README.source configshell-1.6.1~g020d540/debian/README.source --- configshell-1.5+git0.0827baa6/debian/README.source 2014-09-19 16:32:18.000000000 +0530 +++ configshell-1.6.1~g020d540/debian/README.source 2014-12-17 15:32:42.000000000 +0530 @@ -1,4 +1,5 @@ -This package is prepared from an archive file pulled from upstream git repository. -The exact command used is: -git archive --format=tar.gz --prefix=configshell-M.N/ vM.N >configshell-M.N.tar.gz -and then re-packed to exclude the debian/ folder +Upstream's makefile has a release target. That's what we use. + +To make it into the GBP workflow, we use the following: + +git import-orig --filter=debian /tmp/configshell-1.6.1~g020d540.tar.gz diff -Nru configshell-1.5+git0.0827baa6/debian/rules configshell-1.6.1~g020d540/debian/rules --- configshell-1.5+git0.0827baa6/debian/rules 2014-09-19 16:32:18.000000000 +0530 +++ configshell-1.6.1~g020d540/debian/rules 2014-12-17 15:28:47.000000000 +0530 @@ -16,11 +16,11 @@ python setup.py build --build-base $(build_dir) mkdir -p doc/pdf - epydoc --no-sourcecode --pdf -n configshell --exclude configobj configshell/*.py + epydoc -vvv --no-sourcecode --pdf -n configshell --exclude configobj configshell/*.py mv pdf/api.pdf doc/pdf/configshell_API_Documentation.pdf mkdir -p doc/html - epydoc --no-sourcecode --html -n configshell --exclude configobj configshell/*.py + epydoc -vvv --no-sourcecode --html -n configshell --exclude configobj configshell/*.py mv html doc/ override_dh_auto_install: diff -Nru configshell-1.5+git0.0827baa6/Makefile configshell-1.6.1~g020d540/Makefile --- configshell-1.5+git0.0827baa6/Makefile 2014-07-31 22:29:34.000000000 +0530 +++ configshell-1.6.1~g020d540/Makefile 1970-01-01 05:30:00.000000000 +0530 @@ -1,147 +0,0 @@ -# This file is part of LIO(tm). -# Copyright (c) 2011-2014 by Datera, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -NAME = configshell -GIT_BRANCH = $$(git branch | grep \* | tr -d \*) -GIT_DESC = $$(basename $$(git describe --tags | grep -o '[0-9].*$$')) -GIT_LAST_TAG = $$(git describe --tags --abbrev=0 | grep -o '[0-9].*$$') -GIT_PKG_TAG = $$(echo $(GIT_LAST_TAG) | tr - \~) -VERSION = $$(echo $(GIT_DESC) | sed s/^$(GIT_LAST_TAG)/$(GIT_PKG_TAG)/) - -version: - @echo $(VERSION) - -all: - @echo "Usage:" - @echo - @echo " make deb - Builds debian packages." - @echo " make debinstall - Builds and installs debian packages." - @echo " (requires sudo access)" - @echo " make rpm - Builds rpm packages." - @echo " make release - Generates the release tarball." - @echo - @echo " make clean - Cleanup the local repository build files." - @echo " make cleanall - Also remove dist/*" - -clean: - @rm -fv ${NAME}/*.pyc ${NAME}/*.html - @rm -frv doc - @rm -frv ${NAME}.egg-info MANIFEST build - @rm -frv debian/tmp - @rm -fv build-stamp - @rm -fv dpkg-buildpackage.log dpkg-buildpackage.version - @rm -frv *.rpm - @rm -fv debian/files debian/*.log debian/*.substvars - @rm -frv debian/${NAME}-doc/ debian/python2.5-${NAME}/ - @rm -frv debian/python2.6-${NAME}/ debian/python-${NAME}/ - @rm -frv results - @rm -fv rpm/*.spec *.spec rpm/sed* sed* - @rm -frv ${NAME}-* - @find . -name *~ -exec rm -v {} \; - @find . -name \#*\# -exec rm -v {} \; - @echo "Finished cleanup." - -cleanall: clean - @rm -frv dist - -release: build/release-stamp -build/release-stamp: - @mkdir -p build - @echo "Exporting the repository files..." - @git archive ${GIT_BRANCH} --prefix ${NAME}-${VERSION}/ \ - | (cd build; tar xfp -) - @cp -pr debian/ build/${NAME}-${VERSION} - @echo "Cleaning up the target tree..." - @rm -f build/${NAME}-${VERSION}/Makefile - @rm -f build/${NAME}-${VERSION}/.gitignore - @echo "Fixing version string..." - @sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" \ - build/${NAME}-${VERSION}/${NAME}/__init__.py - @echo "Generating rpm specfile from template..." - @cd build/${NAME}-${VERSION}; \ - for spectmpl in rpm/*.spec.tmpl; do \ - sed -i "s/Version:\( *\).*/Version:\1${VERSION}/g" $${spectmpl}; \ - mv $${spectmpl} $$(basename $${spectmpl} .tmpl); \ - done; \ - rm -r rpm - @echo "Generating rpm changelog..." - @( \ - version=$(VERSION); \ - author=$$(git show HEAD --format="format:%an <%ae>" -s); \ - date=$$(git show HEAD --format="format:%ad" -s \ - | awk '{print $$1,$$2,$$3,$$5}'); \ - hash=$$(git show HEAD --format="format:%H" -s); \ - echo '* '"$${date} $${author} $${version}-1"; \ - echo " - Generated from git commit $${hash}."; \ - ) >> $$(ls build/${NAME}-${VERSION}/*.spec) - @echo "Generating debian changelog..." - @( \ - version=$(VERSION); \ - author=$$(git show HEAD --format="format:%an <%ae>" -s); \ - date=$$(git show HEAD --format="format:%aD" -s); \ - day=$$(git show HEAD --format='format:%ai' -s \ - | awk '{print $$1}' \ - | awk -F '-' '{print $$3}' | sed 's/^0/ /g'); \ - date=$$(echo $${date} \ - | awk '{print $$1, "'"$${day}"'", $$3, $$4, $$5, $$6}'); \ - hash=$$(git show HEAD --format="format:%H" -s); \ - echo "${NAME} ($${version}) unstable; urgency=low"; \ - echo; \ - echo " * Generated from git commit $${hash}."; \ - echo; \ - echo " -- $${author} $${date}"; \ - echo; \ - ) > build/${NAME}-${VERSION}/debian/changelog - @find build/${NAME}-${VERSION}/ -exec \ - touch -t $$(date -d @$$(git show -s --format="format:%at") \ - +"%Y%m%d%H%M.%S") {} \; - @mkdir -p dist - @cd build; tar -c --owner=0 --group=0 --numeric-owner \ - --format=gnu -b20 --quoting-style=escape \ - -f ../dist/${NAME}-${VERSION}.tar \ - $$(find ${NAME}-${VERSION} -type f | sort) - @gzip -6 -n dist/${NAME}-${VERSION}.tar - @echo "Generated release tarball:" - @echo " $$(ls dist/${NAME}-${VERSION}.tar.gz)" - @touch build/release-stamp - -deb: release build/deb-stamp -build/deb-stamp: - @echo "Building debian packages..." - @cd build/${NAME}-${VERSION}; \ - dpkg-buildpackage -rfakeroot -us -uc - @mv build/*_${VERSION}_*.deb dist/ - @echo "Generated debian packages:" - @for pkg in $$(ls dist/*_${VERSION}_*.deb); do echo " $${pkg}"; done - @touch build/deb-stamp - -debinstall: deb - @echo "Installing $$(ls dist/*_${VERSION}_*.deb)" - @sudo dpkg -i $$(ls dist/*_${VERSION}_*.deb) - -rpm: release build/rpm-stamp -build/rpm-stamp: - @echo "Building rpm packages..." - @mkdir -p build/rpm - @build=$$(pwd)/build/rpm; dist=$$(pwd)/dist/; rpmbuild \ - --define "_topdir $${build}" --define "_sourcedir $${dist}" \ - --define "_rpmdir $${build}" --define "_buildir $${build}" \ - --define "_srcrpmdir $${build}" -ba build/${NAME}-${VERSION}/*.spec - @mv build/rpm/*-${VERSION}*.src.rpm dist/ - @mv build/rpm/*/*-${VERSION}*.rpm dist/ - @echo "Generated rpm packages:" - @for pkg in $$(ls dist/*-${VERSION}*.rpm); do echo " $${pkg}"; done - @touch build/rpm-stamp diff -Nru configshell-1.5+git0.0827baa6/python-configshell.spec configshell-1.6.1~g020d540/python-configshell.spec --- configshell-1.5+git0.0827baa6/python-configshell.spec 1970-01-01 05:30:00.000000000 +0530 +++ configshell-1.6.1~g020d540/python-configshell.spec 2014-12-13 23:04:06.000000000 +0530 @@ -0,0 +1,46 @@ +%define oname configshell + +Name: python-configshell +License: Apache License 2.0 +Group: System Environment/Libraries +Summary: A framework to implement simple but nice CLIs. +Version: 1.6.1~g020d540 +Release: 1%{?dist} +URL: http://www.risingtidesystems.com/git/ +Source: %{oname}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot +BuildArch: noarch +BuildRequires: python-devel, epydoc, pyparsing, python-urwid >= 0.9.9 +Requires: pyparsing, python-urwid >= 0.9.9 +Vendor: Datera, Inc. + +%description +A framework to implement simple but nice command-line interfaces. + +%prep +%setup -q -n %{oname}-%{version} + +%build +%{__python} setup.py build +mkdir -p doc/ +epydoc --no-sourcecode --html -n %{oname} --exclude configobj %{oname}/*.py +mv html doc/ + +%install +rm -rf %{buildroot} +%{__python} setup.py install --skip-build --root %{buildroot} --prefix=usr +mkdir -p %{buildroot}/usr/share/doc/python-configshell-doc-%{version} +cp -r doc/* %{buildroot}/usr/share/doc/python-configshell-doc-%{version}/ + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{python_sitelib} +/usr/share/doc/python-configshell-doc-%{version} +%doc examples COPYING README.md + +%changelog +* Sat Dec 13 2014 Marc Fleischmann <m...@datera.io> 1.6.1~g020d540-1 + - Generated from git commit 020d540850ca36f31af68e9b545a520f1122ea69. diff -Nru configshell-1.5+git0.0827baa6/README.md configshell-1.6.1~g020d540/README.md --- configshell-1.5+git0.0827baa6/README.md 2014-07-31 22:29:34.000000000 +0530 +++ configshell-1.6.1~g020d540/README.md 2014-12-13 23:04:06.000000000 +0530 @@ -4,7 +4,7 @@ simple but nice CLI-based applications running both as single-command tools and interactive shells providing a UNIX filesystem-like navigation interface, as well as full autocompletion support and interactive inline help. -It is part of LIO(tm). +It is part of LIO. ## Usage scenarios @@ -69,7 +69,7 @@ ## Author -LIO(tm) was developed by Datera, Inc. +LIO was developed by Datera, Inc. http://www.datera.io The original author and current maintainer is diff -Nru configshell-1.5+git0.0827baa6/rpm/python-configshell.spec.tmpl configshell-1.6.1~g020d540/rpm/python-configshell.spec.tmpl --- configshell-1.5+git0.0827baa6/rpm/python-configshell.spec.tmpl 2014-07-31 22:29:34.000000000 +0530 +++ configshell-1.6.1~g020d540/rpm/python-configshell.spec.tmpl 1970-01-01 05:30:00.000000000 +0530 @@ -1,44 +0,0 @@ -%define oname configshell - -Name: python-configshell -License: Apache License 2.0 -Group: System Environment/Libraries -Summary: A framework to implement simple but nice CLIs. -Version: VERSION -Release: 1%{?dist} -URL: http://www.risingtidesystems.com/git/ -Source: %{oname}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot -BuildArch: noarch -BuildRequires: python-devel, epydoc, pyparsing -Requires: pyparsing, python-urwid >= 0.9.9 -Vendor: Datera, Inc. - -%description -A framework to implement simple but nice command-line interfaces. - -%prep -%setup -q -n %{oname}-%{version} - -%build -%{__python} setup.py build -mkdir -p doc/ -epydoc --no-sourcecode --html -n %{oname} --exclude configobj %{oname}/*.py -mv html doc/ - -%install -rm -rf %{buildroot} -%{__python} setup.py install --skip-build --root %{buildroot} --prefix=usr -mkdir -p %{buildroot}/usr/share/doc/python-configshell-doc-%{version} -cp -r doc/* %{buildroot}/usr/share/doc/python-configshell-doc-%{version}/ - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%{python_sitelib} -/usr/share/doc/python-configshell-doc-%{version} -%doc examples COPYING README.md - -%changelog
diff -Nru rtslib-3.0+git0.86e46bc6/debian/changelog rtslib-3.0~pre4.1~g1b33ceb/debian/changelog --- rtslib-3.0+git0.86e46bc6/debian/changelog 2014-11-07 18:16:52.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/debian/changelog 2014-12-17 18:01:15.000000000 +0530 @@ -1,3 +1,9 @@ +rtslib (1:3.0~pre4.1~g1b33ceb-1) experimental; urgency=medium + + * New upstream release + + -- Ritesh Raj Sarraf <r...@debian.org> Wed, 17 Dec 2014 18:01:03 +0530 + rtslib (3.0+git0.86e46bc6-5) unstable; urgency=medium * [6298691] Revert "Add dh-python to build-depends" diff -Nru rtslib-3.0+git0.86e46bc6/Makefile rtslib-3.0~pre4.1~g1b33ceb/Makefile --- rtslib-3.0+git0.86e46bc6/Makefile 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/Makefile 1970-01-01 05:30:00.000000000 +0530 @@ -1,170 +0,0 @@ -# This file is part of LIO(tm). -# Copyright (c) 2011-2014 by Datera, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -NAME = rtslib -GIT_BRANCH = $$(git branch | grep \* | tr -d \*) -GIT_DESC = $$(basename $$(git describe --tags | grep -o '[0-9].*$$')) -GIT_LAST_TAG = $$(git describe --tags --abbrev=0 | grep -o '[0-9].*$$') -GIT_PKG_TAG = $$(echo $(GIT_LAST_TAG) | tr - \~) -VERSION = $$(echo $(GIT_DESC) | sed s/^$(GIT_LAST_TAG)/$(GIT_PKG_TAG)/) - -version: - @echo $(VERSION) - -all: - @echo "Usage:" - @echo - @echo " make deb - Builds debian packages." - @echo " make debinstall - Builds and installs debian packages." - @echo " (requires sudo access)" - @echo " make rpm - Builds rpm packages." - @echo " make release - Generates the release tarball." - @echo - @echo " make test - Runs the safe tests suite." - @echo " make test-all - Runs all tests, including dangerous system test." - @echo " This WILL mess-up your system target configuration!" - @echo " Requires sudo access to root privileges." - @echo - @echo " make clean - Cleanup the local repository build files." - @echo " make cleanall - Also remove dist/*" - -test: - @echo "Running the safe tests suite..." - @(PYTHONPATH=$$(pwd); cd tests/safe ; python -u -m unittest discover) - -test-all: test - @if [ ! -d "/sys/kernel/config/target" ]; then \ - echo "Cannot run system tests, target is stopped."; \ - exit 1; \ - fi - @echo "Will run the DESTRUCTIVE system tests suite now." - @echo "This requires sudo access to root privileges." - @echo "These tests WILL mess-up your system target configuration!" - @echo "Type CTRL-C to abort now or enter to continue..." - @read X - @(PYTHONPATH=$$(pwd); cd tests/system ; sudo python -m unittest discover) - -clean: - @rm -fv ${NAME}/*${NAME}/*.html - @rm -frv doc - @rm -frv ${NAME}.egg-info MANIFEST build - @rm -frv debian/tmp - @rm -fv build-stamp - @rm -fv dpkg-buildpackage.log dpkg-buildpackage.version - @rm -frv *.rpm - @rm -fv debian/files debian/*.log debian/*.substvars - @rm -frv debian/${NAME}-doc/ debian/python2.5-${NAME}/ - @rm -frv debian/python2.6-${NAME}/ debian/python-${NAME}/ - @rm -frv results - @rm -fv rpm/*.spec *.spec rpm/sed* sed* - @rm -frv ${NAME}-* - @find . -name *.swp -exec rm -v {} \; - @find . -name *.pyc -exec rm -vf {} \; - @find . -name *~ -exec rm -v {} \; - @find . -name \#*\# -exec rm -v {} \; - @echo "Finished cleanup." - -cleanall: clean - @rm -frv dist - -release: build/release-stamp -build/release-stamp: - @mkdir -p build - @echo "Exporting the repository files..." - @git archive ${GIT_BRANCH} --prefix ${NAME}-${VERSION}/ \ - | (cd build; tar xfp -) - @cp -pr debian/ build/${NAME}-${VERSION} - @echo "Cleaning up the target tree..." - @rm -f build/${NAME}-${VERSION}/Makefile - @rm -f build/${NAME}-${VERSION}/.gitignore - @echo "Fixing version string..." - @sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" \ - build/${NAME}-${VERSION}/${NAME}/__init__.py - @echo "Generating rpm specfile from template..." - @cd build/${NAME}-${VERSION}; \ - for spectmpl in rpm/*.spec.tmpl; do \ - sed -i "s/Version:\( *\).*/Version:\1${VERSION}/g" $${spectmpl}; \ - mv $${spectmpl} $$(basename $${spectmpl} .tmpl); \ - done; \ - rm -r rpm - @echo "Generating rpm changelog..." - @( \ - version=$(VERSION); \ - author=$$(git show HEAD --format="format:%an <%ae>" -s); \ - date=$$(git show HEAD --format="format:%ad" -s \ - | awk '{print $$1,$$2,$$3,$$5}'); \ - hash=$$(git show HEAD --format="format:%H" -s); \ - echo '* '"$${date} $${author} $${version}-1"; \ - echo " - Generated from git commit $${hash}."; \ - ) >> $$(ls build/${NAME}-${VERSION}/*.spec) - @echo "Generating debian changelog..." - @( \ - version=$(VERSION); \ - author=$$(git show HEAD --format="format:%an <%ae>" -s); \ - date=$$(git show HEAD --format="format:%aD" -s); \ - day=$$(git show HEAD --format='format:%ai' -s \ - | awk '{print $$1}' \ - | awk -F '-' '{print $$3}' | sed 's/^0/ /g'); \ - date=$$(echo $${date} \ - | awk '{print $$1, "'"$${day}"'", $$3, $$4, $$5, $$6}'); \ - hash=$$(git show HEAD --format="format:%H" -s); \ - echo "${NAME} ($${version}) unstable; urgency=low"; \ - echo; \ - echo " * Generated from git commit $${hash}."; \ - echo; \ - echo " -- $${author} $${date}"; \ - echo; \ - ) > build/${NAME}-${VERSION}/debian/changelog - @find build/${NAME}-${VERSION}/ -exec \ - touch -t $$(date -d @$$(git show -s --format="format:%at") \ - +"%Y%m%d%H%M.%S") {} \; - @mkdir -p dist - @cd build; tar -c --owner=0 --group=0 --numeric-owner \ - --format=gnu -b20 --quoting-style=escape \ - -f ../dist/${NAME}-${VERSION}.tar \ - $$(find ${NAME}-${VERSION} -type f | sort) - @gzip -6 -n dist/${NAME}-${VERSION}.tar - @echo "Generated release tarball:" - @echo " $$(ls dist/${NAME}-${VERSION}.tar.gz)" - @touch build/release-stamp - -deb: release build/deb-stamp -build/deb-stamp: - @echo "Building debian packages..." - @cd build/${NAME}-${VERSION}; \ - dpkg-buildpackage -rfakeroot -us -uc - @mv build/*_${VERSION}_*.deb dist/ - @echo "Generated debian packages:" - @for pkg in $$(ls dist/*_${VERSION}_*.deb); do echo " $${pkg}"; done - @touch build/deb-stamp - -debinstall: deb - @echo "Installing $$(ls dist/*_${VERSION}_*.deb)" - @sudo dpkg -i $$(ls dist/*_${VERSION}_*.deb) - -rpm: release build/rpm-stamp -build/rpm-stamp: - @echo "Building rpm packages..." - @mkdir -p build/rpm - @build=$$(pwd)/build/rpm; dist=$$(pwd)/dist/; rpmbuild \ - --define "_topdir $${build}" --define "_sourcedir $${dist}" \ - --define "_rpmdir $${build}" --define "_buildir $${build}" \ - --define "_srcrpmdir $${build}" -ba build/${NAME}-${VERSION}/*.spec - @mv build/rpm/*-${VERSION}*.src.rpm dist/ - @mv build/rpm/*/*-${VERSION}*.rpm dist/ - @echo "Generated rpm packages:" - @for pkg in $$(ls dist/*-${VERSION}*.rpm); do echo " $${pkg}"; done - @touch build/rpm-stamp diff -Nru rtslib-3.0+git0.86e46bc6/policy/backstore_fileio.lio rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_fileio.lio --- rtslib-3.0+git0.86e46bc6/policy/backstore_fileio.lio 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_fileio.lio 2014-12-13 23:03:17.000000000 +0530 @@ -1,6 +1,7 @@ storage fileio disk %str { - path %str - size %bytes + wwn %str + path %str + size %bytes buffered %bool(yes) attribute { block_size %int(512) diff -Nru rtslib-3.0+git0.86e46bc6/policy/backstore_iblock.lio rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_iblock.lio --- rtslib-3.0+git0.86e46bc6/policy/backstore_iblock.lio 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_iblock.lio 2014-12-13 23:03:17.000000000 +0530 @@ -1,5 +1,6 @@ storage iblock disk %str { - path %str + wwn %str + path %str attribute { block_size %int(512) emulate_3pc %bool(yes) diff -Nru rtslib-3.0+git0.86e46bc6/policy/backstore_pscsi.lio rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_pscsi.lio --- rtslib-3.0+git0.86e46bc6/policy/backstore_pscsi.lio 1970-01-01 05:30:00.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_pscsi.lio 2014-12-13 23:03:17.000000000 +0530 @@ -0,0 +1,25 @@ +storage pscsi disk %str { + path %str + attribute { + emulate_3pc %bool(yes) + emulate_caw %bool(yes) + emulate_dpo %bool(no) + emulate_fua_read %bool(no) + emulate_model_alias %bool(no) + emulate_rest_reord %bool(no) + emulate_tas %bool(yes) + emulate_tpu %bool(no) + emulate_tpws %bool(no) + emulate_ua_intlck_ctrl %bool(no) + emulate_write_cache %bool(no) + enforce_pr_isids %bool(yes) + fabric_max_sectors %int(8192) + is_nonrot %bool(yes) + max_unmap_block_desc_count %int(0) + max_unmap_lba_count %int(0) + max_write_same_len %int(65535) + queue_depth %int(128) + unmap_granularity %int(0) + unmap_granularity_alignment %int(0) + } +} diff -Nru rtslib-3.0+git0.86e46bc6/policy/backstore_ramdisk.lio rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_ramdisk.lio --- rtslib-3.0+git0.86e46bc6/policy/backstore_ramdisk.lio 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/policy/backstore_ramdisk.lio 2014-12-13 23:03:17.000000000 +0530 @@ -1,4 +1,5 @@ storage rd_mcp disk %str { + wwn %str size %bytes nullio %bool(no) attribute { diff -Nru rtslib-3.0+git0.86e46bc6/policy/fabric_loopback.lio rtslib-3.0~pre4.1~g1b33ceb/policy/fabric_loopback.lio --- rtslib-3.0+git0.86e46bc6/policy/fabric_loopback.lio 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/policy/fabric_loopback.lio 2014-12-13 23:03:17.000000000 +0530 @@ -1 +1,6 @@ -fabric loopback target %naa lun %int backend %backend +fabric loopback { + target %naa { + nexus_wwn %naa + lun %int backend %backend + } +} diff -Nru rtslib-3.0+git0.86e46bc6/policy/fabric_vhost.lio rtslib-3.0~pre4.1~g1b33ceb/policy/fabric_vhost.lio --- rtslib-3.0+git0.86e46bc6/policy/fabric_vhost.lio 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/policy/fabric_vhost.lio 2014-12-13 23:03:17.000000000 +0530 @@ -1,5 +1,6 @@ fabric vhost { target %naa tpgt %int { + nexus_wwn %naa lun %int backend %backend } } \ No newline at end of file diff -Nru rtslib-3.0+git0.86e46bc6/python-rtslib.spec rtslib-3.0~pre4.1~g1b33ceb/python-rtslib.spec --- rtslib-3.0+git0.86e46bc6/python-rtslib.spec 1970-01-01 05:30:00.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/python-rtslib.spec 2014-12-13 23:03:17.000000000 +0530 @@ -0,0 +1,51 @@ +%define oname rtslib + +Name: python-rtslib +License: Apache License 2.0 +Group: System Environment/Libraries +Summary: A framework to implement simple but nice CLIs. +Version: 3.0.pre4.1~g1b33ceb +Release: 1%{?dist} +URL: http://www.risingtidesystems.com/git/ +Source: %{oname}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot +BuildArch: noarch +BuildRequires: python-devel, epydoc, python-configobj, python-netifaces, python-ipaddr, pyparsing +Requires: python-configobj, python-netifaces, python-ipaddr, pyparsing +Vendor: Datera, Inc. + +%description +API for RisingTide Systems generic SCSI target. + +%prep +%setup -q -n %{oname}-%{version} + +%build +%{__python} setup.py build +mkdir -p doc +epydoc --no-sourcecode --html -n %{oname} --exclude configobj %{oname}/*.py +mv html doc/ + +%install +rm -rf %{buildroot} +%{__python} setup.py install --skip-build --root %{buildroot} --prefix usr +mkdir -p %{buildroot}/var/target/fabric +cp specs/*.spec %{buildroot}/var/target/fabric +mkdir -p %{buildroot}/var/target/policy +cp policy/*.lio %{buildroot}/var/target/policy +mkdir -p %{buildroot}/usr/share/doc/python-rtslib-doc-%{version} +cp -r doc/* specs/*.txt %{buildroot}/usr/share/doc/python-rtslib-doc-%{version}/ + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{python_sitelib} +/var/target +/usr/share/doc/python-rtslib-doc-%{version} +%doc COPYING README.md + +%changelog +* Sat Dec 13 2014 Marc Fleischmann <m...@datera.io> 3.0.pre4.1~g1b33ceb-1 + - Generated from git commit 1b33ceb05ed2fbf68b3c3fa1c6daeba69d5e96fb. diff -Nru rtslib-3.0+git0.86e46bc6/README.md rtslib-3.0~pre4.1~g1b33ceb/README.md --- rtslib-3.0+git0.86e46bc6/README.md 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/README.md 2014-12-13 23:03:17.000000000 +0530 @@ -2,7 +2,7 @@ RTSLib is a Python library that provides the API to the Linux Kernel SCSI Target subsystem, its backend storage objects subsystem as well -as third-party Target Fabric Modules. It is part of LIO(tm). +as third-party Target Fabric Modules. It is part of LIO. RTSLib allows direct manipulation of all SCSI Target objects like storage objects, SCSI targets, TPGs, LUNs and ACLs. It is part of the Linux Kernel's @@ -76,7 +76,7 @@ ## Author -LIO(tm) was developed by Datera, Inc. +LIO was developed by Datera, Inc. http://www.datera.io The original author and current maintainer is diff -Nru rtslib-3.0+git0.86e46bc6/rpm/python-rtslib.spec.tmpl rtslib-3.0~pre4.1~g1b33ceb/rpm/python-rtslib.spec.tmpl --- rtslib-3.0+git0.86e46bc6/rpm/python-rtslib.spec.tmpl 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rpm/python-rtslib.spec.tmpl 1970-01-01 05:30:00.000000000 +0530 @@ -1,49 +0,0 @@ -%define oname rtslib - -Name: python-rtslib -License: Apache License 2.0 -Group: System Environment/Libraries -Summary: A framework to implement simple but nice CLIs. -Version: VERSION -Release: 1%{?dist} -URL: http://www.risingtidesystems.com/git/ -Source: %{oname}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot -BuildArch: noarch -BuildRequires: python-devel, epydoc -Requires: python-configobj, python-netifaces, python-ipaddr, python-pyparsing -Vendor: Datera, Inc. - -%description -API for RisingTide Systems generic SCSI target. - -%prep -%setup -q -n %{oname}-%{version} - -%build -%{__python} setup.py build -mkdir -p doc -epydoc --no-sourcecode --html -n %{oname} --exclude configobj %{oname}/*.py -mv html doc/ - -%install -rm -rf %{buildroot} -%{__python} setup.py install --skip-build --root %{buildroot} --prefix usr -mkdir -p %{buildroot}/var/target/fabric -cp specs/*.spec %{buildroot}/var/target/fabric -mkdir -p %{buildroot}/var/target/policy -cp policy/*.lio %{buildroot}/var/target/policy -mkdir -p %{buildroot}/usr/share/doc/python-rtslib-doc-%{version} -cp -r doc/* specs/*.txt %{buildroot}/usr/share/doc/python-rtslib-doc-%{version}/ - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%{python_sitelib} -/var/target -/usr/share/doc/python-rtslib-doc-%{version} -%doc COPYING README.md - -%changelog diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/config_live.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/config_live.py --- rtslib-3.0+git0.86e46bc6/rtslib/config_live.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/config_live.py 2014-12-13 23:03:17.000000000 +0530 @@ -50,8 +50,7 @@ log.setLevel(logging.INFO) def _b2h(b): - # FIXME: Fix convert_bytes_to_human() instead of juggling here - return convert_bytes_to_human(b)[1:-2] + return convert_bytes_to_human(b) def get_root(): global _rtsroot @@ -96,6 +95,8 @@ dump.append("storage %s disk %s {" % (so.backstore.plugin, so.name)) attrs = [] + if so.backstore.plugin in ['fileio', 'rd_mcp', 'iblock']: + attrs.append("%swwn %s" % (_indent, so.wwn)) if so.backstore.plugin in ['fileio', 'pscsi', 'iblock']: attrs.append("%spath %s" % (_indent, so.udev_path)) if so.backstore.plugin in ['fileio', 'rd_mcp']: @@ -161,6 +162,9 @@ enable = None section = [] + if tpg.has_feature("nexus"): + section.append("%snexus_wwn %s" % (_indent, tpg.nexus_wwn)) + attrs = ["%s%s" % (_indent, attr) for attr in _list_live_group_attrs(tpg)] if attrs: @@ -461,7 +465,11 @@ lio_fabric = FabricModule(fabric.key[1]) lio_target = Target(lio_fabric, wwn=target.key[1], mode='lookup') tpgt = int(obj.key[1]) - lio_tpg = TPG(lio_target, tpgt) + try: + nexus_wwn = obj_attr(obj, "nexus_wwn") + lio_tpg = TPG(lio_target, tpgt, nexus_wwn=nexus_wwn) + except ConfigError: + lio_tpg = TPG(lio_target, tpgt) if has_enable: lio_tpg.enable = enable apply_group_attrs(obj, lio_tpg) @@ -473,7 +481,11 @@ lio_target = Target(lio_fabric, wwn=wwn) apply_group_attrs(obj, lio_target) if not lio_target.has_feature("tpgts"): - lio_tpg = TPG(lio_target, 1) + try: + nexus_wwn = obj_attr(obj, "nexus_wwn") + lio_tpg = TPG(lio_target, 1, nexus_wwn=nexus_wwn) + except ConfigError: + lio_tpg = TPG(lio_target, 1) if len(obj.search([("enable", ".*")])) != 0: lio_tpg.enable = True @@ -488,15 +500,20 @@ if plugin == 'fileio': dev = obj_attr(obj, "path") size = obj_attr(obj, "size") + try: + wwn = obj_attr(obj, "wwn") + except ConfigError: + wwn = None buffered = obj_attr(obj, "buffered") lio_bs = FileIOBackstore(idx) - lio_so = lio_bs.storage_object(name, dev, size, True, buffered) + lio_so = lio_bs.storage_object(name, dev, size, wwn, buffered) apply_group_attrs(obj, lio_so) elif plugin == 'iblock': # TODO Add policy for iblock lio_bs = IBlockBackstore(idx) dev = obj_attr(obj, "path") - lio_so = lio_bs.storage_object(name, dev, True) + wwn = obj_attr(obj, "wwn") + lio_so = lio_bs.storage_object(name, dev, wwn) apply_group_attrs(obj, lio_so) elif plugin == 'pscsi': # TODO Add policy for pscsi @@ -508,8 +525,9 @@ # TODO Add policy for rd_mcp lio_bs = RDMCPBackstore(idx) size = obj_attr(obj, "size") + wwn = obj_attr(obj, "wwn") nullio = obj_attr(obj, "nullio") - lio_so = lio_bs.storage_object(name, size, True, nullio) + lio_so = lio_bs.storage_object(name, size, wwn, nullio) apply_group_attrs(obj, lio_so) else: raise ConfigError("Unknown backend '%s' for backstore '%s'" @@ -663,4 +681,3 @@ target.delete() for backstore in root.backstores: backstore.delete() - diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/config.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/config.py --- rtslib-3.0+git0.86e46bc6/rtslib/config.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/config.py 2014-12-13 23:03:17.000000000 +0530 @@ -23,7 +23,7 @@ ''' import os, re, time, copy, logging -from rtslib.utils import is_valid_wwn, list_eth_ips +from rtslib.utils import is_valid_wwn, list_eth_ips, fread from config_filters import * from config_tree import ConfigTree, NO_VALUE @@ -541,13 +541,16 @@ If an error occurs, the operation will be aborted, leaving the current configuration intact. ''' - parse_tree = self._parser.parse_file(filepath) - source = {'operation': 'load', - 'filepath': filepath, - 'timestamp': time.time(), - 'mtime': os.path.getmtime(filepath)} - self._load_parse_tree(parse_tree, replace=True, - source=source, allow_new_attrs=allow_new_attrs) + for c in fread(filepath): + if c not in ["\n", "\t", " "]: + parse_tree = self._parser.parse_file(filepath) + source = {'operation': 'load', + 'filepath': filepath, + 'timestamp': time.time(), + 'mtime': os.path.getmtime(filepath)} + self._load_parse_tree(parse_tree, replace=True, + source=source, allow_new_attrs=allow_new_attrs) + break def load_live(self): ''' diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/__init__.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/__init__.py --- rtslib-3.0+git0.86e46bc6/rtslib/__init__.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/__init__.py 2014-12-13 23:03:17.000000000 +0530 @@ -34,7 +34,7 @@ from config_tree import ConfigTree, NO_VALUE from config_parser import ConfigParser, PolicyParser, PatternParser -__version__ = 'GIT_VERSION' +__version__ = '3.0.pre4.1~g1b33ceb' __author__ = "Jerome Martin <j...@risingtidesystems.com>" __url__ = "http://www.risingtidesystems.com" __description__ = "API for RisingTide Systems generic SCSI target." diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/node.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/node.py --- rtslib-3.0+git0.86e46bc6/rtslib/node.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/node.py 2014-12-13 23:03:17.000000000 +0530 @@ -139,7 +139,23 @@ ''' self._check_self() path = "%s/attrib" % self.path - return self._list_files(path, writable) + attributes = self._list_files(path, writable) + + # FIXME Bug in the pSCSI kernel implementation, these should be ro + backstore = getattr(self, "backstore", None) + plugin = getattr(backstore, "plugin", None) + edited_attributes = [] + force_ro_attrs = ["block_size", "emulate_fua_write", "optimal_sectors"] + + if writable is True and plugin == "pscsi": + edited_attributes = [attr for attr in attributes + if attr not in force_ro_attrs] + elif writable is False and plugin == "pscsi": + edited_attributes = list(set(attributes + force_ro_attrs)) + else: + edited_attributes = attributes + + return edited_attributes def list_auth_attrs(self, writable=None): ''' diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/target.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/target.py --- rtslib-3.0+git0.86e46bc6/rtslib/target.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/target.py 2014-12-13 23:03:17.000000000 +0530 @@ -901,18 +901,21 @@ # TPG private stuff - def __init__(self, parent_target, tag, mode='any'): + def __init__(self, parent_target, tag, mode='any', nexus_wwn=None): ''' @param parent_target: The parent Target object of the TPG. @type parent_target: Target @param tag: The TPG Tag (TPGT). @type tag: int > 0 - @param mode:An optionnal string containing the object creation mode: + @param mode: An optionnal string containing the object creation mode: - I{'any'} means the configFS object will be either looked up or created. - I{'lookup'} means the object MUST already exist configFS. - I{'create'} means the object must NOT already exist in configFS. - @type mode:string + @type mode: string + @param nexus: An optionnal naa WWN that makes sense only for fabrics + supporting that feature, like the loopback fabric. + @type nexus: string @return: A TPG object. ''' @@ -943,7 +946,7 @@ self._create_in_cfs_ine(mode) if self.has_feature('nexus') and not self._get_nexus(): - self._set_nexus() + self._set_nexus(nexus_wwn) def _get_tag(self): return self._tag @@ -1143,8 +1146,8 @@ doc="Get the list of LUN objects currently attached " \ + "to the TPG.") - nexus = property(_get_nexus, _set_nexus, - doc="Get or set (once) the TPG's Nexus is used.") + nexus_wwn = property(_get_nexus, _set_nexus, + doc="Get or set (once) the TPG's Nexus initiator WWN.") class Target(CFSNode): ''' diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/tcm.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/tcm.py --- rtslib-3.0+git0.86e46bc6/rtslib/tcm.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/tcm.py 2014-12-13 23:03:17.000000000 +0530 @@ -22,7 +22,8 @@ from target import LUN, TPG, Target, FabricModule from node import CFSNode -from utils import fread, fwrite, RTSLibError, list_scsi_hbas, generate_wwn +from utils import (fread, fwrite, + RTSLibError, list_scsi_hbas, generate_wwn) from utils import convert_scsi_path_to_hctl, convert_scsi_hctl_to_path from utils import convert_human_to_bytes, is_dev_in_use, get_block_type from utils import is_disk_partition, get_disk_size @@ -186,13 +187,13 @@ # RDMCPBackstore public stuff - def storage_object(self, name, size=None, gen_wwn=True, nullio=False): + def storage_object(self, name, size=None, wwn=None, nullio=False): ''' Same as RDMCPStorageObject() without specifying the backstore ''' self._check_self() return RDMCPStorageObject(self, name=name, size=size, - gen_wwn=gen_wwn, nullio=nullio) + wwn=wwn, nullio=nullio) class FileIOBackstore(Backstore): ''' @@ -220,13 +221,12 @@ # FileIOBackstore public stuff def storage_object(self, name, dev=None, size=None, - gen_wwn=True, buffered_mode=False): + wwn=None, buffered_mode=False): ''' Same as FileIOStorageObject() without specifying the backstore ''' self._check_self() - return FileIOStorageObject(self, name=name, dev=dev, - size=size, gen_wwn=gen_wwn, + return FileIOStorageObject(self, name=name, dev=dev, size=size, wwn=wwn, buffered_mode=buffered_mode) class IBlockBackstore(Backstore): @@ -254,19 +254,20 @@ # IBlockBackstore public stuff - def storage_object(self, name, dev=None, gen_wwn=True): + def storage_object(self, name, dev=None, wwn=None): ''' Same as IBlockStorageObject() without specifying the backstore ''' self._check_self() - return IBlockStorageObject(self, name=name, dev=dev, - gen_wwn=gen_wwn) + return IBlockStorageObject(self, name=name, dev=dev, wwn=wwn) class StorageObject(CFSNode): ''' This is an interface to storage objects in configFS. A StorageObject is identified by its backstore and its name. ''' + pr_aptpl_metadata_dir = "/var/target/pr" + # StorageObject private stuff def __init__(self, backstore, backstore_class, name, mode): @@ -293,6 +294,8 @@ def _set_wwn(self, wwn): self._check_self() + if wwn is None: + wwn = generate_wwn('unit_serial') if self.is_configured(): path = "%s/wwn/vpd_unit_serial" % self.path fwrite(path, "%s\n" % wwn) @@ -394,7 +397,6 @@ block storages will not be touched, but all ramdisk data will be lost. ''' self._check_self() - # If we are called after a configure error, we can skip this if self.is_configured(): for lun in self._gen_attached_luns(): @@ -409,7 +411,6 @@ ''' @return: True if the StorageObject is configured, else returns False ''' - self._check_self() path = "%s/info" % self.path try: @@ -419,6 +420,35 @@ else: return True + def restore_pr_aptpl(self, src_path=None): + ''' + Restores StorageObject persistent reservations read from src_path. + If src_path is omitted, uses the default LIO PR APTPL system + path if it exists. This only works if the StorageObject is not + in use currently, else an IO error will occur. + + @param src_path: The PR metadata file path. + @type src_path: string or None + ''' + dst_path = "%s/pr/res_aptpl_metadata" % self.path + if src_path is None: + src_path = "%s/aptpl_%s" % (self.pr_aptpl_metadata_dir, self.wwn) + + if not os.path.isfile(src_path): + return + + lines = fread(src_path).split() + if not lines[0].startswith("PR_REG_START:"): + return + + for line in lines: + if line.startswith("PR_REG_START:"): + pr_lines = [] + elif line.startswith("PR_REG_END:"): + fwrite(dst_path, ",".join(pr_lines)) + else: + pr_lines.append(line.strip()) + backstore = property(_get_backstore, doc="Get the backstore object.") name = property(_get_name, @@ -426,7 +456,7 @@ udev_path = property(_get_udev_path, doc="Get the StorageObject udev_path as a string.") wwn = property(_get_wwn, _set_wwn, - doc="Get or set the StorageObject T10 WWN Serial as a string.") + doc="Get or set the StorageObject T10 WWN Serial as a string, or None for random.") status = property(_get_status, doc="Get the storage object status, depending on whether or not it"\ + "is used by any LUN") @@ -619,7 +649,7 @@ # RDMCPStorageObject private stuff - def __init__(self, backstore, name, size=None, gen_wwn=True, nullio=False): + def __init__(self, backstore, name, size=None, wwn=None, nullio=False): ''' A RDMCPStorageObject can be instantiated in two ways: - B{Creation mode}: If I{size} is specified, the underlying @@ -651,8 +681,8 @@ - The base value for kilo is 1024, aka 1kB = 1024B. Strictly speaking, we use kiB, MiB, etc. @type size: string or int - @param gen_wwn: Should we generate a T10 WWN Unit Serial ? - @type gen_wwn: bool + @param wwn: Either None (use random unit serial) or the WWN to use as T10 Unit Serial. + @type wwn: None or string @param nullio: If rd should be created w/o backing page store. @type nullio: bool @return: A RDMCPStorageObject object. @@ -663,7 +693,7 @@ name, 'create') try: - self._configure(size, gen_wwn, nullio) + self._configure(size, wwn, nullio) except: self.delete() raise @@ -685,8 +715,8 @@ if nullio: self._control("rd_nullio=1") self._enable() - if wwn: - self.wwn = generate_wwn('unit_serial') + self.wwn = wwn + self.restore_pr_aptpl() def _get_page_size(self): self._check_self() @@ -728,7 +758,7 @@ # FileIOStorageObject private stuff def __init__(self, backstore, name, dev=None, size=None, - gen_wwn=True, buffered_mode=False): + wwn=None, buffered_mode=False): ''' A FileIOStorageObject can be instantiated in two ways: - B{Creation mode}: If I{dev} and I{size} are specified, the @@ -764,8 +794,8 @@ - The base value for kilo is 1024, aka 1kB = 1024B. Strictly speaking, we use kiB, MiB, etc. @type size: string or int - @param gen_wwn: Should we generate a T10 WWN Unit Serial ? - @type gen_wwn: bool + @param wwn: Either None (use random WWN) or the WWN to use as T10 Unit Serial. + @type wwn: None or string @param buffered_mode: Should we create the StorageObject in buffered mode or not ? Byt default, we create it in synchronous mode (non-buffered). This cannot be changed later. @@ -779,7 +809,7 @@ name, 'create') try: - self._configure(dev, size, gen_wwn, buffered_mode) + self._configure(dev, size, wwn, buffered_mode) except: self.delete() raise @@ -831,14 +861,11 @@ self._control("fd_dev_name=%s" % dev) self._set_udev_path(dev) - if buffered_mode: self._set_buffered_mode() - self._enable() - - if wwn: - self.wwn = generate_wwn('unit_serial') + self.wwn = wwn + self.restore_pr_aptpl() def _get_mode(self): self._check_self() @@ -873,7 +900,7 @@ # IBlockStorageObject private stuff - def __init__(self, backstore, name, dev=None, gen_wwn=True): + def __init__(self, backstore, name, dev=None, wwn=None): ''' A BlockIOStorageObject can be instantiated in two ways: - B{Creation mode}: If I{dev} is specified, the underlying configFS @@ -895,9 +922,8 @@ - The only device type that is accepted I{TYPE_DISK}. For other device types, use pscsi. @type dev: string - @param gen_wwn: Should we generate a T10 WWN Unit Serial when - creating the object ? - @type gen_wwn: bool + @param wwn: Either None (use random WWN) or the WWN to use as T10 Unit Serial. + @type wwn: None or string @return: A BlockIOStorageObject object. ''' @@ -907,7 +933,7 @@ name, 'create') try: - self._configure(dev, gen_wwn) + self._configure(dev, wwn) except: self.delete() raise @@ -936,8 +962,9 @@ # For 4.x and above, use the generic udev_path method self._control("udev_path=%s" % dev) self._enable() - if wwn: - self.wwn = generate_wwn('unit_serial') + + self.wwn = wwn + self.restore_pr_aptpl() def _get_major(self): self._check_self() diff -Nru rtslib-3.0+git0.86e46bc6/rtslib/utils.py rtslib-3.0~pre4.1~g1b33ceb/rtslib/utils.py --- rtslib-3.0+git0.86e46bc6/rtslib/utils.py 2014-07-31 23:35:47.000000000 +0530 +++ rtslib-3.0~pre4.1~g1b33ceb/rtslib/utils.py 2014-12-13 23:03:17.000000000 +0530 @@ -69,7 +69,6 @@ @type path: string @param string: The string to write to the file. @type string: string - ''' path = os.path.realpath(str(path)) file_fd = open(path, 'w') @@ -98,7 +97,6 @@ ''' path = os.path.realpath(str(path)) - string = "" file_fd = open(path, 'r') try: string = file_fd.read() @@ -341,7 +339,8 @@ 251, # LOCAL/EXPERIMENTAL USE 252, # LOCAL/EXPERIMENTAL USE 253, # LOCAL/EXPERIMENTAL USE - 254 # LOCAL/EXPERIMENTAL USE + 254, # LOCAL/EXPERIMENTAL USE + 259 # NVME namespaces ] if major in type_disk_known_majors: return 0 @@ -450,7 +449,7 @@ return "" for x in ['bytes','K','M','G','T']: if size < 1024.0: - return "(%3.1f%s) " % (size, x) + return "%3.1f%s" % (size, x) size /= 1024.0 def convert_human_to_bytes(hsize, kilo=1024):
diff -Nru targetcli-3.0+git0.7e32595e/debian/changelog targetcli-3.0~pre4.1~ga55d018/debian/changelog --- targetcli-3.0+git0.7e32595e/debian/changelog 2014-09-28 16:22:45.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/debian/changelog 2014-12-17 17:56:17.000000000 +0530 @@ -1,3 +1,9 @@ +targetcli (1:3.0~pre4.1~ga55d018-1) experimental; urgency=medium + + * [4195fcc] Imported Upstream version 3.0~pre4.1~ga55d018 + + -- Ritesh Raj Sarraf <r...@debian.org> Wed, 17 Dec 2014 17:56:05 +0530 + targetcli (3.0+git0.7e32595e-2) unstable; urgency=medium * Upload to Unstable diff -Nru targetcli-3.0+git0.7e32595e/Makefile targetcli-3.0~pre4.1~ga55d018/Makefile --- targetcli-3.0+git0.7e32595e/Makefile 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/Makefile 1970-01-01 05:30:00.000000000 +0530 @@ -1,154 +0,0 @@ -# This file is part of LIO(tm). -# Copyright (c) 2011-2014 by Datera, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -NAME = targetcli -GIT_BRANCH = $$(git branch | grep \* | tr -d \*) -GIT_DESC = $$(basename $$(git describe --tags | grep -o '[0-9].*$$')) -GIT_LAST_TAG = $$(git describe --tags --abbrev=0 | grep -o '[0-9].*$$') -GIT_PKG_TAG = $$(echo $(GIT_LAST_TAG) | tr - \~) -VERSION = $$(echo $(GIT_DESC) | sed s/^$(GIT_LAST_TAG)/$(GIT_PKG_TAG)/) - -version: - @echo $(VERSION) - -all: - @echo "Usage:" - @echo - @echo " make deb - Builds debian packages." - @echo " make debinstall - Builds and installs debian packages." - @echo " (requires sudo access)" - @echo " make rpm - Builds rpm packages." - @echo " make release - Generates the release tarball." - @echo - @echo " make clean - Cleanup the local repository build files." - @echo " make cleanall - Also remove dist/*" - -clean: - @rm -frv ${NAME}/*.html - @rm -frv ${NAME}.egg-info MANIFEST build - @rm -frv debian/tmp - @rm -fv build-stamp - @rm -fv dpkg-buildpackage.log dpkg-buildpackage.version - @rm -frv *.rpm - @rm -fv debian/files debian/*.log debian/*.substvars - @rm -frv debian/${NAME}-doc/ debian/python2.5-${NAME}/ - @rm -frv debian/python2.6-${NAME}/ debian/python-${NAME}/ - @rm -frv results - @rm -fv rpm/*.spec *.spec rpm/sed* sed* - @rm -frv ${NAME}-* - @rm -frv *.rpm warn${NAME}.txt build${NAME} - @rm -fv debian/*.debhelper.log debian/*.debhelper debian/*.substvars debian/files - @rm -fvr debian/${NAME}-frozen/ debian/${NAME}-python2.5/ - @rm -fvr debian/${NAME}-python2.6/ debian/${NAME}/ debian/${NAME}-doc/ - @rm -frv log/ - @find . -name *.swp -exec rm -v {} \; - @find . -name *.pyc -exec rm -vf {} \; - @find . -name *~ -exec rm -v {} \; - @find . -name \#*\# -exec rm -v {} \; - @echo "Finished cleanup." - -cleanall: clean - @rm -frv dist - -release: build/release-stamp -build/release-stamp: - @mkdir -p build - @echo "Exporting the repository files..." - @git archive ${GIT_BRANCH} --prefix ${NAME}-${VERSION}/ \ - | (cd build; tar xfp -) - @cp -pr debian/ build/${NAME}-${VERSION} - @echo "Cleaning up the target tree..." - @rm -f build/${NAME}-${VERSION}/Makefile - @rm -f build/${NAME}-${VERSION}/.gitignore - @rm -rf build/${NAME}-${VERSION}/bin - @echo "Fixing version string..." - @sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" \ - build/${NAME}-${VERSION}/${NAME}/__init__.py - @echo "Generating rpm specfile from template..." - @cd build/${NAME}-${VERSION}; \ - for spectmpl in rpm/*.spec.tmpl; do \ - sed -i "s/Version:\( *\).*/Version:\1${VERSION}/g" $${spectmpl}; \ - mv $${spectmpl} $$(basename $${spectmpl} .tmpl); \ - done; \ - rmdir rpm - @echo "Generating rpm changelog..." - @( \ - version=$(VERSION); \ - author=$$(git show HEAD --format="format:%an <%ae>" -s); \ - date=$$(git show HEAD --format="format:%ad" -s \ - | awk '{print $$1,$$2,$$3,$$5}'); \ - hash=$$(git show HEAD --format="format:%H" -s); \ - echo '* '"$${date} $${author} $${version}-1"; \ - echo " - Generated from git commit $${hash}."; \ - ) >> $$(ls build/${NAME}-${VERSION}/*.spec) - @echo "Generating debian changelog..." - @( \ - version=$(VERSION); \ - author=$$(git show HEAD --format="format:%an <%ae>" -s); \ - date=$$(git show HEAD --format="format:%aD" -s); \ - day=$$(git show HEAD --format='format:%ai' -s \ - | awk '{print $$1}' \ - | awk -F '-' '{print $$3}' | sed 's/^0/ /g'); \ - date=$$(echo $${date} \ - | awk '{print $$1, "'"$${day}"'", $$3, $$4, $$5, $$6}'); \ - hash=$$(git show HEAD --format="format:%H" -s); \ - echo "${NAME} ($${version}) unstable; urgency=low"; \ - echo; \ - echo " * Generated from git commit $${hash}."; \ - echo; \ - echo " -- $${author} $${date}"; \ - echo; \ - ) > build/${NAME}-${VERSION}/debian/changelog - @find build/${NAME}-${VERSION}/ -exec \ - touch -t $$(date -d @$$(git show -s --format="format:%at") \ - +"%Y%m%d%H%M.%S") {} \; - @mkdir -p dist - @cd build; tar -c --owner=0 --group=0 --numeric-owner \ - --format=gnu -b20 --quoting-style=escape \ - -f ../dist/${NAME}-${VERSION}.tar \ - $$(find ${NAME}-${VERSION} -type f | sort) - @gzip -6 -n dist/${NAME}-${VERSION}.tar - @echo "Generated release tarball:" - @echo " $$(ls dist/${NAME}-${VERSION}.tar.gz)" - @touch build/release-stamp - -deb: release build/deb-stamp -build/deb-stamp: - @echo "Building debian packages..." - @cd build/${NAME}-${VERSION}; \ - dpkg-buildpackage -rfakeroot -us -uc - @mv build/*_${VERSION}_*.deb dist/ - @echo "Generated debian packages:" - @for pkg in $$(ls dist/*_${VERSION}_*.deb); do echo " $${pkg}"; done - @touch build/deb-stamp - -debinstall: deb - @echo "Installing $$(ls dist/*_${VERSION}_*.deb)" - @sudo dpkg -i $$(ls dist/*_${VERSION}_*.deb) - -rpm: release build/rpm-stamp -build/rpm-stamp: - @echo "Building rpm packages..." - @mkdir -p build/rpm - @build=$$(pwd)/build/rpm; dist=$$(pwd)/dist/; rpmbuild \ - --define "_topdir $${build}" --define "_sourcedir $${dist}" \ - --define "_rpmdir $${build}" --define "_buildir $${build}" \ - --define "_srcrpmdir $${build}" -ba build/${NAME}-${VERSION}/*.spec - @mv build/rpm/*-${VERSION}*.src.rpm dist/ - @mv build/rpm/*/*-${VERSION}*.rpm dist/ - @echo "Generated rpm packages:" - @for pkg in $$(ls dist/*-${VERSION}*.rpm); do echo " $${pkg}"; done - @touch build/rpm-stamp diff -Nru targetcli-3.0+git0.7e32595e/README.md targetcli-3.0~pre4.1~ga55d018/README.md --- targetcli-3.0+git0.7e32595e/README.md 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/README.md 2014-12-13 23:01:46.000000000 +0530 @@ -1,7 +1,7 @@ # TargetCLI -TargetCLI is the LIO(tm) commmand-line administration tool for managing the -Linux SCSI Target, and its third-party target fabric modules and backend storage +TargetCLI is the LIO commmand-line administration tool for managing the Linux +SCSI Target, and its third-party target fabric modules and backend storage objects. Based on RTSLib, it allows direct manipulation of all SCSI Target objects like @@ -93,7 +93,7 @@ ## Author -LIO(tm) was developed by Datera, Inc. +LIO was developed by Datera, Inc. http://www.datera.io The original author and current maintainer is diff -Nru targetcli-3.0+git0.7e32595e/rpm/targetcli.spec.tmpl targetcli-3.0~pre4.1~ga55d018/rpm/targetcli.spec.tmpl --- targetcli-3.0+git0.7e32595e/rpm/targetcli.spec.tmpl 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/rpm/targetcli.spec.tmpl 1970-01-01 05:30:00.000000000 +0530 @@ -1,45 +0,0 @@ -%define oname targetcli - -Name: targetcli -License: Apache License 2.0 -Group: Applications/System -Summary: RisingTide Systems generic SCSI target CLI shell. -Version: VERSION -Release: 1%{?dist} -URL: http://www.risingtidesystems.com/git/ -Source: %{oname}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot -BuildArch: noarch -BuildRequires: python-devel, python-rtslib, python-configshell -Requires: python-rtslib, python-configshell, python-prettytable -Conflicts: targetcli-frozen, rtsadmin-frozen, rtsadmin, lio-utils -Vendor: Datera, Inc. - -%description -RisingTide Systems generic SCSI target CLI shell. - -%prep -%setup -q -n %{oname}-%{version} - -%build -%{__python} setup.py build - -%install -rm -rf %{buildroot} -%{__python} setup.py install --skip-build --root=%{buildroot} --prefix=usr -mkdir -p %_mandir/man8/ -mv doc/targetcli.8 %_mandir/man8/targetcli.8.gz -mkdir -p /etc/target - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%{python_sitelib} -/etc/target -%{_bindir}/targetcli -%{_bindir}/targetcli-ng -%doc COPYING README.md %_mandir/man8/targetcli.8.gz - -%changelog diff -Nru targetcli-3.0+git0.7e32595e/scripts/targetcli targetcli-3.0~pre4.1~ga55d018/scripts/targetcli --- targetcli-3.0+git0.7e32595e/scripts/targetcli 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/scripts/targetcli 2014-12-13 23:01:46.000000000 +0530 @@ -19,7 +19,7 @@ ''' import sys -from os import getuid +from os import getuid, listdir from targetcli import UIRoot from rtslib import RTSLibError from configshell import ConfigShell @@ -51,12 +51,19 @@ ''' Start the targetcli shell. ''' + shell = TargetCLI('~/.targetcli') + + try: + listdir("/sys/kernel/config/target") + except: + shell.con.display("The target service is not running.") + exit() + if getuid() == 0: is_root = True else: is_root = False - shell = TargetCLI('~/.targetcli') if not is_root: shell.con.display("You are not root, disabling privileged commands.\n") diff -Nru targetcli-3.0+git0.7e32595e/scripts/target.init targetcli-3.0~pre4.1~ga55d018/scripts/target.init --- targetcli-3.0+git0.7e32595e/scripts/target.init 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/scripts/target.init 2014-12-13 23:01:46.000000000 +0530 @@ -16,7 +16,7 @@ DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME -CFS_BASE="/sys/kernel/config/" +CFS_BASE="/sys/kernel/config" CFS_TGT="${CFS_BASE}/target" CORE_MODS="target_core_mod target_core_pscsi target_core_iblock target_core_file" STARTUP_CONFIG="/etc/target/scsi_target.lio" @@ -24,11 +24,58 @@ # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh +# How we log messages depends on the system +if [ -r /lib/lsb/init-functions ]; then + # LSB systems like Debian + . /lib/lsb/init-functions +elif [ -r /etc/init.d/functions ]; then + # RHEL without optional redhat-lsb + . /etc/init.d/functions +fi + +is_func() { + type $1 2>/dev/null | grep -q 'function' +} + +log_success () { + if is_func log_success_msg; then + log_success_msg "$*" + elif is_func success; then + echo -n $*; success "$*"; echo + else + echo "[ ok ] $*" + fi +} -# Define LSB log_* functions - requires lsb-base (>= 3.2-14) -. /lib/lsb/init-functions +log_failure () { + if is_func log_failure_msg; then + log_failure_msg "$*" + elif is_func failure; then + echo -n $*; failure "$*"; echo + else + echo "[FAIL] $* ... failed!" + fi +} + +log_warning () { + if is_func log_warning_msg; then + log_warning_msg "$*" + elif is_func warning; then + echo -n $*; warning "$*"; echo + else + echo "[warn] $* ... (warning)." + fi +} + +log_action () { + if is_func log_action_msg; then + log_action_msg "$*" + elif is_func action; then + echo -n $*; passed "$*"; echo + else + echo "[info] $*." + fi +} load_specfiles() { @@ -57,14 +104,22 @@ python -c "from rtslib import Config" > /dev/null 2>&1 if [ $? != 0 ]; then - log_failure_msg "Cannot load rtslib" + log_failure "Cannot load rtslib" INSTALL=nok fi + SYSTEM_DIRS="/var/target/pr /var/target/alua /etc/target" + for DIR in ${SYSTEM_DIRS}; do + if [ ! -d ${DIR} ]; then + log_warning "Creating missing directory ${DIR}" + mkdir -p ${DIR} + fi + done + if [ "${INSTALL}" != ok ]; then exit 0 else - log_action_msg "${DESC} looks properly installed" + log_action "${DESC} looks properly installed" fi } @@ -72,14 +127,14 @@ { modprobe configfs > /dev/null 2>&1 if [ "$?" != 0 ]; then - log_failure_msg "Failed to load configfs kernel module" + log_failure "Failed to load configfs kernel module" return 1 fi mount -t configfs configfs ${CFS_BASE} > /dev/null 2>&1 case "$?" in - 0) log_warning_msg "The configfs filesystem was not mounted, consider adding it to fstab";; - 32) log_action_msg "The configfs filesystem is already mounted";; - *) log_failure_msg "Failed to mount configfs"; return 1;; + 0) log_warning "The configfs filesystem was not mounted, consider adding it to fstab";; + 32) log_action "The configfs filesystem is already mounted";; + *) log_failure "Failed to mount configfs"; return 1;; esac } @@ -87,27 +142,27 @@ { for MODULE in ${CORE_MODS}; do if [ ! -z "$(cat /proc/modules | grep ^${MODULE}\ )" ]; then - log_warning_msg "Core module ${MODULE} already loaded" + log_warning "Core module ${MODULE} already loaded" else modprobe "${MODULE}" > /dev/null 2>&1 if [ "$?" != 0 ]; then - log_failure_msg "Failed to load core module ${MODULE}" + log_failure "Failed to load core module ${MODULE}" return 1 else - log_action_msg "Loaded core module ${MODULE}" + log_action "Loaded core module ${MODULE}" fi fi done for MOD_SPEC in ${FABRIC_MODS}; do MODULE="$(echo ${MOD_SPEC} | awk -F : '{print $1}')" if [ ! -z "$(cat /proc/modules | grep ^${MODULE}\ )" ]; then - log_warning_msg "Fabric module ${MODULE} already loaded" + log_warning "Fabric module ${MODULE} already loaded" else modprobe "${MODULE}" > /dev/null 2>&1 if [ "$?" != 0 ]; then - log_warning_msg "Failed to load fabric module ${MODULE}" + log_warning "Failed to load fabric module ${MODULE}" else - log_action_msg "Loaded fabric module ${MODULE}" + log_action "Loaded fabric module ${MODULE}" fi fi done @@ -123,19 +178,19 @@ if [ ! -z "$(lsmod | grep ^${MODULE}\ )" ]; then rmdir "${CFS_GROUP}" > /dev/null 2>&1 if [ -d "${CFS_GROUP}" ]; then - log_failure_msg "Failed to remove ${CFS_GROUP}" + log_failure "Failed to remove ${CFS_GROUP}" RETCODE=1 else rmmod "${MODULE}" > /dev/null 2>&1 if [ "$?" != 0 ]; then - log_failure_msg "Failed to unload fabric module ${MODULE}" + log_failure "Failed to unload fabric module ${MODULE}" RETCODE=1 else - log_action_msg "Unloaded ${MODULE} fabric module" + log_action "Unloaded ${MODULE} fabric module" fi fi else - log_warning_msg "Fabric module ${MODULE} is not loaded" + log_warning "Fabric module ${MODULE} is not loaded" fi done @@ -144,13 +199,13 @@ if [ ! -z "$(lsmod | grep ^${MODULE}\ )" ]; then rmmod "${MODULE}" > /dev/null 2>&1 if [ "$?" != 0 ]; then - log_failure_msg "Failed to unload target core module ${MODULE}" + log_failure "Failed to unload target core module ${MODULE}" RETCODE=1 else - log_action_msg "Unloaded ${MODULE} target core module" + log_action "Unloaded ${MODULE} target core module" fi else - log_warning_msg "Target core module ${MODULE} is not loaded" + log_warning "Target core module ${MODULE} is not loaded" fi done @@ -159,7 +214,10 @@ load_config() { -if [ -e "${STARTUP_CONFIG}" ]; then + +if [ $(cat /etc/target/scsi_target.lio 2>/dev/null | tr -d " \n\t" | wc -c) = 0 ]; then + log_warning "Startup config ${STARTUP_CONFIG} is empty, skipping" +elif [ -e "${STARTUP_CONFIG}" ]; then export __STARTUP_CONFIG="${STARTUP_CONFIG}" python 2> /dev/null << EOF import os, rtslib @@ -169,14 +227,14 @@ EOF if [ "$?" != 0 ]; then unset __STARTUP_CONFIG - log_failure_msg "Failed to load ${STARTUP_CONFIG}" + log_failure "Failed to load ${STARTUP_CONFIG}" return 1 else unset __STARTUP_CONFIG - log_action_msg "Loaded ${STARTUP_CONFIG}" + log_action "Loaded ${STARTUP_CONFIG}" fi else - log_warning_msg "No ${STARTUP_CONFIG} to load" + log_warning "No ${STARTUP_CONFIG} to load" fi } @@ -189,10 +247,10 @@ EOF if [ "$?" != 0 ]; then - log_failure_msg "Failed to clear configuration" + log_failure "Failed to clear configuration" return 1 else - log_action_msg "Cleared configuration" + log_action "Cleared configuration" fi } @@ -201,34 +259,37 @@ # If the target is running and we do not have a config file on the # system, dump the running system config to the config file. This # helps migrating away from lio-utils or other legacy/devel systems. - if [ ! -e "${STARTUP_CONFIG}" ] && [ -d "${CFS_TGT}" ]; then - log_action_msg "Possible config migration detected, saving the " \ + if [ ! -e "${STARTUP_CONFIG}" ] && [ $(ls /sys/kernel/config/target/core/ 2>/dev/null | wc -l) -gt 1 ]; then + log_action "Possible config migration detected, saving the " \ "running target to ${STARTUP_CONFIG}" save_running_config + elif [ -d ${CFS_TGT} ]; then + log_failure "Not starting: ${CFS_TGT} already exists" + return 1 fi load_specfiles # Fill in FABRIC_MODS and CFS_GROUPS check_install && load_configfs && load_modules && load_config if [ "$?" != 0 ]; then - log_failure_msg "Could not start ${DESC}" + log_failure "Could not start ${DESC}" return 1 else - log_success_msg "Started ${DESC}" + log_success "Started ${DESC}" fi } do_stop() { if [ ! -d ${CFS_TGT} ]; then - log_success_msg "${DESC} is already stopped" + log_success "${DESC} is already stopped" else load_specfiles # Fill in FABRIC_MODS and CFS_GROUPS clear_config && unload_modules if [ "$?" != 0 ]; then - log_failure_msg "Could not stop ${DESC}" + log_failure "Could not stop ${DESC}" return 1 else - log_success_msg "Stopped ${DESC}" + log_success "Stopped ${DESC}" fi fi } @@ -236,16 +297,18 @@ do_status() { if [ -d ${CFS_TGT} ]; then - log_action_msg "${DESC} is started" + log_action "${DESC} is started" return 0 else - log_action_msg "${DESC} is stopped" + log_action "${DESC} is stopped" return 1 fi } case "$1" in start) + # FIXME This is because stop fails with systemd on debian jessie + do_stop do_start ;; stop) diff -Nru targetcli-3.0+git0.7e32595e/targetcli/__init__.py targetcli-3.0~pre4.1~ga55d018/targetcli/__init__.py --- targetcli-3.0+git0.7e32595e/targetcli/__init__.py 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli/__init__.py 2014-12-13 23:01:46.000000000 +0530 @@ -17,7 +17,7 @@ from ui_root import UIRoot -__version__ = 'GIT_VERSION' +__version__ = '3.0.pre4.1~ga55d018' __author__ = "Jerome Martin <j...@risingtidesystems.com>" __url__ = "http://www.risingtidesystems.com" __description__ = "An administration shell for RTS storage targets." diff -Nru targetcli-3.0+git0.7e32595e/targetcli/ui_backstore_legacy.py targetcli-3.0~pre4.1~ga55d018/targetcli/ui_backstore_legacy.py --- targetcli-3.0+git0.7e32595e/targetcli/ui_backstore_legacy.py 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli/ui_backstore_legacy.py 2014-12-13 23:01:46.000000000 +0530 @@ -235,17 +235,8 @@ msg = "%d Storage Object" % no_storage_objects return (msg, None) - def prm_gen_wwn(self, generate_wwn): - generate_wwn = \ - self.ui_eval_param(generate_wwn, 'bool', True) - if generate_wwn: - self.shell.log.info("Generating a wwn serial.") - else: - self.shell.log.info("Not generating a wwn serial.") - return generate_wwn - def prm_buffered(self, buffered): - generate_wwn = \ + buffered = \ self.ui_eval_param(buffered, 'bool', True) if buffered: self.shell.log.info("Using buffered mode.") @@ -331,12 +322,9 @@ ''' RDMCP backstore UI. ''' - def ui_command_create(self, name, size, generate_wwn=None): + def ui_command_create(self, name, size): ''' - Creates an RDMCP storage object. I{size} is the size of the ramdisk, - and the optional I{generate_wwn} parameter is a boolean specifying - whether or not we should generate a T10 wwn Serial for the unit (by - default, yes). + Creates an RDMCP storage object. I{size} is the size of the ramdisk. SIZE SYNTAX =========== @@ -349,8 +337,7 @@ - B{t}, B{T}, B{tB}, B{TB} for TB (terabytes) ''' self.assert_root() - so = RDMCPStorageObject(self.rtsnode, name, size, - self.prm_gen_wwn(generate_wwn)) + so = RDMCPStorageObject(self.rtsnode, name, size) ui_so = UIStorageObjectLegacy(so, self) self.shell.log.info("Created rd_mcp ramdisk %s with size %s." % (name, size)) @@ -361,19 +348,16 @@ ''' FileIO backstore UI. ''' - def ui_command_create(self, name, file_or_dev, size=None, - generate_wwn=None, buffered=None): + def ui_command_create(self, name, file_or_dev, size=None, buffered=None): ''' Creates a FileIO storage object. If I{file_or_dev} is a path to a regular file to be used as backend, then the I{size} parameter is mandatory. Else, if I{file_or_dev} is a path to a block device, the size parameter B{must} be ommited. If present, I{size} is the size of the file to be used, I{file} the path to the file or I{dev} the path to - a block device. The optional I{generate_wwn} parameter is a boolean - specifying whether or not we should generate a T10 wwn Serial for the - unit (by default, yes). The I{buffered} parameter is a boolean stating - whether or not to enable buffered mode. It is disabled by default - (synchronous mode). + a block device. The I{buffered} parameter is a boolean stating + whether or not to enable buffered mode. It is disabled by + default (synchronous mode). SIZE SYNTAX =========== @@ -386,14 +370,13 @@ - B{t}, B{T}, B{tB}, B{TB} for TB (terabytes) ''' self.assert_root() - self.shell.log.debug('Using params size=%s generate_wwn=%s buffered=%s' - % (size, generate_wwn, buffered)) + self.shell.log.debug('Using params size=%s buffered=%s' + % (size, buffered)) is_dev = get_block_type(file_or_dev) is not None \ or is_disk_partition(file_or_dev) if size is None and is_dev: so = FileIOStorageObject(self.rtsnode, name, file_or_dev, - gen_wwn=self.prm_gen_wwn(generate_wwn), buffered_mode=self.prm_buffered(buffered)) self.shell.log.info("Created fileio %s with size %s." % (name, size)) @@ -401,7 +384,6 @@ return self.new_node(ui_so) elif size is not None and not is_dev: so = FileIOStorageObject(self.rtsnode, name, file_or_dev, size, - gen_wwn=self.prm_gen_wwn(generate_wwn), buffered_mode=self.prm_buffered(buffered)) self.shell.log.info("Created fileio storage object %s." % name) ui_so = UIStorageObjectLegacy(so, self) @@ -415,16 +397,13 @@ ''' IBlock backstore UI. ''' - def ui_command_create(self, name, dev, generate_wwn=None): + def ui_command_create(self, name, dev): ''' Creates an IBlock Storage object. I{dev} is the path to the TYPE_DISK - block device to use and the optional I{generate_wwn} parameter is a - boolean specifying whether or not we should generate a T10 wwn Serial - for the unit (by default, yes). + block device to use. ''' self.assert_root() - so = IBlockStorageObject(self.rtsnode, name, dev, - self.prm_gen_wwn(generate_wwn)) + so = IBlockStorageObject(self.rtsnode, name, dev) ui_so = UIStorageObjectLegacy(so, self) self.shell.log.info("Created iblock storage object %s using %s." % (name, dev)) diff -Nru targetcli-3.0+git0.7e32595e/targetcli/ui_backstore.py targetcli-3.0~pre4.1~ga55d018/targetcli/ui_backstore.py --- targetcli-3.0+git0.7e32595e/targetcli/ui_backstore.py 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli/ui_backstore.py 2014-12-13 23:01:46.000000000 +0530 @@ -41,6 +41,7 @@ else: return storage_object.name + class UIBackstores(UINode): ''' The backstores container UI. @@ -57,6 +58,7 @@ UIFileIOBackstore(self) UIIBlockBackstore(self) + class UIBackstore(UINode): ''' A backstore UI. @@ -82,15 +84,6 @@ msg = "%d Storage Object" % no_storage_objects return (msg, None) - def prm_gen_wwn(self, generate_wwn): - generate_wwn = \ - self.ui_eval_param(generate_wwn, 'bool', True) - if generate_wwn: - self.shell.log.info("Generating a wwn serial.") - else: - self.shell.log.info("Not generating a wwn serial.") - return generate_wwn - def prm_buffered(self, buffered): buffered = \ self.ui_eval_param(buffered, 'bool', True) @@ -209,6 +202,7 @@ % (name, dev)) return self.new_node(ui_so) + class UIRDMCPBackstore(UIBackstore): ''' RDMCP backstore UI. @@ -216,12 +210,11 @@ def __init__(self, parent): UIBackstore.__init__(self, 'rd_mcp', parent) - def ui_command_create(self, name, size, generate_wwn=None, nullio=None): + def ui_command_create(self, name, size, nullio=None): ''' Creates an RDMCP storage object. I{size} is the size of the ramdisk, - and the optional I{generate_wwn} parameter is a boolean specifying - whether or not we should generate a T10 wwn Serial for the unit (by - default, yes). + and the optional I{nullio} parameter is a boolean specifying + whether or not we should use a stub nullio instead of a real ramdisk. SIZE SYNTAX =========== @@ -238,9 +231,7 @@ backstore = RDMCPBackstore(self.next_hba_index(), mode='create') nullio = self.ui_eval_param(nullio, 'bool', False) try: - so = RDMCPStorageObject(backstore, name, size, - self.prm_gen_wwn(generate_wwn), - nullio=nullio) + so = RDMCPStorageObject(backstore, name, size, nullio=nullio) except Exception, exception: backstore.delete() @@ -279,7 +270,7 @@ f.close() def ui_command_create(self, name, file_or_dev, size=None, - generate_wwn=None, buffered=None, sparse=None): + buffered=None, sparse=None): ''' Creates a FileIO storage object. If I{file_or_dev} is a path to a @@ -287,9 +278,7 @@ mandatory. Else, if I{file_or_dev} is a path to a block device, the size parameter B{must} be ommited. If present, I{size} is the size of the file to be used, I{file} the path to the file or I{dev} the path to - a block device. The optional I{generate_wwn} parameter is a boolean - specifying whether or not we should generate a T10 wwn Serial for the - unit (by default, yes). The I{buffered} parameter is a boolean stating + a block device. The I{buffered} parameter is a boolean stating whether or not to enable buffered mode. It is enabled by default (asynchronous mode). The I{sparse} parameter is only applicable when creating a new backing file. It is a boolean stating if the @@ -308,9 +297,9 @@ ''' self.assert_root() self.assert_available_so_name(name) - self.shell.log.debug("Using params size=%s generate_wwn=%s buffered=%s" + self.shell.log.debug("Using params size=%s buffered=%s" " sparse=%s" - % (size, generate_wwn, buffered, sparse)) + % (size, buffered, sparse)) sparse = self.ui_eval_param(sparse, 'bool', True) @@ -324,7 +313,6 @@ try: so = FileIOStorageObject( backstore, name, file_or_dev, - gen_wwn=self.prm_gen_wwn(generate_wwn), buffered_mode=self.prm_buffered(buffered)) except Exception, exception: backstore.delete() @@ -341,7 +329,6 @@ so = FileIOStorageObject( backstore, name, file_or_dev, size, - gen_wwn=self.prm_gen_wwn(generate_wwn), buffered_mode=self.prm_buffered(buffered)) except Exception, exception: backstore.delete() @@ -376,19 +363,16 @@ def __init__(self, parent): UIBackstore.__init__(self, 'iblock', parent) - def ui_command_create(self, name, dev, generate_wwn=None): + def ui_command_create(self, name, dev): ''' Creates an IBlock Storage object. I{dev} is the path to the TYPE_DISK - block device to use and the optional I{generate_wwn} parameter is a - boolean specifying whether or not we should generate a T10 wwn Serial - for the unit (by default, yes). + block device to use. ''' self.assert_root() self.assert_available_so_name(name) backstore = IBlockBackstore(self.next_hba_index(), mode='create') try: - so = IBlockStorageObject(backstore, name, dev, - self.prm_gen_wwn(generate_wwn)) + so = IBlockStorageObject(backstore, name, dev) except Exception, exception: backstore.delete() raise exception @@ -438,18 +422,24 @@ errors.append("LEGACY: " + ", ".join(legacy)) size = convert_bytes_to_human(getattr(so, "size", 0)) + if so.status == "activated": + status = "in use" + else: + status = "not in use" nullio_str = "" try: if so.nullio: - nullio_str = " (nullio)" + nullio_str = "nullio" except AttributeError: pass if errors: - msg = ", ".join(errors) + info = ", ".join(errors) if path: - msg += " (%s %s)" % (path, so.status) - return (msg, False) + info += " (%s %s)" % (path, status) + return (info, False) else: - return ("%s %s%s%s" % (path, size, so.status, nullio_str), True) - + info = ", ".join(["%s" % str(data) + for data in (size, path, status, nullio_str) + if data]) + return (info, True) diff -Nru targetcli-3.0+git0.7e32595e/targetcli/ui_node.py targetcli-3.0~pre4.1~ga55d018/targetcli/ui_node.py --- targetcli-3.0+git0.7e32595e/targetcli/ui_node.py 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli/ui_node.py 2014-12-13 23:01:46.000000000 +0530 @@ -20,6 +20,7 @@ from configshell import ConfigNode, ExecutionError from rtslib import RTSLibError, RTSRoot, Config from subprocess import PIPE, Popen +from cli_config import CliConfig from os.path import isfile from os import getuid @@ -107,36 +108,44 @@ self.shell.log.debug("Command %s succeeded." % command) return result + def ui_command_saveconfig(self): + ''' + Saves the whole configuration tree to disk so that it will be restored + on next boot. Unless you do that, changes are lost accross reboots. + ''' + self.assert_root() + try: + input = raw_input("Save configuration? [Y/n]: ") + except EOFError: + input = None + self.shell.con.display('') + if input in ["y", "Y", ""]: + CliConfig.save_running_config() + else: + self.shell.log.warning("Configuration not saved.") + def ui_command_exit(self): ''' Exits the command line interface. ''' if getuid() == 0: - config = Config() - if isfile(STARTUP_CONFIG): - config.load(STARTUP_CONFIG, allow_new_attrs=True) - saved_config = config.dump() - config.load_live() - live_config = config.dump() - if saved_config != live_config: - self.shell.con.display("There are unsaved configuration changes.\n" - "If you exit now, configuration will not " - "be updated and changes will be lost upon " - "reboot.") - try: - input = raw_input("Type 'exit' if you want to exit anyway: ") - except EOFError: - input = None - self.shell.con.display('') - if input == "exit": - return 'EXIT' + self.shell.log.info("Comparing startup and running configs...") + try: + config = Config() + if isfile(STARTUP_CONFIG): + config.load(STARTUP_CONFIG, allow_new_attrs=True) + saved_config = config.dump() + config.load_live() + live_config = config.dump() + if saved_config != live_config: + self.shell.log.info("Some changes need saving.") + self.ui_command_saveconfig() else: - self.shell.log.warning("Aborted exit, use 'saveconfig' to " - "save the current configuration.") - else: - return 'EXIT' - else: - return 'EXIT' + self.shell.log.info("Startup config is up-to-date.") + except Exception, e: + self.shell.log.warning(e) + + return 'EXIT' def ui_command_refresh(self): ''' diff -Nru targetcli-3.0+git0.7e32595e/targetcli/ui_root.py targetcli-3.0~pre4.1~ga55d018/targetcli/ui_root.py --- targetcli-3.0+git0.7e32595e/targetcli/ui_root.py 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli/ui_root.py 2014-12-13 23:01:46.000000000 +0530 @@ -20,8 +20,6 @@ import readline, tempfile from rtslib import RTSRoot, Config from ui_node import UINode, STARTUP_CONFIG -from socket import gethostname -from cli_config import CliConfig from ui_target import UIFabricModule from ui_backstore import UIBackstores from ui_backstore_legacy import UIBackstoresLegacy @@ -48,27 +46,6 @@ self.shell.log.debug("Using fabric module %s." % fabric_module.name) UIFabricModule(fabric_module, self) - def ui_command_saveconfig(self): - ''' - Saves the whole configuration tree to disk so that it will be restored - on next boot. Unless you do that, changes are lost accross reboots. - ''' - self.assert_root() - self.shell.con.display("WARNING: Saving %s current configuration to " - % gethostname() - + "disk will overwrite your boot settings.") - self.shell.con.display("The current target configuration will become " - + "the default boot config.") - try: - input = raw_input("Are you sure? Type 'yes': ") - except EOFError: - input = None - self.shell.con.display('') - if input == "yes": - CliConfig.save_running_config() - else: - self.shell.log.warning("Aborted, startup configuration left untouched.") - def ui_command_configure(self): ''' Enters the config mode. diff -Nru targetcli-3.0+git0.7e32595e/targetcli/ui_target.py targetcli-3.0~pre4.1~ga55d018/targetcli/ui_target.py --- targetcli-3.0+git0.7e32595e/targetcli/ui_target.py 2014-07-31 22:37:30.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli/ui_target.py 2014-12-13 23:01:46.000000000 +0530 @@ -351,7 +351,7 @@ def summary(self): if self.rtsnode.has_feature('nexus'): - description = ("%s" % self.rtsnode.nexus, True) + description = ("nexus WWN %s" % self.rtsnode.nexus_wwn, True) elif self.rtsnode.enable: description = ("enabled", True) else: diff -Nru targetcli-3.0+git0.7e32595e/targetcli.spec targetcli-3.0~pre4.1~ga55d018/targetcli.spec --- targetcli-3.0+git0.7e32595e/targetcli.spec 1970-01-01 05:30:00.000000000 +0530 +++ targetcli-3.0~pre4.1~ga55d018/targetcli.spec 2014-12-13 23:01:46.000000000 +0530 @@ -0,0 +1,54 @@ +%define oname targetcli + +Name: targetcli +License: Apache License 2.0 +Group: Applications/System +Summary: RisingTide Systems generic SCSI target CLI shell. +Version: 3.0.pre4.1~ga55d018 +Release: 1%{?dist} +URL: http://www.risingtidesystems.com/git/ +Source: %{oname}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot +BuildArch: noarch +BuildRequires: python-devel, python-rtslib, python-configshell, python-prettytable +Requires: python-rtslib, python-configshell, python-prettytable +Conflicts: targetcli-frozen, rtsadmin-frozen, rtsadmin, lio-utils +Vendor: Datera, Inc. + +%description +RisingTide Systems generic SCSI target CLI shell. + +%prep +%setup -q -n %{oname}-%{version} + +%build +%{__python} setup.py build + +%install +rm -rf %{buildroot} +%{__python} setup.py install --skip-build --root=%{buildroot} --prefix=usr +mkdir -p %{buildroot}/etc/target +mkdir -p %{buildroot}/var/target/pr +mkdir -p %{buildroot}/var/target/alua +mkdir -p %{buildroot}/etc/init.d/ +mkdir -p %{buildroot}/%{_mandir}/man8 +cp doc/targetcli.8 %{buildroot}/%{_mandir}/man8 +cp scripts/target.init %{buildroot}/etc/init.d/target + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{python_sitelib} +/etc/target +/var/target +/etc/init.d/target +%{_bindir}/targetcli +%{_bindir}/targetcli-ng +%{_mandir}/man8/* +%doc COPYING README.md + +%changelog +* Sat Dec 13 2014 Marc Fleischmann <m...@datera.io> 3.0.pre4.1~ga55d018-1 + - Generated from git commit a55d0180ce19cb9ce4e3276edbf0abc60782e4ea.
signature.asc
Description: OpenPGP digital signature