changing references of gluster to swiftonfile

Renamed files and directories as well as replaced
infile references to gluster where appropriate

Signed-off-by: Thiago da Silva <thiago@redhat.com>
This commit is contained in:
Thiago da Silva 2014-07-07 13:33:40 -04:00
parent 67c77c1be9
commit de24352275
30 changed files with 104 additions and 116 deletions

View File

@ -20,7 +20,7 @@ import pprint
import os import os
import json import json
from optparse import OptionParser from optparse import OptionParser
from gluster.swift.common.utils import read_metadata from swiftonfile.swift.common.utils import read_metadata
# Parser Setup # Parser Setup
USAGE = "Usage: %prog [options] OBJECT" USAGE = "Usage: %prog [options] OBJECT"

View File

@ -30,7 +30,7 @@ disable_fallocate = true
pipeline = object-server pipeline = object-server
[app:object-server] [app:object-server]
use = egg:gluster_swift#object use = egg:swiftonfile#object
user = root user = root
log_facility = LOG_LOCAL2 log_facility = LOG_LOCAL2
log_level = WARN log_level = WARN

View File

@ -40,5 +40,5 @@ effect."
fi fi
echo "Successfully configured Apache as frontend for Swift." echo "Successfully configured Apache as frontend for Swift."
echo "Make sure GlusterFS volume is mounted at /mnt/gluster-object/<vol-name> \ echo "Make sure GlusterFS volume is mounted at /mnt/swiftonfile/<vol-name> \
before starting httpd" before starting httpd"

View File

@ -21,7 +21,7 @@ from optparse import OptionParser
if __name__ == '__main__': if __name__ == '__main__':
# check if swift is installed # check if swift is installed
try: try:
from gluster.swift.common.Glusterfs import get_mnt_point, unmount from swiftonfile.swift.common.Glusterfs import get_mnt_point, unmount
except ImportError: except ImportError:
import sys import sys
sys.exit("Openstack Swift does not appear to be installed properly") sys.exit("Openstack Swift does not appear to be installed properly")

View File

@ -3,7 +3,7 @@
# Simple script to create RPMs for G4S # Simple script to create RPMs for G4S
## RPM NAME ## RPM NAME
RPMNAME=glusterfs-openstack-swift RPMNAME=swiftonfile
cleanup() cleanup()
{ {

View File

@ -1,7 +1,7 @@
# Simple program to save all package information # Simple program to save all package information
# into a file which can be sourced by a bash script # into a file which can be sourced by a bash script
from gluster.swift import _pkginfo as pkginfo from swiftonfile.swift import _pkginfo as pkginfo
PKGCONFIG = 'pkgconfig.in' PKGCONFIG = 'pkgconfig.in'

View File

@ -14,17 +14,17 @@
# limitations under the License. # limitations under the License.
from setuptools import setup, find_packages from setuptools import setup, find_packages
from gluster.swift import _pkginfo from swiftonfile.swift import _pkginfo
setup( setup(
name=_pkginfo.name, name=_pkginfo.name,
version=_pkginfo.full_version, version=_pkginfo.full_version,
description='Gluster For Swift', description='SwiftOnfile',
license='Apache License (2.0)', license='Apache License (2.0)',
author='Red Hat, Inc.', author='Red Hat, Inc.',
author_email='gluster-users@gluster.org', author_email='gluster-users@gluster.org',
url='http://launchpad.net/gluster-swift', url='https://github.com/swiftonfile/swiftonfile',
packages=find_packages(exclude=['test', 'bin']), packages=find_packages(exclude=['test', 'bin']),
test_suite='nose.collector', test_suite='nose.collector',
classifiers=[ classifiers=[
@ -41,11 +41,11 @@ setup(
], ],
install_requires=[], install_requires=[],
scripts=[ scripts=[
'bin/gluster-swift-print-metadata', 'bin/swiftonfile-print-metadata',
], ],
entry_points={ entry_points={
'paste.app_factory': [ 'paste.app_factory': [
'object=gluster.swift.obj.server:app_factory', 'object=swiftonfile.swift.obj.server:app_factory',
], ],
}, },
) )

View File

@ -8,12 +8,12 @@
%{!?_name:%define _name __PKG_NAME__} %{!?_name:%define _name __PKG_NAME__}
%{!?_release:%define _release __PKG_RELEASE__} %{!?_release:%define _release __PKG_RELEASE__}
Summary : GlusterFS Integration with OpenStack Object Storage (Swift). Summary : SwiftOnFile enables Swift objects to be accessed as files.
Name : %{_name} Name : %{_name}
Version : %{_version} Version : %{_version}
Release : %{_release}%{?dist} Release : %{_release}%{?dist}
Group : Application/File Group : Application/File
URL : http://launchpad.net/gluster-swift URL : https://github.com/swiftonfile/swiftonfile
Vendor : Fedora Project Vendor : Fedora Project
Source0 : %{_name}-%{_version}-%{_release}.tar.gz Source0 : %{_name}-%{_version}-%{_release}.tar.gz
License : ASL 2.0 License : ASL 2.0
@ -46,7 +46,7 @@ as top-level directories of volumes, where accounts are mapped one-to-one to
gluster volumes. gluster volumes.
%prep %prep
%setup -q -n gluster_swift-%{_version} %setup -q -n swiftonfile-%{_version}
%build %build
%{__python} setup.py build %{__python} setup.py build
@ -68,23 +68,11 @@ done
# Remove tests # Remove tests
%{__rm} -rf %{buildroot}/%{python_sitelib}/test %{__rm} -rf %{buildroot}/%{python_sitelib}/test
# Remove files provided by glusterfs-api
%{__rm} -rf %{buildroot}/%{python_sitelib}/gluster/__init__.p*
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%{python_sitelib}/gluster %{python_sitelib}/swiftonfile
%{python_sitelib}/gluster_swift-%{_version}_*.egg-info %{python_sitelib}/swiftonfile-%{_version}_*.egg-info
%{_bindir}/gluster-swift-gen-builders %{_bindir}/swiftonfile-print-metadata
%{_bindir}/gluster-swift-print-metadata
%{_bindir}/gswauth-add-account
%{_bindir}/gswauth-add-user
%{_bindir}/gswauth-cleanup-tokens
%{_bindir}/gswauth-delete-account
%{_bindir}/gswauth-delete-user
%{_bindir}/gswauth-list
%{_bindir}/gswauth-prep
%{_bindir}/gswauth-set-account-service
%{_mandir}/man8/* %{_mandir}/man8/*
%dir %{_confdir} %dir %{_confdir}

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
""" Gluster for Swift """ """ SwiftOnFile """
class PkgInfo(object): class PkgInfo(object):
@ -45,6 +45,6 @@ class PkgInfo(object):
### ###
### Change the Package version here ### Change the Package version here
### ###
_pkginfo = PkgInfo('1.13.1', '0', 'gluster_swift', False) _pkginfo = PkgInfo('1.13.1', '0', 'swiftonfile', False)
__version__ = _pkginfo.pretty_version __version__ = _pkginfo.pretty_version
__canonical_version__ = _pkginfo.canonical_version __canonical_version__ = _pkginfo.canonical_version

View File

@ -22,8 +22,8 @@ import urllib
from ConfigParser import ConfigParser, NoSectionError, NoOptionError from ConfigParser import ConfigParser, NoSectionError, NoOptionError
from swift.common.utils import TRUE_VALUES from swift.common.utils import TRUE_VALUES
from gluster.swift.common.fs_utils import do_ismount from swiftonfile.swift.common.fs_utils import do_ismount
from gluster.swift.common.exceptions import FailureToMountError from swiftonfile.swift.common.exceptions import FailureToMountError
# #
# Read the fs.conf file once at startup (module load) # Read the fs.conf file once at startup (module load)

View File

@ -25,7 +25,7 @@ from itertools import repeat
import ctypes import ctypes
from eventlet import sleep from eventlet import sleep
from swift.common.utils import load_libc_function from swift.common.utils import load_libc_function
from gluster.swift.common.exceptions import FileOrDirNotFoundError, \ from swiftonfile.swift.common.exceptions import FileOrDirNotFoundError, \
NotDirectoryError, GlusterFileSystemOSError NotDirectoryError, GlusterFileSystemOSError
from swift.common.exceptions import DiskFileNoSpace from swift.common.exceptions import DiskFileNoSpace

View File

@ -21,9 +21,9 @@ import logging
from hashlib import md5 from hashlib import md5
from eventlet import sleep from eventlet import sleep
import cPickle as pickle import cPickle as pickle
from gluster.swift.common.exceptions import GlusterFileSystemIOError from swiftonfile.swift.common.exceptions import GlusterFileSystemIOError
from swift.common.exceptions import DiskFileNoSpace from swift.common.exceptions import DiskFileNoSpace
from gluster.swift.common.fs_utils import do_stat, \ from swiftonfile.swift.common.fs_utils import do_stat, \
do_walk, do_rmdir, do_log_rl, get_filename_from_fd, do_open, \ do_walk, do_rmdir, do_log_rl, get_filename_from_fd, do_open, \
do_getxattr, do_setxattr, do_removexattr, do_read, \ do_getxattr, do_setxattr, do_removexattr, do_read, \
do_close, do_dup, do_lseek, do_fstat, do_fsync, do_rename do_close, do_dup, do_lseek, do_fstat, do_fsync, do_rename

View File

@ -28,7 +28,7 @@ from hashlib import md5
from eventlet import sleep from eventlet import sleep
from greenlet import getcurrent from greenlet import getcurrent
from contextlib import contextmanager from contextlib import contextmanager
from gluster.swift.common.exceptions import AlreadyExistsAsFile, \ from swiftonfile.swift.common.exceptions import AlreadyExistsAsFile, \
AlreadyExistsAsDir AlreadyExistsAsDir
from swift.common.utils import TRUE_VALUES, ThreadPool, hash_path, \ from swift.common.utils import TRUE_VALUES, ThreadPool, hash_path, \
normalize_timestamp normalize_timestamp
@ -37,14 +37,14 @@ from swift.common.exceptions import DiskFileNotExist, DiskFileError, \
DiskFileExpired DiskFileExpired
from swift.common.swob import multi_range_iterator from swift.common.swob import multi_range_iterator
from gluster.swift.common.exceptions import GlusterFileSystemOSError from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
from gluster.swift.common.fs_utils import do_fstat, do_open, do_close, \ from swiftonfile.swift.common.fs_utils import do_fstat, do_open, do_close, \
do_unlink, do_chown, do_fsync, do_fchown, do_stat, do_write, do_read, \ do_unlink, do_chown, do_fsync, do_fchown, do_stat, do_write, do_read, \
do_fadvise64, do_rename, do_fdatasync, do_lseek, do_mkdir do_fadvise64, do_rename, do_fdatasync, do_lseek, do_mkdir
from gluster.swift.common.utils import read_metadata, write_metadata, \ from swiftonfile.swift.common.utils import read_metadata, write_metadata, \
validate_object, create_object_metadata, rmobjdir, dir_is_object, \ validate_object, create_object_metadata, rmobjdir, dir_is_object, \
get_object_metadata, write_pickle get_object_metadata, write_pickle
from gluster.swift.common.utils import X_CONTENT_TYPE, \ from swiftonfile.swift.common.utils import X_CONTENT_TYPE, \
X_TIMESTAMP, X_TYPE, X_OBJECT_TYPE, FILE, OBJECT, DIR_TYPE, \ X_TIMESTAMP, X_TYPE, X_OBJECT_TYPE, FILE, OBJECT, DIR_TYPE, \
FILE_TYPE, DEFAULT_UID, DEFAULT_GID, DIR_NON_OBJECT, DIR_OBJECT, \ FILE_TYPE, DEFAULT_UID, DEFAULT_GID, DIR_NON_OBJECT, DIR_OBJECT, \
X_ETAG, X_CONTENT_LENGTH X_ETAG, X_CONTENT_LENGTH
@ -561,7 +561,7 @@ class DiskFile(object):
Object names ending or beginning with a '/' as in /a, a/, /a/b/, Object names ending or beginning with a '/' as in /a, a/, /a/b/,
etc, or object names with multiple consecutive slahes, like a//b, etc, or object names with multiple consecutive slahes, like a//b,
are not supported. The proxy server's contraints filter are not supported. The proxy server's contraints filter
gluster.common.constrains.gluster_check_object_creation() should swiftonfile.common.constrains.sof_check_object_creation() should
reject such requests. reject such requests.
:param mgr: associated on-disk manager instance :param mgr: associated on-disk manager instance

View File

@ -15,16 +15,16 @@
""" Object Server for Gluster for Swift """ """ Object Server for Gluster for Swift """
import gluster.swift.common.constraints # noqa import swiftonfile.swift.common.constraints # noqa
from swift.common.swob import HTTPConflict from swift.common.swob import HTTPConflict
from swift.common.utils import public, timing_stats from swift.common.utils import public, timing_stats
from gluster.swift.common.exceptions import AlreadyExistsAsFile, \ from swiftonfile.swift.common.exceptions import AlreadyExistsAsFile, \
AlreadyExistsAsDir AlreadyExistsAsDir
from swift.common.request_helpers import split_and_validate_path from swift.common.request_helpers import split_and_validate_path
from swift.obj import server from swift.obj import server
from gluster.swift.obj.diskfile import DiskFileManager from swiftonfile.swift.obj.diskfile import DiskFileManager
class ObjectController(server.ObjectController): class ObjectController(server.ObjectController):
@ -64,7 +64,7 @@ class ObjectController(server.ObjectController):
def PUT(self, request): def PUT(self, request):
try: try:
server.check_object_creation = \ server.check_object_creation = \
gluster.swift.common.constraints.sof_check_object_creation swiftonfile.swift.common.constraints.sof_check_object_creation
return server.ObjectController.PUT(self, request) return server.ObjectController.PUT(self, request)
except (AlreadyExistsAsFile, AlreadyExistsAsDir): except (AlreadyExistsAsFile, AlreadyExistsAsDir):
device = \ device = \

View File

@ -19,7 +19,7 @@ import time
import StringIO import StringIO
import mock import mock
from tempfile import mkdtemp from tempfile import mkdtemp
import gluster.swift.common.Glusterfs as gfs import swiftonfile.swift.common.Glusterfs as gfs
def mock_os_path_ismount_false(path): def mock_os_path_ismount_false(path):
return False return False
@ -92,7 +92,7 @@ class TestGlusterfs(unittest.TestCase):
def test_mount(self): def test_mount(self):
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'test' drive = 'test'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
@ -104,7 +104,7 @@ class TestGlusterfs(unittest.TestCase):
def test_mount_egain(self): def test_mount_egain(self):
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'test' drive = 'test'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
@ -117,7 +117,7 @@ class TestGlusterfs(unittest.TestCase):
def test_mount_get_export_list_err(self): def test_mount_get_export_list_err(self):
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'test3' drive = 'test3'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
@ -132,7 +132,7 @@ class TestGlusterfs(unittest.TestCase):
""" """
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'test' drive = 'test'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
@ -150,7 +150,7 @@ class TestGlusterfs(unittest.TestCase):
""" """
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'test' drive = 'test'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
@ -166,7 +166,7 @@ class TestGlusterfs(unittest.TestCase):
def test_invalid_drive_name(self): def test_invalid_drive_name(self):
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'te st' drive = 'te st'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
@ -178,14 +178,14 @@ class TestGlusterfs(unittest.TestCase):
def test_already_mounted(self): def test_already_mounted(self):
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile')
drive = 'test' drive = 'test'
_init_mock_variables(tmpdir) _init_mock_variables(tmpdir)
def mock_do_ismount(path): def mock_do_ismount(path):
return True return True
with mock.patch("gluster.swift.common.Glusterfs.do_ismount", with mock.patch("swiftonfile.swift.common.Glusterfs.do_ismount",
mock_do_ismount): mock_do_ismount):
self.assertTrue(gfs.mount(root, drive)) self.assertTrue(gfs.mount(root, drive))
finally: finally:
@ -195,7 +195,7 @@ class TestGlusterfs(unittest.TestCase):
def test_get_export_list(self): def test_get_export_list(self):
try: try:
tmpdir = mkdtemp() tmpdir = mkdtemp()
root = os.path.join(tmpdir, 'mnt/gluster-object') root = os.path.join(tmpdir, 'mnt/swiftonfile-object')
drive = 'test' drive = 'test'
# undo mocking of _get_export_list # undo mocking of _get_export_list

View File

@ -15,7 +15,7 @@
import unittest import unittest
from mock import Mock, patch from mock import Mock, patch
from gluster.swift.common import constraints as cnt from swiftonfile.swift.common import constraints as cnt
def mock_check_object_creation(*args, **kwargs): def mock_check_object_creation(*args, **kwargs):
@ -41,7 +41,7 @@ class TestConstraints(unittest.TestCase):
self.assertTrue(cnt.validate_obj_name_component('')) self.assertTrue(cnt.validate_obj_name_component(''))
def test_sof_check_object_creation(self): def test_sof_check_object_creation(self):
with patch('gluster.swift.common.constraints.swift_check_object_creation', with patch('swiftonfile.swift.common.constraints.swift_check_object_creation',
mock_check_object_creation): mock_check_object_creation):
req = Mock() req = Mock()
req.headers = [] req.headers = []

View File

@ -22,8 +22,8 @@ from nose import SkipTest
from mock import patch, Mock from mock import patch, Mock
from time import sleep from time import sleep
from tempfile import mkdtemp, mkstemp from tempfile import mkdtemp, mkstemp
from gluster.swift.common import fs_utils as fs from swiftonfile.swift.common import fs_utils as fs
from gluster.swift.common.exceptions import NotDirectoryError, \ from swiftonfile.swift.common.exceptions import NotDirectoryError, \
FileOrDirNotFoundError, GlusterFileSystemOSError FileOrDirNotFoundError, GlusterFileSystemOSError
from swift.common.exceptions import DiskFileNoSpace from swift.common.exceptions import DiskFileNoSpace

View File

@ -26,8 +26,8 @@ import tarfile
import shutil import shutil
from collections import defaultdict from collections import defaultdict
from mock import patch from mock import patch
from gluster.swift.common import utils, Glusterfs from swiftonfile.swift.common import utils, Glusterfs
from gluster.swift.common.exceptions import GlusterFileSystemOSError from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
from swift.common.exceptions import DiskFileNoSpace from swift.common.exceptions import DiskFileNoSpace
# #
@ -466,7 +466,7 @@ class TestUtils(unittest.TestCase):
try: try:
fpp = os.path.join(td, 'pp') fpp = os.path.join(td, 'pp')
# FIXME: Remove this patch when coverage.py can handle eventlet # FIXME: Remove this patch when coverage.py can handle eventlet
with patch("gluster.swift.common.fs_utils.do_fsync", with patch("swiftonfile.swift.common.fs_utils.do_fsync",
_mock_os_fsync): _mock_os_fsync):
utils.write_pickle('pickled peppers', fpp) utils.write_pickle('pickled peppers', fpp)
with open(fpp, "rb") as f: with open(fpp, "rb") as f:
@ -483,7 +483,7 @@ class TestUtils(unittest.TestCase):
fpp = os.path.join(td, 'pp') fpp = os.path.join(td, 'pp')
# Also test an explicity pickle protocol # Also test an explicity pickle protocol
# FIXME: Remove this patch when coverage.py can handle eventlet # FIXME: Remove this patch when coverage.py can handle eventlet
with patch("gluster.swift.common.fs_utils.do_fsync", with patch("swiftonfile.swift.common.fs_utils.do_fsync",
_mock_os_fsync): _mock_os_fsync):
utils.write_pickle('pickled peppers', fpp, tmp=tf.name, utils.write_pickle('pickled peppers', fpp, tmp=tf.name,
pickle_protocol=2) pickle_protocol=2)

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
""" Tests for gluster.swift.obj.diskfile """ """ Tests for swiftonfile.swift.obj.diskfile """
import os import os
import stat import stat
@ -26,18 +26,18 @@ from eventlet import tpool
from mock import Mock, patch from mock import Mock, patch
from hashlib import md5 from hashlib import md5
from copy import deepcopy from copy import deepcopy
from gluster.swift.common.exceptions import AlreadyExistsAsDir, \ from swiftonfile.swift.common.exceptions import AlreadyExistsAsDir, \
AlreadyExistsAsFile AlreadyExistsAsFile
from swift.common.exceptions import DiskFileNotExist, DiskFileError, \ from swift.common.exceptions import DiskFileNotExist, DiskFileError, \
DiskFileNoSpace, DiskFileNotOpen DiskFileNoSpace, DiskFileNotOpen
from swift.common.utils import ThreadPool from swift.common.utils import ThreadPool
from gluster.swift.common.exceptions import GlusterFileSystemOSError from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
import gluster.swift.common.utils import swiftonfile.swift.common.utils
from gluster.swift.common.utils import normalize_timestamp from swiftonfile.swift.common.utils import normalize_timestamp
import gluster.swift.obj.diskfile import swiftonfile.swift.obj.diskfile
from gluster.swift.obj.diskfile import DiskFileWriter, DiskFile, DiskFileManager from swiftonfile.swift.obj.diskfile import DiskFileWriter, DiskFile, DiskFileManager
from gluster.swift.common.utils import DEFAULT_UID, DEFAULT_GID, X_TYPE, \ from swiftonfile.swift.common.utils import DEFAULT_UID, DEFAULT_GID, X_TYPE, \
X_OBJECT_TYPE, DIR_OBJECT X_OBJECT_TYPE, DIR_OBJECT
from test.unit.common.test_utils import _initxattr, _destroyxattr from test.unit.common.test_utils import _initxattr, _destroyxattr
@ -81,7 +81,7 @@ class MockException(Exception):
def _mock_rmobjdir(p): def _mock_rmobjdir(p):
raise MockException("gluster.swift.obj.diskfile.rmobjdir() called") raise MockException("swiftonfile.swift.obj.diskfile.rmobjdir() called")
def _mock_do_fsync(fd): def _mock_do_fsync(fd):
@ -96,12 +96,12 @@ def _mock_renamer(a, b):
raise MockRenamerCalled() raise MockRenamerCalled()
class TestDiskFileWriter(unittest.TestCase): class TestDiskFileWriter(unittest.TestCase):
""" Tests for gluster.swift.obj.diskfile.DiskFileWriter """ """ Tests for swiftonfile.swift.obj.diskfile.DiskFileWriter """
def test_close(self): def test_close(self):
dw = DiskFileWriter(100, 'a', None) dw = DiskFileWriter(100, 'a', None)
mock_close = Mock() mock_close = Mock()
with patch("gluster.swift.obj.diskfile.do_close", mock_close): with patch("swiftonfile.swift.obj.diskfile.do_close", mock_close):
# It should call do_close # It should call do_close
self.assertEqual(100, dw._fd) self.assertEqual(100, dw._fd)
dw.close() dw.close()
@ -115,7 +115,7 @@ class TestDiskFileWriter(unittest.TestCase):
self.assertEqual(1, mock_close.call_count) self.assertEqual(1, mock_close.call_count)
class TestDiskFile(unittest.TestCase): class TestDiskFile(unittest.TestCase):
""" Tests for gluster.swift.obj.diskfile """ """ Tests for swiftonfile.swift.obj.diskfile """
def setUp(self): def setUp(self):
self._orig_tpool_exc = tpool.execute self._orig_tpool_exc = tpool.execute
@ -123,16 +123,16 @@ class TestDiskFile(unittest.TestCase):
self.lg = FakeLogger() self.lg = FakeLogger()
_initxattr() _initxattr()
_mock_clear_metadata() _mock_clear_metadata()
self._saved_df_wm = gluster.swift.obj.diskfile.write_metadata self._saved_df_wm = swiftonfile.swift.obj.diskfile.write_metadata
self._saved_df_rm = gluster.swift.obj.diskfile.read_metadata self._saved_df_rm = swiftonfile.swift.obj.diskfile.read_metadata
gluster.swift.obj.diskfile.write_metadata = _mock_write_metadata swiftonfile.swift.obj.diskfile.write_metadata = _mock_write_metadata
gluster.swift.obj.diskfile.read_metadata = _mock_read_metadata swiftonfile.swift.obj.diskfile.read_metadata = _mock_read_metadata
self._saved_ut_wm = gluster.swift.common.utils.write_metadata self._saved_ut_wm = swiftonfile.swift.common.utils.write_metadata
self._saved_ut_rm = gluster.swift.common.utils.read_metadata self._saved_ut_rm = swiftonfile.swift.common.utils.read_metadata
gluster.swift.common.utils.write_metadata = _mock_write_metadata swiftonfile.swift.common.utils.write_metadata = _mock_write_metadata
gluster.swift.common.utils.read_metadata = _mock_read_metadata swiftonfile.swift.common.utils.read_metadata = _mock_read_metadata
self._saved_do_fsync = gluster.swift.obj.diskfile.do_fsync self._saved_do_fsync = swiftonfile.swift.obj.diskfile.do_fsync
gluster.swift.obj.diskfile.do_fsync = _mock_do_fsync swiftonfile.swift.obj.diskfile.do_fsync = _mock_do_fsync
self.td = tempfile.mkdtemp() self.td = tempfile.mkdtemp()
self.conf = dict(devices=self.td, mb_per_sync=2, self.conf = dict(devices=self.td, mb_per_sync=2,
keep_cache_size=(1024 * 1024), mount_check=False) keep_cache_size=(1024 * 1024), mount_check=False)
@ -142,11 +142,11 @@ class TestDiskFile(unittest.TestCase):
tpool.execute = self._orig_tpool_exc tpool.execute = self._orig_tpool_exc
self.lg = None self.lg = None
_destroyxattr() _destroyxattr()
gluster.swift.obj.diskfile.write_metadata = self._saved_df_wm swiftonfile.swift.obj.diskfile.write_metadata = self._saved_df_wm
gluster.swift.obj.diskfile.read_metadata = self._saved_df_rm swiftonfile.swift.obj.diskfile.read_metadata = self._saved_df_rm
gluster.swift.common.utils.write_metadata = self._saved_ut_wm swiftonfile.swift.common.utils.write_metadata = self._saved_ut_wm
gluster.swift.common.utils.read_metadata = self._saved_ut_rm swiftonfile.swift.common.utils.read_metadata = self._saved_ut_rm
gluster.swift.obj.diskfile.do_fsync = self._saved_do_fsync swiftonfile.swift.obj.diskfile.do_fsync = self._saved_do_fsync
shutil.rmtree(self.td) shutil.rmtree(self.td)
def _get_diskfile(self, d, p, a, c, o, **kwargs): def _get_diskfile(self, d, p, a, c, o, **kwargs):
@ -207,7 +207,7 @@ class TestDiskFile(unittest.TestCase):
def test_open_and_close(self): def test_open_and_close(self):
mock_close = Mock() mock_close = Mock()
with mock.patch("gluster.swift.obj.diskfile.do_close", mock_close): with mock.patch("swiftonfile.swift.obj.diskfile.do_close", mock_close):
gdf = self._create_and_get_diskfile("vol0", "p57", "ufo47", gdf = self._create_and_get_diskfile("vol0", "p57", "ufo47",
"bar", "z") "bar", "z")
with gdf.open(): with gdf.open():
@ -308,7 +308,7 @@ class TestDiskFile(unittest.TestCase):
closed[0] = True closed[0] = True
os.close(fd[0]) os.close(fd[0])
with mock.patch("gluster.swift.obj.diskfile.do_close", mock_close): with mock.patch("swiftonfile.swift.obj.diskfile.do_close", mock_close):
gdf = self._create_and_get_diskfile("vol0", "p57", "ufo47", "bar", "z") gdf = self._create_and_get_diskfile("vol0", "p57", "ufo47", "bar", "z")
with gdf.open(): with gdf.open():
assert gdf._fd is not None assert gdf._fd is not None
@ -361,7 +361,7 @@ class TestDiskFile(unittest.TestCase):
closed[0] = True closed[0] = True
os.close(fd[0]) os.close(fd[0])
with mock.patch("gluster.swift.obj.diskfile.do_close", mock_close): with mock.patch("swiftonfile.swift.obj.diskfile.do_close", mock_close):
gdf = self._create_and_get_diskfile("vol0", "p57", "ufo47", "bar", "z", fsize=1024*1024*2) gdf = self._create_and_get_diskfile("vol0", "p57", "ufo47", "bar", "z", fsize=1024*1024*2)
with gdf.open(): with gdf.open():
assert gdf._fd is not None assert gdf._fd is not None
@ -388,7 +388,7 @@ class TestDiskFile(unittest.TestCase):
try: try:
chunks = [ck for ck in reader] chunks = [ck for ck in reader]
assert len(chunks) == 0, repr(chunks) assert len(chunks) == 0, repr(chunks)
with mock.patch("gluster.swift.obj.diskfile.do_close", with mock.patch("swiftonfile.swift.obj.diskfile.do_close",
our_do_close): our_do_close):
reader.close() reader.close()
assert not called[0] assert not called[0]
@ -437,11 +437,11 @@ class TestDiskFile(unittest.TestCase):
assert u == DEFAULT_UID assert u == DEFAULT_UID
assert g == DEFAULT_GID assert g == DEFAULT_GID
dc = gluster.swift.obj.diskfile.do_chown dc = swiftonfile.swift.obj.diskfile.do_chown
gluster.swift.obj.diskfile.do_chown = _mock_do_chown swiftonfile.swift.obj.diskfile.do_chown = _mock_do_chown
self.assertRaises( self.assertRaises(
AlreadyExistsAsFile, gdf._create_dir_object, the_dir) AlreadyExistsAsFile, gdf._create_dir_object, the_dir)
gluster.swift.obj.diskfile.do_chown = dc swiftonfile.swift.obj.diskfile.do_chown = dc
self.assertFalse(os.path.isdir(the_dir)) self.assertFalse(os.path.isdir(the_dir))
self.assertFalse(_mapit(the_dir) in _metadata) self.assertFalse(_mapit(the_dir) in _metadata)
@ -459,11 +459,11 @@ class TestDiskFile(unittest.TestCase):
assert u == DEFAULT_UID assert u == DEFAULT_UID
assert g == DEFAULT_GID assert g == DEFAULT_GID
dc = gluster.swift.obj.diskfile.do_chown dc = swiftonfile.swift.obj.diskfile.do_chown
gluster.swift.obj.diskfile.do_chown = _mock_do_chown swiftonfile.swift.obj.diskfile.do_chown = _mock_do_chown
self.assertRaises( self.assertRaises(
AlreadyExistsAsFile, gdf._create_dir_object, the_dir) AlreadyExistsAsFile, gdf._create_dir_object, the_dir)
gluster.swift.obj.diskfile.do_chown = dc swiftonfile.swift.obj.diskfile.do_chown = dc
self.assertFalse(os.path.isdir(the_dir)) self.assertFalse(os.path.isdir(the_dir))
self.assertFalse(_mapit(the_dir) in _metadata) self.assertFalse(_mapit(the_dir) in _metadata)
@ -756,7 +756,7 @@ class TestDiskFile(unittest.TestCase):
def mock_rename(*args, **kwargs): def mock_rename(*args, **kwargs):
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT)) raise OSError(errno.ENOENT, os.strerror(errno.ENOENT))
with mock.patch("gluster.swift.obj.diskfile.sleep", mock_sleep): with mock.patch("swiftonfile.swift.obj.diskfile.sleep", mock_sleep):
with mock.patch("os.rename", mock_rename): with mock.patch("os.rename", mock_rename):
try: try:
with gdf.create() as dw: with gdf.create() as dw:

View File

@ -13,12 +13,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
""" Tests for gluster.swift.obj.server subclass """ """ Tests for swiftonfile.swift.obj.server subclass """
import unittest import unittest
from nose import SkipTest from nose import SkipTest
import gluster.swift.obj.server as server import swiftonfile.swift.obj.server as server
class TestObjServer(unittest.TestCase): class TestObjServer(unittest.TestCase):

View File

@ -13,36 +13,36 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
""" Tests for gluster.swift """ """ Tests for swiftonfile.swift """
import os import os
import unittest import unittest
import shutil import shutil
import tempfile import tempfile
import gluster.swift as gs import swiftonfile.swift as sof
class TestPkgInfo(unittest.TestCase): class TestPkgInfo(unittest.TestCase):
""" """
Tests for gluster.swift PkgInfo class. Tests for swiftonfile.swift PkgInfo class.
""" """
def test_constructor(self): def test_constructor(self):
pi = gs.PkgInfo('a', 'b', 'c', 'd') pi = sof.PkgInfo('a', 'b', 'c', 'd')
assert pi.canonical_version == 'a' assert pi.canonical_version == 'a'
assert pi.name == 'c' assert pi.name == 'c'
self.assertEqual(pi.release, 'b') self.assertEqual(pi.release, 'b')
assert pi.final == 'd' assert pi.final == 'd'
def test_pretty_version(self): def test_pretty_version(self):
pi = gs.PkgInfo('a', 'b', 'c', False) pi = sof.PkgInfo('a', 'b', 'c', False)
assert pi.pretty_version == 'a-dev' assert pi.pretty_version == 'a-dev'
pi = gs.PkgInfo('a', 'b', 'c', True) pi = sof.PkgInfo('a', 'b', 'c', True)
assert pi.pretty_version == 'a' assert pi.pretty_version == 'a'
def test_save_config(self): def test_save_config(self):
pi = gs.PkgInfo('a', 'b', 'c', 'd') pi = sof.PkgInfo('a', 'b', 'c', 'd')
td = tempfile.mkdtemp() td = tempfile.mkdtemp()
try: try:
sc = os.path.join(td, 'saved_config.txt') sc = os.path.join(td, 'saved_config.txt')

View File

@ -28,8 +28,8 @@ cleanup()
sudo service memcached stop sudo service memcached stop
sudo_env swift-init main stop sudo_env swift-init main stop
sudo rm -rf /etc/swift > /dev/null 2>&1 sudo rm -rf /etc/swift > /dev/null 2>&1
sudo rm -rf /mnt/gluster-object/test{,2}/* > /dev/null 2>&1 sudo rm -rf /mnt/swiftonfile/test{,2}/* > /dev/null 2>&1
sudo setfattr -x user.swift.metadata /mnt/gluster-object/test{,2} > /dev/null 2>&1 sudo setfattr -x user.swift.metadata /mnt/swiftonfile/test{,2} > /dev/null 2>&1
} }
quit() quit()
@ -53,7 +53,7 @@ if [ -x /etc/swift ] ; then
fi fi
# Check the directories exist # Check the directories exist
DIRS="/mnt/gluster-object /mnt/gluster-object/test /mnt/gluster-object/test2" DIRS="/mnt/swiftonfile /mnt/swiftonfile/test /mnt/swiftonfile/test2"
for d in $DIRS ; do for d in $DIRS ; do
if [ ! -x $d ] ; then if [ ! -x $d ] ; then
quit "$d must exist on an XFS or GlusterFS volume" quit "$d must exist on an XFS or GlusterFS volume"

View File

@ -16,7 +16,7 @@ setenv = VIRTUAL_ENV={envdir}
NOSE_OPENSTACK_STDOUT=1 NOSE_OPENSTACK_STDOUT=1
NOSE_WITH_COVERAGE=1 NOSE_WITH_COVERAGE=1
NOSE_COVER_BRANCHES=1 NOSE_COVER_BRANCHES=1
NOSE_COVER_PACKAGE=gluster NOSE_COVER_PACKAGE=swiftonfile
deps = deps =
# GitHub's .zip URL won't work! pip supports installing from git repos. # GitHub's .zip URL won't work! pip supports installing from git repos.
# https://pip.pypa.io/en/latest/reference/pip_install.html#git # https://pip.pypa.io/en/latest/reference/pip_install.html#git
@ -48,7 +48,7 @@ commands = bash ./.functests -q
[testenv:pep8] [testenv:pep8]
changedir = {toxinidir} changedir = {toxinidir}
commands = commands =
flake8 gluster test setup.py flake8 swiftonfile test setup.py
[testenv:venv] [testenv:venv]
changedir = {toxinidir} changedir = {toxinidir}