object-storage: final changes to remove swift diff
Final set of changes to remove the diffs carried to make UFO work with OpenStack Swift. The code is now a complete layering on top of OpenStack Swift where we either "monkey patch" or subclass as necessary. See BZ 870589 (https://bugzilla.redhat.com/show_bug.cgi?id=870589). There are a lot of changes here due for the most part to rearranging the directory hierarchy to have create a proper python module hierarchy under the "gluster" namespace. Plugin references have been removed. The differences that used to be in the swift.diff file are now replaced with server implementations for account, container, object, and proxy that subclass the swift versions. Additionally, the plugins/conf directory has been moved to the "etc" directory, and the plugins/bin directory promoted a level. Unit tests pass. A new setup.py file is provided so that the install process can use it for creating all the necessary python install infrastructure (eggs and paste support). A new RPM spec file is provided which to properly install the new code, and the sample configuration files have been modified to reference the new python egg. Change-Id: I4316c1b66dca80f847fe9b0d583174689c175599 BUG: 870589 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4180 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Mohammed Junaid <junaid@redhat.com> Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
This commit is contained in:
parent
b85ce6f7e1
commit
dd826e28c7
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd test/unit
|
||||
nosetests --exe --with-coverage --cover-package plugins --cover-erase $@
|
||||
nosetests --exe --with-coverage --cover-package gluster --cover-erase $@
|
||||
rm -f .coverage
|
||||
cd -
|
||||
|
@ -3,20 +3,14 @@ via gluster-native/nfs mount to be accessed as containers and objects. It is
|
||||
a plugin for OpenStack Swift project.
|
||||
|
||||
Install
|
||||
* Clone the swift repo from git://github.com/openstack/swift.git
|
||||
* Apply the swift.diff present in glusterfs.git/swift/1.4.8 to the swift repo.
|
||||
* Create a directory named "plugins" under swift.git/swift directory.
|
||||
* Copy the contents of glusterfs.git/swift/1.4.8/plugins/ under swift.git/swift/
|
||||
except the conf directory.
|
||||
* Copy the contents of glusterfs.git/swift/1.4.8/plugins/conf under /etc/swift/.
|
||||
* Run python setup.py install
|
||||
* TBD
|
||||
|
||||
Once this is done, you can access the GlusterFS volumes as Swift accounts.
|
||||
Add the Volume names with the user-name and its corresponding password to the
|
||||
/etc/swift/proxy-server.conf (follow the syntax used in the sample conf file).
|
||||
|
||||
Command to start the servers
|
||||
Command to start the servers (TBD)
|
||||
swift-init main start
|
||||
|
||||
Command to stop the servers
|
||||
Command to stop the servers (TBD)
|
||||
swift-init main stop
|
||||
|
@ -1,7 +1,7 @@
|
||||
[DEFAULT]
|
||||
devices = /mnt/gluster-object
|
||||
mount_check = true
|
||||
bind_port = 6012 # Be sure to keep in sync with /usr/bin/gluster-swift-gen-builders
|
||||
bind_port = 6012
|
||||
user = root
|
||||
log_facility = LOG_LOCAL2
|
||||
|
||||
@ -9,7 +9,7 @@ log_facility = LOG_LOCAL2
|
||||
pipeline = account-server
|
||||
|
||||
[app:account-server]
|
||||
use = egg:swift#account
|
||||
use = egg:gluster_swift_ufo#account
|
||||
|
||||
[account-replicator]
|
||||
vm_test_mode = yes
|
@ -1,7 +1,7 @@
|
||||
[DEFAULT]
|
||||
devices = /mnt/gluster-object
|
||||
mount_check = true
|
||||
bind_port = 6011 # Be sure to keep in sync with /usr/bin/gluster-swift-gen-builders
|
||||
bind_port = 6011
|
||||
user = root
|
||||
log_facility = LOG_LOCAL2
|
||||
|
||||
@ -9,7 +9,7 @@ log_facility = LOG_LOCAL2
|
||||
pipeline = container-server
|
||||
|
||||
[app:container-server]
|
||||
use = egg:swift#container
|
||||
use = egg:gluster_swift_ufo#container
|
||||
|
||||
[container-replicator]
|
||||
vm_test_mode = yes
|
13
swift/1.4.8/etc/fs.conf-gluster
Normal file
13
swift/1.4.8/etc/fs.conf-gluster
Normal file
@ -0,0 +1,13 @@
|
||||
[DEFAULT]
|
||||
# IP address of a GlusterFS volume server member. By default, we assume the
|
||||
# local host.
|
||||
mount_ip = localhost
|
||||
|
||||
# The GlusterFS server need not be local, a remote server can also be used
|
||||
# by setting "remote_cluster = yes".
|
||||
remote_cluster = no
|
||||
|
||||
# By default it is assumed the Gluster volumes can be accessed using other
|
||||
# methods besides UFO (not object only), which disables a caching
|
||||
# optimizations in order to keep in sync with file system changes.
|
||||
object_only = no
|
@ -1,7 +1,7 @@
|
||||
[DEFAULT]
|
||||
devices = /mnt/gluster-object
|
||||
mount_check = true
|
||||
bind_port = 6010 # Be sure to keep in sync with /usr/bin/gluster-swift-gen-builders
|
||||
bind_port = 6010
|
||||
user = root
|
||||
log_facility = LOG_LOCAL2
|
||||
|
||||
@ -9,7 +9,7 @@ log_facility = LOG_LOCAL2
|
||||
pipeline = object-server
|
||||
|
||||
[app:object-server]
|
||||
use = egg:swift#object
|
||||
use = egg:gluster_swift_ufo#object
|
||||
|
||||
[object-replicator]
|
||||
vm_test_mode = yes
|
@ -4,10 +4,10 @@ user = root
|
||||
log_facility = LOG_LOCAL1
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = healthcheck cache tempauth gluster proxy-server
|
||||
pipeline = healthcheck cache tempauth proxy-server
|
||||
|
||||
[app:proxy-server]
|
||||
use = egg:swift#proxy
|
||||
use = egg:gluster_swift_ufo#proxy
|
||||
allow_account_management = true
|
||||
account_autocreate = true
|
||||
|
||||
@ -31,6 +31,3 @@ use = egg:swift#healthcheck
|
||||
|
||||
[filter:cache]
|
||||
use = egg:swift#memcache
|
||||
|
||||
[filter:gluster]
|
||||
use = egg:swift#gluster
|
@ -1,5 +1,4 @@
|
||||
[DEFAULT]
|
||||
Enable_plugin = yes
|
||||
|
||||
|
||||
[swift-hash]
|
@ -4,19 +4,22 @@
|
||||
############################################################################################################
|
||||
# Setting up the environment. #
|
||||
# * Create a directory %{name}-%{version} under $HOME/rpmbuild/SOURCES #
|
||||
# * Copy the contents of plugins directory into $HOME/rpmbuild/SOURCES/%{name}-%{version} #
|
||||
# * Copy the contents of gluster directory into $HOME/rpmbuild/SOURCES/%{name}-%{version} #
|
||||
# * tar zcvf %{name}-%{version}-%{release}.tar.gz $HOME/rpmbuild/SOURCES/%{name}-%{version} %{name}.spec #
|
||||
# For more information refer #
|
||||
# http://fedoraproject.org/wiki/How_to_create_an_RPM_package #
|
||||
############################################################################################################
|
||||
|
||||
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
|
||||
%endif
|
||||
|
||||
%define _confdir /etc/swift
|
||||
%define _swiftdir /usr/lib/python2.6/site-packages/swift
|
||||
%define _ufo_version 1.0
|
||||
%define _ufo_release 12
|
||||
%define _ufo_version 1.1
|
||||
%define _ufo_release 1
|
||||
|
||||
Summary : GlusterFS Unified File and Object Storage.
|
||||
Name : gluster-swift-plugin
|
||||
Name : gluster-swift-ufo
|
||||
Version : %{_ufo_version}
|
||||
Release : %{_ufo_release}
|
||||
Group : Application/File
|
||||
@ -28,7 +31,14 @@ BuildArch: noarch
|
||||
Requires : memcached
|
||||
Requires : openssl
|
||||
Requires : python
|
||||
Requires : gluster-swift
|
||||
#Requires : openstack-swift >= 1.4.8
|
||||
#Requires : openstack-swift-account >= 1.4.8
|
||||
#Requires : openstack-swift-auth >= 1.4.8
|
||||
#Requires : openstack-swift-container >= 1.4.8
|
||||
#Requires : openstack-swift-object >= 1.4.8
|
||||
#Requires : openstack-swift-proxy >= 1.4.8
|
||||
#Obsoletes: gluster-swift
|
||||
#Obsoletes: gluster-swift-plugin
|
||||
|
||||
%description
|
||||
Gluster Unified File and Object Storage unifies NAS and object storage
|
||||
@ -39,33 +49,36 @@ storage costs.
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
|
||||
mkdir -p %{buildroot}/%{_swiftdir}/plugins/middleware
|
||||
mkdir -p %{buildroot}/%{_confdir}/
|
||||
mkdir -p %{buildroot}/%{_bindir}/
|
||||
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
|
||||
|
||||
cp constraints.py %{buildroot}/%{_swiftdir}/plugins
|
||||
cp DiskDir.py %{buildroot}/%{_swiftdir}/plugins
|
||||
cp DiskFile.py %{buildroot}/%{_swiftdir}/plugins
|
||||
cp Glusterfs.py %{buildroot}/%{_swiftdir}/plugins
|
||||
cp __init__.py %{buildroot}/%{_swiftdir}/plugins
|
||||
cp utils.py %{buildroot}/%{_swiftdir}/plugins
|
||||
cp fs_utils.py %{buildroot}/%{_swiftdir}/plugins
|
||||
mkdir -p %{buildroot}/%{_confdir}/
|
||||
cp -r etc/* %{buildroot}/%{_confdir}/
|
||||
|
||||
cp middleware/__init__.py %{buildroot}/%{_swiftdir}/plugins/middleware
|
||||
cp middleware/gluster.py %{buildroot}/%{_swiftdir}/plugins/middleware
|
||||
mkdir -p %{buildroot}/%{_bindir}/
|
||||
cp bin/gluster-swift-gen-builders %{buildroot}/%{_bindir}/
|
||||
|
||||
cp -r conf/* %{buildroot}/%{_confdir}/
|
||||
|
||||
cp bin/gluster-swift-gen-builders %{buildroot}/%{_bindir}/
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%docdir conf
|
||||
%{_swiftdir}/plugins
|
||||
%{python_sitelib}/gluster
|
||||
#%{python_sitelib}/gluster/swift/*.py*
|
||||
#%{python_sitelib}/gluster/swift/common/*.py*
|
||||
#%{python_sitelib}/gluster/swift/common/middleware
|
||||
#%{python_sitelib}/gluster/swift/proxy
|
||||
#%{python_sitelib}/gluster/swift/obj
|
||||
#%{python_sitelib}/gluster/swift/container
|
||||
#%{python_sitelib}/gluster/swift/account
|
||||
%{python_sitelib}/gluster_swift_ufo-%{version}-*.egg-info
|
||||
%{_bindir}/gluster-swift-gen-builders
|
||||
%dir %{_sysconfdir}/swift
|
||||
%config %{_confdir}/account-server/1.conf-gluster
|
||||
%config %{_confdir}/container-server/1.conf-gluster
|
||||
%config %{_confdir}/object-server/1.conf-gluster
|
@ -1,396 +0,0 @@
|
||||
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
|
||||
%endif
|
||||
|
||||
Name: gluster-swift
|
||||
Version: 1.4.8
|
||||
Release: 12%{?dist}
|
||||
Summary: OpenStack Object Storage (swift)
|
||||
|
||||
Group: Development/Languages
|
||||
License: ASL 2.0
|
||||
URL: http://launchpad.net/swift
|
||||
Source0: http://launchpad.net/swift/essex/%{version}/+download/swift-%{version}.tar.gz
|
||||
Source1: %{name}-functions
|
||||
Source2: %{name}-account.init
|
||||
Source4: %{name}-container.init
|
||||
Source5: %{name}-object.init
|
||||
Source6: %{name}-proxy.init
|
||||
Patch0: openstack-swift-newdeps.patch
|
||||
Patch1: openstack-swift-docmod.patch
|
||||
Patch2: openstack-swift-nonet.patch
|
||||
Patch3: gluster.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/swift-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: dos2unix
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-setuptools
|
||||
BuildRequires: python-netifaces
|
||||
BuildRequires: python-paste-deploy
|
||||
Requires: python-configobj
|
||||
Requires: python-eventlet >= 0.9.8
|
||||
Requires: python-greenlet >= 0.3.1
|
||||
Requires: python-paste-deploy
|
||||
Requires: python-simplejson
|
||||
Requires: python-webob1.0
|
||||
Requires: pyxattr
|
||||
Requires: python-setuptools
|
||||
Requires: python-netifaces
|
||||
Requires: python-netifaces
|
||||
|
||||
Conflicts: openstack-swift
|
||||
|
||||
Requires(post): chkconfig
|
||||
Requires(postun): initscripts
|
||||
Requires(preun): chkconfig
|
||||
Requires(pre): shadow-utils
|
||||
Obsoletes: openstack-swift-auth <= 1.4.0
|
||||
|
||||
%description
|
||||
OpenStack Object Storage (swift) aggregates commodity servers to work together
|
||||
in clusters for reliable, redundant, and large-scale storage of static objects.
|
||||
Objects are written to multiple hardware devices in the data center, with the
|
||||
OpenStack software responsible for ensuring data replication and integrity
|
||||
across the cluster. Storage clusters can scale horizontally by adding new nodes,
|
||||
which are automatically configured. Should a node fail, OpenStack works to
|
||||
replicate its content from other active nodes. Because OpenStack uses software
|
||||
logic to ensure data replication and distribution across different devices,
|
||||
inexpensive commodity hard drives and servers can be used in lieu of more
|
||||
expensive equipment.
|
||||
|
||||
%package account
|
||||
Summary: A swift account server
|
||||
Group: Applications/System
|
||||
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description account
|
||||
OpenStack Object Storage (swift) aggregates commodity servers to work together
|
||||
in clusters for reliable, redundant, and large-scale storage of static objects.
|
||||
|
||||
This package contains the %{name} account server.
|
||||
|
||||
%package container
|
||||
Summary: A swift container server
|
||||
Group: Applications/System
|
||||
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description container
|
||||
OpenStack Object Storage (swift) aggregates commodity servers to work together
|
||||
in clusters for reliable, redundant, and large-scale storage of static objects.
|
||||
|
||||
This package contains the %{name} container server.
|
||||
|
||||
%package object
|
||||
Summary: A swift object server
|
||||
Group: Applications/System
|
||||
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: rsync >= 3.0
|
||||
|
||||
%description object
|
||||
OpenStack Object Storage (swift) aggregates commodity servers to work together
|
||||
in clusters for reliable, redundant, and large-scale storage of static objects.
|
||||
|
||||
This package contains the %{name} object server.
|
||||
|
||||
%package proxy
|
||||
Summary: A swift proxy server
|
||||
Group: Applications/System
|
||||
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description proxy
|
||||
OpenStack Object Storage (swift) aggregates commodity servers to work together
|
||||
in clusters for reliable, redundant, and large-scale storage of static objects.
|
||||
|
||||
This package contains the %{name} proxy server.
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for %{name}
|
||||
Group: Documentation
|
||||
#%if 0%{?rhel} >= 6
|
||||
#BuildRequires: python-sphinx10 >= 1.0
|
||||
#%endif
|
||||
%if 0%{?fedora} >= 14
|
||||
BuildRequires: python-sphinx >= 1.0
|
||||
%endif
|
||||
# Required for generating docs
|
||||
BuildRequires: python-eventlet
|
||||
BuildRequires: python-simplejson
|
||||
BuildRequires: python-webob1.0
|
||||
BuildRequires: pyxattr
|
||||
|
||||
%description doc
|
||||
OpenStack Object Storage (swift) aggregates commodity servers to work together
|
||||
in clusters for reliable, redundant, and large-scale storage of static objects.
|
||||
|
||||
This package contains documentation files for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n swift-%{version}
|
||||
%patch0 -p1 -b .newdeps
|
||||
%patch1 -p1 -b .docmod
|
||||
%patch2 -p1 -b .nonet
|
||||
%patch3 -p1 -b .gluster
|
||||
# Fix wrong-file-end-of-line-encoding warning
|
||||
dos2unix LICENSE
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
# Fails unless we create the build directory
|
||||
mkdir -p doc/build
|
||||
# Build docs
|
||||
%if 0%{?fedora} >= 14
|
||||
%{__python} setup.py build_sphinx
|
||||
%endif
|
||||
#%if 0%{?rhel} >= 6
|
||||
#export PYTHONPATH="$( pwd ):$PYTHONPATH"
|
||||
#SPHINX_DEBUG=1 sphinx-1.0-build -b html doc/source doc/build/html
|
||||
#SPHINX_DEBUG=1 sphinx-1.0-build -b man doc/source doc/build/man
|
||||
#%endif
|
||||
# Fix hidden-file-or-dir warning
|
||||
#rm doc/build/html/.buildinfo
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
|
||||
# Init helper functions
|
||||
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_datarootdir}/%{name}/functions
|
||||
# Init scripts
|
||||
install -p -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}-account
|
||||
install -p -D -m 755 %{SOURCE4} %{buildroot}%{_initrddir}/%{name}-container
|
||||
install -p -D -m 755 %{SOURCE5} %{buildroot}%{_initrddir}/%{name}-object
|
||||
install -p -D -m 755 %{SOURCE6} %{buildroot}%{_initrddir}/%{name}-proxy
|
||||
# Remove tests
|
||||
rm -fr %{buildroot}/%{python_sitelib}/test
|
||||
# Misc other
|
||||
install -d -m 755 %{buildroot}%{_sysconfdir}/swift
|
||||
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/account-server
|
||||
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/container-server
|
||||
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/object-server
|
||||
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/proxy-server
|
||||
# Install pid directory
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/account-server
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/container-server
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/object-server
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/proxy-server
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%pre
|
||||
getent group swift >/dev/null || groupadd -r swift -g 160
|
||||
getent passwd swift >/dev/null || \
|
||||
useradd -r -g swift -u 160 -d %{_sharedstatedir}/swift -s /sbin/nologin \
|
||||
-c "OpenStack Swift Daemons" swift
|
||||
exit 0
|
||||
|
||||
%post account
|
||||
/sbin/chkconfig --add %{name}-account
|
||||
|
||||
%preun account
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service %{name}-account stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}-account
|
||||
fi
|
||||
|
||||
%postun account
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service %{name}-account condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post container
|
||||
/sbin/chkconfig --add %{name}-container
|
||||
|
||||
%preun container
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service %{name}-container stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}-container
|
||||
fi
|
||||
|
||||
%postun container
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service %{name}-container condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post object
|
||||
/sbin/chkconfig --add %{name}-object
|
||||
|
||||
%preun object
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service %{name}-object stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}-object
|
||||
fi
|
||||
|
||||
%postun object
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service %{name}-object condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post proxy
|
||||
/sbin/chkconfig --add %{name}-proxy
|
||||
|
||||
%preun proxy
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service %{name}-proxy stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}-proxy
|
||||
fi
|
||||
|
||||
%postun proxy
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service %{name}-proxy condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS LICENSE README
|
||||
%doc etc/dispersion.conf-sample etc/drive-audit.conf-sample etc/object-expirer.conf-sample
|
||||
%doc etc/swift.conf-sample
|
||||
%dir %{_datarootdir}/%{name}/functions
|
||||
%dir %attr(0755, swift, swift) %{_localstatedir}/run/swift
|
||||
%dir %{_sysconfdir}/swift
|
||||
%dir %{python_sitelib}/swift
|
||||
%{_bindir}/swift
|
||||
%{_bindir}/swift-account-audit
|
||||
%{_bindir}/swift-bench
|
||||
%{_bindir}/swift-drive-audit
|
||||
%{_bindir}/swift-get-nodes
|
||||
%{_bindir}/swift-init
|
||||
%{_bindir}/swift-ring-builder
|
||||
%{_bindir}/swift-dispersion-populate
|
||||
%{_bindir}/swift-dispersion-report
|
||||
%{_bindir}/swift-recon*
|
||||
%{_bindir}/swift-object-expirer
|
||||
%{_bindir}/swift-oldies
|
||||
%{_bindir}/swift-orphans
|
||||
%{_bindir}/swift-form-signature
|
||||
%{_bindir}/swift-temp-url
|
||||
%{python_sitelib}/swift/*.py*
|
||||
%{python_sitelib}/swift/common
|
||||
%{python_sitelib}/swift-%{version}-*.egg-info
|
||||
|
||||
%files account
|
||||
%defattr(-,root,root,-)
|
||||
%doc etc/account-server.conf-sample
|
||||
%dir %{_initrddir}/%{name}-account
|
||||
%dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/account-server
|
||||
%dir %{_sysconfdir}/swift/account-server
|
||||
%{_bindir}/swift-account-auditor
|
||||
%{_bindir}/swift-account-reaper
|
||||
%{_bindir}/swift-account-replicator
|
||||
%{_bindir}/swift-account-server
|
||||
%{python_sitelib}/swift/account
|
||||
|
||||
|
||||
%files container
|
||||
%defattr(-,root,root,-)
|
||||
%doc etc/container-server.conf-sample
|
||||
%dir %{_initrddir}/%{name}-container
|
||||
%dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/container-server
|
||||
%dir %{_sysconfdir}/swift/container-server
|
||||
%{_bindir}/swift-container-auditor
|
||||
%{_bindir}/swift-container-server
|
||||
%{_bindir}/swift-container-replicator
|
||||
%{_bindir}/swift-container-updater
|
||||
%{_bindir}/swift-container-sync
|
||||
%{python_sitelib}/swift/container
|
||||
|
||||
%files object
|
||||
%defattr(-,root,root,-)
|
||||
%doc etc/object-server.conf-sample etc/rsyncd.conf-sample
|
||||
%dir %{_initrddir}/%{name}-object
|
||||
%dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/object-server
|
||||
%dir %{_sysconfdir}/swift/object-server
|
||||
%{_bindir}/swift-object-auditor
|
||||
%{_bindir}/swift-object-info
|
||||
%{_bindir}/swift-object-replicator
|
||||
%{_bindir}/swift-object-server
|
||||
%{_bindir}/swift-object-updater
|
||||
%{python_sitelib}/swift/obj
|
||||
|
||||
%files proxy
|
||||
%defattr(-,root,root,-)
|
||||
%doc etc/proxy-server.conf-sample
|
||||
%dir %{_initrddir}/%{name}-proxy
|
||||
%dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/proxy-server
|
||||
%dir %{_sysconfdir}/swift/proxy-server
|
||||
%{_bindir}/swift-proxy-server
|
||||
%{python_sitelib}/swift/proxy
|
||||
|
||||
%files doc
|
||||
%defattr(-,root,root,-)
|
||||
%doc LICENSE
|
||||
#%doc doc/build/html
|
||||
|
||||
%changelog
|
||||
* Thu Apr 26 2012 Anthony Towns <atowns@redhat.com> 1.4.8-2
|
||||
- Apply gluster patches
|
||||
- Rename to gluster-swift
|
||||
|
||||
* Thu Mar 22 2012 Alan Pevec <apevec@redhat.com> 1.4.8-1
|
||||
- Update to 1.4.8
|
||||
|
||||
* Fri Mar 09 2012 Alan Pevec <apevec@redhat.com> 1.4.7-1
|
||||
- Update to 1.4.7
|
||||
|
||||
* Mon Feb 13 2012 Alan Pevec <apevec@redhat.com> 1.4.6-1
|
||||
- Update to 1.4.6
|
||||
|
||||
* Thu Jan 12 2012 Alan Pevec <apevec@redhat.com> 1.4.4-2
|
||||
- add back /var/run/swift for el6
|
||||
|
||||
* Wed Jan 04 2012 Alan Pevec <apevec@redhat.com> 1.4.4-1
|
||||
- Use updated parallel install versions of epel packages (pbrady)
|
||||
- Ensure the docs aren't built with the system glance module (pbrady)
|
||||
- Ensure we don't access the net when building docs (pbrady)
|
||||
- Update to 1.4.4
|
||||
|
||||
* Wed Nov 23 2011 David Nalley <david@gnsa.us> -1.4.3-2
|
||||
* fixed some missing requires
|
||||
|
||||
* Sat Nov 05 2011 David Nalley <david@gnsa.us> - 1.4.3-1
|
||||
- Update to 1.4.3
|
||||
- fix init script add, registration, deletion BZ 685155
|
||||
- fixing BR to facilitate epel6 building
|
||||
|
||||
* Tue Aug 23 2011 David Nalley <david@gnsa.us> - 1.4.0-2
|
||||
- adding uid:gid for bz 732693
|
||||
|
||||
* Wed Jun 22 2011 David Nalley <david@gnsa.us> - 1.4.1-1
|
||||
- Update to 1.4.0
|
||||
- change the name of swift binary from st to swift
|
||||
|
||||
* Sat Jun 04 2011 David Nalley <david@gnsa.us> - 1.4.0-1
|
||||
- Update to 1.4.0
|
||||
|
||||
* Fri May 20 2011 David Nalley <david@gnsa.us> - 1.3.0-1
|
||||
- Update to 1.3.0
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Sun Dec 05 2010 Silas Sewell <silas@sewell.ch> - 1.1.0-1
|
||||
- Update to 1.1.0
|
||||
|
||||
* Sun Aug 08 2010 Silas Sewell <silas@sewell.ch> - 1.0.2-5
|
||||
- Update for new Python macro guidelines
|
||||
- Use dos2unix instead of sed
|
||||
- Make gecos field more descriptive
|
||||
|
||||
* Wed Jul 28 2010 Silas Sewell <silas@sewell.ch> - 1.0.2-4
|
||||
- Rename to openstack-swift
|
||||
|
||||
* Wed Jul 28 2010 Silas Sewell <silas@sewell.ch> - 1.0.2-3
|
||||
- Fix return value in swift-functions
|
||||
|
||||
* Tue Jul 27 2010 Silas Sewell <silas@sewell.ch> - 1.0.2-2
|
||||
- Add swift user
|
||||
- Update init scripts
|
||||
|
||||
* Sun Jul 18 2010 Silas Sewell <silas@sewell.ch> - 1.0.2-1
|
||||
- Initial build
|
18
swift/1.4.8/gluster/swift/__init__.py
Normal file
18
swift/1.4.8/gluster/swift/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
""" Gluster Swift UFO """
|
||||
|
||||
class Version(object):
|
||||
def __init__(self, canonical_version, final):
|
||||
self.canonical_version = canonical_version
|
||||
self.final = final
|
||||
|
||||
@property
|
||||
def pretty_version(self):
|
||||
if self.final:
|
||||
return self.canonical_version
|
||||
else:
|
||||
return '%s-dev' % (self.canonical_version,)
|
||||
|
||||
|
||||
_version = Version('1.1', True)
|
||||
__version__ = _version.pretty_version
|
||||
__canonical_version__ = _version.canonical_version
|
45
swift/1.4.8/gluster/swift/account/server.py
Normal file
45
swift/1.4.8/gluster/swift/account/server.py
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright (c) 2012 Red Hat, 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.
|
||||
|
||||
""" Account Server for Gluster Swift UFO """
|
||||
|
||||
# Simply importing this monkey patches the constraint handling to fit our
|
||||
# needs
|
||||
import gluster.swift.common.constraints
|
||||
|
||||
from swift.account import server
|
||||
from gluster.swift.common.DiskDir import DiskAccount
|
||||
|
||||
|
||||
class AccountController(server.AccountController):
|
||||
def _get_account_broker(self, drive, part, account):
|
||||
"""
|
||||
Overriden to provide the GlusterFS specific broker that talks to
|
||||
Gluster for the information related to servicing a given request
|
||||
instead of talking to a database.
|
||||
|
||||
:param drive: drive that holds the container
|
||||
:param part: partition the container is in
|
||||
:param account: account name
|
||||
:returns: DiskDir object
|
||||
"""
|
||||
return DiskAccount(self.root, account, self.logger)
|
||||
|
||||
|
||||
def app_factory(global_conf, **local_conf):
|
||||
"""paste.deploy app factory for creating WSGI account server apps."""
|
||||
conf = global_conf.copy()
|
||||
conf.update(local_conf)
|
||||
return AccountController(conf)
|
@ -15,14 +15,15 @@
|
||||
|
||||
import os, errno
|
||||
|
||||
from swift.plugins.utils import clean_metadata, dir_empty, rmdirs, mkdirs, \
|
||||
validate_account, validate_container, is_marker, get_container_details, \
|
||||
get_account_details, get_container_metadata, create_container_metadata, \
|
||||
create_account_metadata, DEFAULT_GID, DEFAULT_UID, validate_object, \
|
||||
create_object_metadata, read_metadata, write_metadata, X_CONTENT_TYPE, \
|
||||
X_CONTENT_LENGTH, X_TIMESTAMP, X_PUT_TIMESTAMP, X_TYPE, X_ETAG, \
|
||||
X_OBJECTS_COUNT, X_BYTES_USED, X_CONTAINER_COUNT, CONTAINER
|
||||
from swift.plugins import Glusterfs
|
||||
from gluster.swift.common.utils import clean_metadata, dir_empty, rmdirs, \
|
||||
mkdirs, validate_account, validate_container, is_marker, \
|
||||
get_container_details, get_account_details, get_container_metadata, \
|
||||
create_container_metadata, create_account_metadata, DEFAULT_GID, \
|
||||
DEFAULT_UID, validate_object, create_object_metadata, read_metadata, \
|
||||
write_metadata, X_CONTENT_TYPE, X_CONTENT_LENGTH, X_TIMESTAMP, \
|
||||
X_PUT_TIMESTAMP, X_TYPE, X_ETAG, X_OBJECTS_COUNT, X_BYTES_USED, \
|
||||
X_CONTAINER_COUNT, CONTAINER
|
||||
from gluster.swift.common import Glusterfs
|
||||
|
||||
from swift.common.constraints import CONTAINER_LISTING_LIMIT
|
||||
from swift.common.utils import normalize_timestamp, TRUE_VALUES
|
@ -18,13 +18,13 @@ from eventlet import tpool
|
||||
from tempfile import mkstemp
|
||||
from contextlib import contextmanager
|
||||
from swift.common.utils import normalize_timestamp, renamer
|
||||
from swift.plugins.utils import mkdirs, rmdirs, validate_object, \
|
||||
from gluster.swift.common.utils import mkdirs, rmdirs, validate_object, \
|
||||
create_object_metadata, do_open, do_close, do_unlink, do_chown, \
|
||||
do_stat, do_listdir, read_metadata, write_metadata
|
||||
from swift.plugins.utils import X_CONTENT_TYPE, X_CONTENT_LENGTH, X_TIMESTAMP, \
|
||||
X_PUT_TIMESTAMP, X_TYPE, X_ETAG, X_OBJECTS_COUNT, X_BYTES_USED, \
|
||||
X_OBJECT_TYPE, FILE, DIR, MARKER_DIR, OBJECT, DIR_TYPE, FILE_TYPE, \
|
||||
DEFAULT_UID, DEFAULT_GID
|
||||
from gluster.swift.common.utils import X_CONTENT_TYPE, X_CONTENT_LENGTH, \
|
||||
X_TIMESTAMP, X_PUT_TIMESTAMP, X_TYPE, X_ETAG, X_OBJECTS_COUNT, \
|
||||
X_BYTES_USED, X_OBJECT_TYPE, FILE, DIR, MARKER_DIR, OBJECT, DIR_TYPE, \
|
||||
FILE_TYPE, DEFAULT_UID, DEFAULT_GID
|
||||
|
||||
import logging
|
||||
from swift.obj.server import DiskFile
|
@ -16,22 +16,17 @@ import logging
|
||||
import os, fcntl, time
|
||||
from ConfigParser import ConfigParser
|
||||
from swift.common.utils import TRUE_VALUES
|
||||
from swift.plugins.fs_utils import mkdirs
|
||||
from gluster.swift.common.fs_utils import mkdirs
|
||||
|
||||
|
||||
#
|
||||
# Read the fs.conf file once at startup (module load)
|
||||
#
|
||||
_fs_conf = ConfigParser()
|
||||
AUTH_ACCOUNT = 'auth'
|
||||
MOUNT_IP = 'localhost'
|
||||
REMOTE_CLUSTER = False
|
||||
OBJECT_ONLY = False
|
||||
if _fs_conf.read(os.path.join('/etc/swift', 'fs.conf')):
|
||||
try:
|
||||
AUTH_ACCOUNT = _fs_conf.get('DEFAULT', 'auth_account', 'auth')
|
||||
except (NoSectionError, NoOptionError):
|
||||
pass
|
||||
try:
|
||||
MOUNT_IP = _fs_conf.get('DEFAULT', 'mount_ip', 'localhost')
|
||||
except (NoSectionError, NoOptionError):
|
@ -16,7 +16,7 @@
|
||||
from webob.exc import HTTPBadRequest
|
||||
|
||||
import swift.common.constraints
|
||||
from swift.plugins import Glusterfs
|
||||
from gluster.swift.common import Glusterfs
|
||||
|
||||
|
||||
MAX_OBJECT_NAME_COMPONENT_LENGTH = swift.common.constraints.constraints_conf_int(
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# Noop Middleware that simply allows us to monkey patch the constraints
|
||||
import swift.plugins.constraints
|
||||
import gluster.swift.common.constraints
|
||||
|
||||
class Gluster(object):
|
||||
"""
|
@ -21,8 +21,8 @@ from hashlib import md5
|
||||
import cPickle as pickle
|
||||
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
|
||||
from swift.common.utils import normalize_timestamp, TRUE_VALUES
|
||||
from swift.plugins.fs_utils import *
|
||||
from swift.plugins import Glusterfs
|
||||
from gluster.swift.common.fs_utils import *
|
||||
from gluster.swift.common import Glusterfs
|
||||
|
||||
X_CONTENT_TYPE = 'Content-Type'
|
||||
X_CONTENT_LENGTH = 'Content-Length'
|
||||
@ -455,21 +455,3 @@ def create_container_metadata(cont_path, memcache=None):
|
||||
def create_account_metadata(acc_path, memcache=None):
|
||||
metadata = get_account_metadata(acc_path, memcache)
|
||||
return restore_metadata(acc_path, metadata)
|
||||
|
||||
|
||||
_DEFAULT_GLUSTER_ENABLED = os.getenv('GLUSTER_UNIT_TEST_ENABLED', 'no')
|
||||
__swift_conf = ConfigParser()
|
||||
__swift_conf.read(os.path.join('/etc/swift', 'swift.conf'))
|
||||
try:
|
||||
_gluster_enabled_val = __swift_conf.get('DEFAULT', 'Enable_plugin', _DEFAULT_GLUSTER_ENABLED)
|
||||
except NoOptionError, NoSectionError:
|
||||
_gluster_enabled_val = _DEFAULT_GLUSTER_ENABLED
|
||||
del __swift_conf
|
||||
_gluster_enabled = _gluster_enabled_val in TRUE_VALUES
|
||||
|
||||
def Gluster_enabled():
|
||||
return _gluster_enabled
|
||||
|
||||
if _gluster_enabled:
|
||||
# Monkey patch only when Gluster enabled
|
||||
import swift.plugins.constraints
|
0
swift/1.4.8/gluster/swift/container/__init__.py
Normal file
0
swift/1.4.8/gluster/swift/container/__init__.py
Normal file
46
swift/1.4.8/gluster/swift/container/server.py
Normal file
46
swift/1.4.8/gluster/swift/container/server.py
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2012 Red Hat, 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.
|
||||
|
||||
""" Container Server for Gluster Swift UFO """
|
||||
|
||||
# Simply importing this monkey patches the constraint handling to fit our
|
||||
# needs
|
||||
import gluster.swift.common.constraints
|
||||
|
||||
from swift.container import server
|
||||
from gluster.swift.common.DiskDir import DiskDir
|
||||
|
||||
|
||||
class ContainerController(server.ContainerController):
|
||||
def _get_container_broker(self, drive, part, account, container):
|
||||
"""
|
||||
Overriden to provide the GlusterFS specific broker that talks to
|
||||
Gluster for the information related to servicing a given request
|
||||
instead of talking to a database.
|
||||
|
||||
:param drive: drive that holds the container
|
||||
:param part: partition the container is in
|
||||
:param account: account name
|
||||
:param container: container name
|
||||
:returns: DiskDir object
|
||||
"""
|
||||
return DiskDir(self.root, account, container, self.logger)
|
||||
|
||||
|
||||
def app_factory(global_conf, **local_conf):
|
||||
"""paste.deploy app factory for creating WSGI container server apps."""
|
||||
conf = global_conf.copy()
|
||||
conf.update(local_conf)
|
||||
return ContainerController(conf)
|
0
swift/1.4.8/gluster/swift/obj/__init__.py
Normal file
0
swift/1.4.8/gluster/swift/obj/__init__.py
Normal file
33
swift/1.4.8/gluster/swift/obj/server.py
Normal file
33
swift/1.4.8/gluster/swift/obj/server.py
Normal file
@ -0,0 +1,33 @@
|
||||
# Copyright (c) 2012 Red Hat, 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.
|
||||
|
||||
""" Object Server for Gluster Swift UFO """
|
||||
|
||||
# Simply importing this monkey patches the constraint handling to fit our
|
||||
# needs
|
||||
import gluster.swift.common.constraints
|
||||
|
||||
from swift.obj import server
|
||||
from gluster.swift.common.DiskFile import Gluster_DiskFile
|
||||
|
||||
# Monkey patch the object server module to use Gluster's DiskFile definition
|
||||
server.DiskFile = Gluster_DiskFile
|
||||
|
||||
|
||||
def app_factory(global_conf, **local_conf):
|
||||
"""paste.deploy app factory for creating WSGI object server apps"""
|
||||
conf = global_conf.copy()
|
||||
conf.update(local_conf)
|
||||
return server.ObjectController(conf)
|
0
swift/1.4.8/gluster/swift/proxy/__init__.py
Normal file
0
swift/1.4.8/gluster/swift/proxy/__init__.py
Normal file
27
swift/1.4.8/gluster/swift/proxy/server.py
Normal file
27
swift/1.4.8/gluster/swift/proxy/server.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (c) 2012 Red Hat, 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.
|
||||
|
||||
|
||||
# Simply importing this monkey patches the constraint handling to fit our
|
||||
# needs
|
||||
import gluster.swift.common.constraints
|
||||
|
||||
from swift.proxy import server
|
||||
|
||||
def app_factory(global_conf, **local_conf):
|
||||
"""paste.deploy app factory for creating WSGI proxy apps."""
|
||||
conf = global_conf.copy()
|
||||
conf.update(local_conf)
|
||||
return server.Application(conf)
|
@ -1,8 +0,0 @@
|
||||
[DEFAULT]
|
||||
auth_account = auth
|
||||
#ip of the fs server.
|
||||
mount_ip = localhost
|
||||
#fs server need not be local, remote server can also be used,
|
||||
#set remote_cluster=yes for using remote server.
|
||||
remote_cluster = no
|
||||
object_only = no
|
57
swift/1.4.8/setup.py
Normal file
57
swift/1.4.8/setup.py
Normal file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright (c) 2012 Red Hat, 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.
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
from gluster.swift import __canonical_version__ as version
|
||||
|
||||
|
||||
name = 'gluster_swift_ufo'
|
||||
|
||||
|
||||
setup(
|
||||
name=name,
|
||||
version=version,
|
||||
description='Gluster Swift/UFO',
|
||||
license='Apache License (2.0)',
|
||||
author='Red Hat, Inc.',
|
||||
author_email='gluster-users@gluster.org',
|
||||
url='https://gluster.org/',
|
||||
packages=find_packages(exclude=['test', 'bin']),
|
||||
test_suite='nose.collector',
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Environment :: No Input/Output (Daemon)',
|
||||
],
|
||||
install_requires=[], # removed for better compat
|
||||
scripts=[
|
||||
'bin/gluster-swift-gen-builders',
|
||||
],
|
||||
entry_points={
|
||||
'paste.app_factory': [
|
||||
'proxy=gluster.swift.proxy.server:app_factory',
|
||||
'object=gluster.swift.obj.server:app_factory',
|
||||
'container=gluster.swift.container.server:app_factory',
|
||||
'account=gluster.swift.account.server:app_factory',
|
||||
],
|
||||
'paste.filter_factory': [
|
||||
'gluster=gluster.swift.common.middleware.gluster:filter_factory',
|
||||
],
|
||||
},
|
||||
)
|
@ -1,174 +0,0 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index d195d34..ef625ff 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright (c) 2010-2012 OpenStack, LLC.
|
||||
+# Copyright (c) 2012 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -94,6 +95,7 @@ setup(
|
||||
'tempurl=swift.common.middleware.tempurl:filter_factory',
|
||||
'formpost=swift.common.middleware.formpost:filter_factory',
|
||||
'name_check=swift.common.middleware.name_check:filter_factory',
|
||||
+ 'gluster=swift.plugins.middleware.gluster:filter_factory',
|
||||
],
|
||||
},
|
||||
)
|
||||
diff --git a/swift/account/server.py b/swift/account/server.py
|
||||
index 800b3c0..eaf9e0d 100644
|
||||
--- a/swift/account/server.py
|
||||
+++ b/swift/account/server.py
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright (c) 2010-2012 OpenStack, LLC.
|
||||
+# Copyright (c) 2012 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +30,10 @@ from webob.exc import HTTPAccepted, HTTPBadRequest, \
|
||||
HTTPPreconditionFailed, HTTPConflict
|
||||
import simplejson
|
||||
|
||||
+from swift.plugins.utils import Gluster_enabled
|
||||
+if Gluster_enabled():
|
||||
+ from swift.plugins.DiskDir import DiskAccount
|
||||
+
|
||||
from swift.common.db import AccountBroker
|
||||
from swift.common.utils import get_logger, get_param, hash_path, \
|
||||
normalize_timestamp, split_path, storage_directory
|
||||
@@ -54,6 +59,8 @@ class AccountController(object):
|
||||
conf.get('auto_create_account_prefix') or '.'
|
||||
|
||||
def _get_account_broker(self, drive, part, account):
|
||||
+ if Gluster_enabled():
|
||||
+ return DiskAccount(self.root, account, self.logger)
|
||||
hsh = hash_path(account)
|
||||
db_dir = storage_directory(DATADIR, part, hsh)
|
||||
db_path = os.path.join(self.root, drive, db_dir, hsh + '.db')
|
||||
diff --git a/swift/container/server.py b/swift/container/server.py
|
||||
index 8a18cfd..3da0f95 100644
|
||||
--- a/swift/container/server.py
|
||||
+++ b/swift/container/server.py
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright (c) 2010-2012 OpenStack, LLC.
|
||||
+# Copyright (c) 2012 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +30,10 @@ from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPConflict, \
|
||||
HTTPCreated, HTTPInternalServerError, HTTPNoContent, \
|
||||
HTTPNotFound, HTTPPreconditionFailed, HTTPMethodNotAllowed
|
||||
|
||||
+from swift.plugins.utils import Gluster_enabled
|
||||
+if Gluster_enabled():
|
||||
+ from swift.plugins.DiskDir import DiskDir
|
||||
+
|
||||
from swift.common.db import ContainerBroker
|
||||
from swift.common.utils import get_logger, get_param, hash_path, \
|
||||
normalize_timestamp, storage_directory, split_path, validate_sync_to
|
||||
@@ -73,6 +78,8 @@ class ContainerController(object):
|
||||
:param container: container name
|
||||
:returns: ContainerBroker object
|
||||
"""
|
||||
+ if Gluster_enabled():
|
||||
+ return DiskDir(self.root, account, container, self.logger)
|
||||
hsh = hash_path(account, container)
|
||||
db_dir = storage_directory(DATADIR, part, hsh)
|
||||
db_path = os.path.join(self.root, drive, db_dir, hsh + '.db')
|
||||
diff --git a/swift/obj/server.py b/swift/obj/server.py
|
||||
index 9cca16b..448ea5c 100644
|
||||
--- a/swift/obj/server.py
|
||||
+++ b/swift/obj/server.py
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright (c) 2010-2012 OpenStack, LLC.
|
||||
+# Copyright (c) 2012 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -35,6 +36,8 @@ from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPCreated, \
|
||||
from xattr import getxattr, setxattr
|
||||
from eventlet import sleep, Timeout, tpool
|
||||
|
||||
+from swift.plugins.utils import Gluster_enabled
|
||||
+
|
||||
from swift.common.utils import mkdirs, normalize_timestamp, \
|
||||
storage_directory, hash_path, renamer, fallocate, \
|
||||
split_path, drop_buffer_cache, get_logger, write_pickle
|
||||
@@ -340,6 +343,10 @@ class DiskFile(object):
|
||||
raise DiskFileNotExist('Data File does not exist.')
|
||||
|
||||
|
||||
+if Gluster_enabled():
|
||||
+ from swift.plugins.DiskFile import Gluster_DiskFile
|
||||
+
|
||||
+
|
||||
class ObjectController(object):
|
||||
"""Implements the WSGI application for the Swift Object Server."""
|
||||
|
||||
@@ -378,6 +385,15 @@ class ObjectController(object):
|
||||
self.expiring_objects_container_divisor = \
|
||||
int(conf.get('expiring_objects_container_divisor') or 86400)
|
||||
|
||||
+ def get_DiskFile_obj(self, path, device, partition, account, container, obj,
|
||||
+ logger, keep_data_fp=False, disk_chunk_size=65536):
|
||||
+ if Gluster_enabled():
|
||||
+ return Gluster_DiskFile(path, device, partition, account, container,
|
||||
+ obj, logger, keep_data_fp, disk_chunk_size)
|
||||
+ else:
|
||||
+ return DiskFile(path, device, partition, account, container,
|
||||
+ obj, logger, keep_data_fp, disk_chunk_size)
|
||||
+
|
||||
def async_update(self, op, account, container, obj, host, partition,
|
||||
contdevice, headers_out, objdevice):
|
||||
"""
|
||||
@@ -493,7 +509,7 @@ class ObjectController(object):
|
||||
content_type='text/plain')
|
||||
if self.mount_check and not check_mount(self.devices, device):
|
||||
return Response(status='507 %s is not mounted' % device)
|
||||
- file = DiskFile(self.devices, device, partition, account, container,
|
||||
+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container,
|
||||
obj, self.logger, disk_chunk_size=self.disk_chunk_size)
|
||||
|
||||
if 'X-Delete-At' in file.metadata and \
|
||||
@@ -548,7 +564,7 @@ class ObjectController(object):
|
||||
if new_delete_at and new_delete_at < time.time():
|
||||
return HTTPBadRequest(body='X-Delete-At in past', request=request,
|
||||
content_type='text/plain')
|
||||
- file = DiskFile(self.devices, device, partition, account, container,
|
||||
+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container,
|
||||
obj, self.logger, disk_chunk_size=self.disk_chunk_size)
|
||||
orig_timestamp = file.metadata.get('X-Timestamp')
|
||||
upload_expiration = time.time() + self.max_upload_time
|
||||
@@ -626,9 +642,9 @@ class ObjectController(object):
|
||||
content_type='text/plain')
|
||||
if self.mount_check and not check_mount(self.devices, device):
|
||||
return Response(status='507 %s is not mounted' % device)
|
||||
- file = DiskFile(self.devices, device, partition, account, container,
|
||||
- obj, self.logger, keep_data_fp=True,
|
||||
- disk_chunk_size=self.disk_chunk_size)
|
||||
+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container,
|
||||
+ obj, self.logger, keep_data_fp=True,
|
||||
+ disk_chunk_size=self.disk_chunk_size)
|
||||
if file.is_deleted() or ('X-Delete-At' in file.metadata and
|
||||
int(file.metadata['X-Delete-At']) <= time.time()):
|
||||
if request.headers.get('if-match') == '*':
|
||||
@@ -702,7 +718,7 @@ class ObjectController(object):
|
||||
return resp
|
||||
if self.mount_check and not check_mount(self.devices, device):
|
||||
return Response(status='507 %s is not mounted' % device)
|
||||
- file = DiskFile(self.devices, device, partition, account, container,
|
||||
+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container,
|
||||
obj, self.logger, disk_chunk_size=self.disk_chunk_size)
|
||||
if file.is_deleted() or ('X-Delete-At' in file.metadata and
|
||||
int(file.metadata['X-Delete-At']) <= time.time()):
|
||||
@@ -744,7 +760,7 @@ class ObjectController(object):
|
||||
if self.mount_check and not check_mount(self.devices, device):
|
||||
return Response(status='507 %s is not mounted' % device)
|
||||
response_class = HTTPNoContent
|
||||
- file = DiskFile(self.devices, device, partition, account, container,
|
||||
+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container,
|
||||
obj, self.logger, disk_chunk_size=self.disk_chunk_size)
|
||||
if 'x-if-delete-at' in request.headers and \
|
||||
int(request.headers['x-if-delete-at']) != \
|
0
swift/1.4.8/test/unit/common/__init__.py
Normal file
0
swift/1.4.8/test/unit/common/__init__.py
Normal file
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
""" Tests for plugins.utils """
|
||||
""" Tests for common.utils """
|
||||
|
||||
import os
|
||||
import unittest
|
||||
@ -26,7 +26,7 @@ import tarfile
|
||||
import shutil
|
||||
from collections import defaultdict
|
||||
from swift.common.utils import normalize_timestamp
|
||||
from swift.plugins import utils
|
||||
from gluster.swift.common import utils
|
||||
|
||||
#
|
||||
# Somewhat hacky way of emulating the operation of xattr calls. They are made
|
||||
@ -119,7 +119,7 @@ class SimMemcache(object):
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
""" Tests for plugins.utils """
|
||||
""" Tests for common.utils """
|
||||
|
||||
def setUp(self):
|
||||
_initxattr()
|
||||
@ -753,7 +753,7 @@ class TestUtils(unittest.TestCase):
|
||||
|
||||
def test_get_container_details_from_fs(self):
|
||||
td = tempfile.mkdtemp()
|
||||
tf = tarfile.open("plugins/data/account_tree.tar.bz2", "r:bz2")
|
||||
tf = tarfile.open("common/data/account_tree.tar.bz2", "r:bz2")
|
||||
orig_cwd = os.getcwd()
|
||||
os.chdir(td)
|
||||
tf.extractall()
|
||||
@ -776,7 +776,7 @@ class TestUtils(unittest.TestCase):
|
||||
|
||||
def test_get_account_details_from_fs(self):
|
||||
td = tempfile.mkdtemp()
|
||||
tf = tarfile.open("plugins/data/container_tree.tar.bz2", "r:bz2")
|
||||
tf = tarfile.open("common/data/container_tree.tar.bz2", "r:bz2")
|
||||
orig_cwd = os.getcwd()
|
||||
os.chdir(td)
|
||||
tf.extractall()
|
Loading…
x
Reference in New Issue
Block a user