commit 055344e3dd0e69e35e727d489a4c0da0e35f272832ac184cc8e6e3ab89a8c65c Author: Nathan Cutler Date: Thu Nov 15 09:30:18 2018 +0000 osc copypac from project:filesystems:ceph:nautilus package:ceph-iscsi revision:1 OBS-URL: https://build.opensuse.org/package/show/filesystems:ceph/ceph-iscsi?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/README-checkin.txt b/README-checkin.txt new file mode 100644 index 0000000..fb8d410 --- /dev/null +++ b/README-checkin.txt @@ -0,0 +1,6 @@ +Use the "checkin.sh" script to generate ceph.spec and tarball from a git repo +and branch. For example: + + $ bash checkin.sh --repo https://github.com/foo/ceph-iscsi-config --branch wip-foo + +For more options, try "./checkin.sh --help" diff --git a/ceph-iscsi-3.0.tar.gz b/ceph-iscsi-3.0.tar.gz new file mode 100644 index 0000000..373f24a --- /dev/null +++ b/ceph-iscsi-3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:386756ef9b0382c3117ef1cfed8fd52088c7bdb906d8386608f144b16384f9c2 +size 2323715 diff --git a/ceph-iscsi.changes b/ceph-iscsi.changes new file mode 100644 index 0000000..b647d33 --- /dev/null +++ b/ceph-iscsi.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Wed Nov 14 14:15:52 UTC 2018 - ncutler@suse.com + +- Initial commit, based on SUSE/ceph-iscsi.git SHA1 965c0df7ae3330fd078b1c659d4abdec24402cf5 + (upstream 0b9046105d900ca03249d044ce759c12efa5a016) diff --git a/ceph-iscsi.spec b/ceph-iscsi.spec new file mode 100644 index 0000000..a8f456a --- /dev/null +++ b/ceph-iscsi.spec @@ -0,0 +1,164 @@ +# +# spec file for package ceph-iscsi +# +# Copyright (C) 2017-2018 The Ceph iSCSI Project Developers. See +# COPYING file at the top-level directory of this distribution and at +# https://github.com/ceph/ceph-iscsi/blob/master/COPYING +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. +# +# This file is under the GNU General Public License, version 3 or any +# later version. +# +# Please submit bugfixes or comments via http://tracker.ceph.com/ +# +%if 0%{?fedora} || 0%{?rhel} +%global _remote_tarball_prefix https://github.com/ceph/ceph-iscsi/archive/%{version}/ +%endif + +Name: ceph-iscsi +Version: 3.0 +Release: 1%{?dist} +Group: System/Filesystems +Summary: Python modules for Ceph iSCSI gateway configuration management + +License: GPL-3.0-or-later +URL: https://github.com/ceph/ceph-iscsi +Source0: %{?_remote_tarball_prefix}%{name}-%{version}.tar.gz +%if 0%{?suse_version} +Source98: checkin.sh +Source99: README-checkin.txt +%endif + + +BuildArch: noarch + +Obsoletes: ceph-iscsi-config +Obsoletes: ceph-iscsi-cli + +%if 0%{?fedora} || 0%{?rhel} +Requires: python-rados >= 10.2.2 +Requires: python-rbd >= 10.2.2 +Requires: python-netifaces >= 0.10.4 +Requires: python-rtslib >= 2.1.fb67 +Requires: rpm-python >= 4.11 +Requires: python-crypto >= 2.6 +Requires: python-flask >= 0.10.1 +BuildRequires: python-devel +BuildRequires: python-setuptools +%endif +%if 0%{?suse_version} +Requires: python3-rados >= 10.2.2 +Requires: python3-rbd >= 10.2.2 +Requires: python3-netifaces >= 0.10.4 +Requires: python3-rtslib >= 2.1.fb67 +Requires: python3-rpm >= 4.11 +Requires: python3-crypto >= 2.6 +Requires: python3-flask >= 0.10.1 +BuildRequires: python-rpm-macros +BuildRequires: fdupes +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%endif + +BuildRequires: systemd + +%description +Python package providing the modules used to handle the configuration of an +iSCSI gateway, backed by Ceph RBD. The RPM installs configuration management +logic (ceph_iscsi_config modules), an rbd-target-gw systemd service, and +a CLI-based management tool 'gwcli', replacing the 'targetcli' tool. + +The configuration management modules may be are consumed by custom Ansible +playbooks and the rbd-target-gw daemon. + +The rbd-target-gw service is responsible for startup and shutdown actions, +replacing the 'target' service used in standalone LIO implementations. +In addition, rbd-target-gw also provides a REST API utilized by the Ceph +dashboard and gwcli tool, and a prometheus exporter for gateway LIO +performance statistics, supporting monitoring and visualisation tools like +Grafana. + +%prep +%setup -q + +%build +%if 0%{?fedora} || 0%{?rhel} +%{__python2} setup.py build +%endif +%if 0%{?suse_version} +%python3_build +%endif + +%install +%if 0%{?fedora} || 0%{?rhel} +%{__python2} setup.py install -O1 --skip-build --root %{buildroot} --install-scripts %{_bindir} +%endif +%if 0%{?suse_version} +%python3_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif +mkdir -p %{buildroot}%{_unitdir} +install -m 0644 .%{_unitdir}/rbd-target-gw.service %{buildroot}%{_unitdir} +install -m 0644 .%{_unitdir}/rbd-target-api.service %{buildroot}%{_unitdir} +mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/rbd-target-gw.service.d +install -m 0644 .%{_sysconfdir}/systemd/system/rbd-target-gw.service.d/dependencies.conf %{buildroot}%{_sysconfdir}/systemd/system/rbd-target-gw.service.d/ +mkdir -p %{buildroot}%{_mandir}/man8 +install -m 0644 gwcli.8 %{buildroot}%{_mandir}/man8/ +gzip %{buildroot}%{_mandir}/man8/gwcli.8 + +%post +%if 0%{?fedora} || 0%{?rhel} +/bin/systemctl --system daemon-reload &> /dev/null || : +/bin/systemctl --system enable rbd-target-gw &> /dev/null || : +/bin/systemctl --system enable rbd-target-api &> /dev/null || : +%endif +%if 0%{?suse_version} +%service_add_post rbd-target-gw.service +%service_add_post rbd-target-api.service +%endif + +%pre +%if 0%{?suse_version} +%service_add_pre rbd-target-gw.service +%service_add_pre rbd-target-api.service +%endif + +%postun +%if 0%{?fedora} || 0%{?rhel} +/bin/systemctl --system daemon-reload &> /dev/null || : +%endif +%if 0%{?suse_version} +%service_del_postun rbd-target-gw.service +%service_del_postun rbd-target-api.service +%endif + +%preun +%if 0%{?suse_version} +%service_del_preun rbd-target-gw.service +%service_del_preun rbd-target-api.service +%endif + +%files -n ceph-iscsi +%license LICENSE +%license COPYING +%doc README +%doc iscsi-gateway.cfg_sample +%if 0%{?fedora} || 0%{?rhel} +%{python2_sitelib}/* +%endif +%if 0%{?suse_version} +%{python3_sitelib}/* +%endif +%{_bindir}/gwcli +%{_bindir}/rbd-target-gw +%{_bindir}/rbd-target-api +%{_unitdir}/rbd-target-gw.service +%{_unitdir}/rbd-target-api.service +%{_sysconfdir}/systemd/system/rbd-target-gw.service.d +%{_mandir}/man8/gwcli.8.gz + +%changelog + diff --git a/checkin.sh b/checkin.sh new file mode 100644 index 0000000..e82ac3f --- /dev/null +++ b/checkin.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# +# checkin.sh +# +# This script automates generation of a new tarball and spec file from a +# git clone or repo+branch combination for the "ceph-iscsi" package +# in OBS. +# + +set -x + +PROJECT="ceph-iscsi" +DEFAULT_REPO="https://github.com/SUSE/$PROJECT.git" +DEFAULT_BRANCH="ses6" +BASEDIR=$(pwd) + +function usage { + set +x + echo "Usage:" + echo " ${0} [-h,--help] [-e,--existing CLONE]" + echo " [-r,--repo REPO] [-b,--branch BRANCH]" + echo "" + echo "Options:" + echo " --existing Use existing ceph clone CLONE" + echo " --repo Make a fresh clone of ceph repo REPO" + echo " --branch Use branch BRANCH with fresh clone" + echo "" + echo "Notes:" + echo " If existing clone is given, repo and branch are ignored." + echo " Repo defaults to $DEFAULT_REPO" + echo " Branch defaults to $DEFAULT_BRANCH" + exit 1 +} + +function _error_exit { + echo >&2 $1 + exit $2 +} + +function _check_clone { + local OPT="$1" + if [ -z "$OPT" ] ; then + _error_exit "Empty string sent to internal function _check_clone" + fi + if [ -e "$OPT/$PROJECT.spec" ] ; then + echo "$OPT looks like a $PROJECT clone; using it" + else + _error_exit "$OPT does not appear to be a $PROJECT clone" 1 + fi +} + +GETOPT=$(getopt -o b:e:hr: --long "branch:,existing:,help,repo:" \ + -n 'checkin.sh' -- "$@") +test "$?" -eq 0 || _error_exit "Terminating..." 1 +eval set -- "$GETOPT" + +REPO="$DEFAULT_REPO" +BRANCH="$DEFAULT_BRANCH" +while true ; do + case "$1" in + -b|--branch) BRANCH="$2" ; shift 2 ;; + -h|--help) usage ;; # does not return + -r|--repo) REPO="$2" ; shift 2 ;; + --) shift ; break ;; + *) echo "Internal error" ; exit 1 ;; + esac +done + +echo "Will make pristine, temporary clone of repo ->$REPO<- branch ->$BRANCH<-" +#TMPDIR=$(mktemp -d --tmpdir=$BASEDIR) +TMPDIR=$(mktemp -d) +TMPDIR+="/clone" +mkdir $TMPDIR +echo "Created temporary temporary $TMPDIR" +git clone --branch $BRANCH $REPO $TMPDIR +CLONE="$TMPDIR" +_check_clone "$CLONE" + +echo "Running \"osc rm *gz\" to nuke previous tarball" +if type osc > /dev/null 2>&1 ; then + osc rm *gz +else + _error_exit "osc not installed - cannot continue" 1 +fi +if stat --printf='' *.gz 2>/dev/null ; then + _error_exit "There are still files ending in gz in the current directory - clean up yourself!" 1 +fi + +THIS_DIR=$(pwd) +pushd $CLONE +if [ ! -d .git ]; then + echo "no .git present. run this from the base dir of the git checkout." + exit 1 +fi +echo "Extracting spec file" +cp $PROJECT.spec $THIS_DIR +VERSION=$(grep ^Version *spec | sed -r "s/^Version:\s+//") +echo "Version number is ->$VERSION<-" +cd .. +mv clone "$PROJECT-$VERSION" +echo "Creating tarball" +tar cvfz $THIS_DIR/$PROJECT-$VERSION.tar.gz "$PROJECT-$VERSION" +popd + +#echo "Running \"osc add *gz\" to register the new tarball" +#osc add *gz + +if [ -n "$TMPDIR" ] ; then + echo "Nuking the temporary clone" + rm -rf $TMPDIR +fi + +#echo "Running pre_checkin.sh (if you touch the ceph.changes file after running this script, re-run pre_checkin.sh manually)" +#if [ -f "pre_checkin.sh" ] ; then +# bash pre_checkin.sh +#else +# echo "WARNING: no pre_checkin.sh script found!" +#fi + +echo "Done! Run \"osc ci --noservice\" to commit."