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:
parent
67c77c1be9
commit
de24352275
@ -20,7 +20,7 @@ import pprint
|
||||
import os
|
||||
import json
|
||||
from optparse import OptionParser
|
||||
from gluster.swift.common.utils import read_metadata
|
||||
from swiftonfile.swift.common.utils import read_metadata
|
||||
|
||||
# Parser Setup
|
||||
USAGE = "Usage: %prog [options] OBJECT"
|
@ -30,7 +30,7 @@ disable_fallocate = true
|
||||
pipeline = object-server
|
||||
|
||||
[app:object-server]
|
||||
use = egg:gluster_swift#object
|
||||
use = egg:swiftonfile#object
|
||||
user = root
|
||||
log_facility = LOG_LOCAL2
|
||||
log_level = WARN
|
@ -40,5 +40,5 @@ effect."
|
||||
fi
|
||||
|
||||
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"
|
||||
|
@ -21,7 +21,7 @@ from optparse import OptionParser
|
||||
if __name__ == '__main__':
|
||||
# check if swift is installed
|
||||
try:
|
||||
from gluster.swift.common.Glusterfs import get_mnt_point, unmount
|
||||
from swiftonfile.swift.common.Glusterfs import get_mnt_point, unmount
|
||||
except ImportError:
|
||||
import sys
|
||||
sys.exit("Openstack Swift does not appear to be installed properly")
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Simple script to create RPMs for G4S
|
||||
|
||||
## RPM NAME
|
||||
RPMNAME=glusterfs-openstack-swift
|
||||
RPMNAME=swiftonfile
|
||||
|
||||
cleanup()
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Simple program to save all package information
|
||||
# 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'
|
||||
|
||||
|
10
setup.py
10
setup.py
@ -14,17 +14,17 @@
|
||||
# limitations under the License.
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from gluster.swift import _pkginfo
|
||||
from swiftonfile.swift import _pkginfo
|
||||
|
||||
|
||||
setup(
|
||||
name=_pkginfo.name,
|
||||
version=_pkginfo.full_version,
|
||||
description='Gluster For Swift',
|
||||
description='SwiftOnfile',
|
||||
license='Apache License (2.0)',
|
||||
author='Red Hat, Inc.',
|
||||
author_email='gluster-users@gluster.org',
|
||||
url='http://launchpad.net/gluster-swift',
|
||||
url='https://github.com/swiftonfile/swiftonfile',
|
||||
packages=find_packages(exclude=['test', 'bin']),
|
||||
test_suite='nose.collector',
|
||||
classifiers=[
|
||||
@ -41,11 +41,11 @@ setup(
|
||||
],
|
||||
install_requires=[],
|
||||
scripts=[
|
||||
'bin/gluster-swift-print-metadata',
|
||||
'bin/swiftonfile-print-metadata',
|
||||
],
|
||||
entry_points={
|
||||
'paste.app_factory': [
|
||||
'object=gluster.swift.obj.server:app_factory',
|
||||
'object=swiftonfile.swift.obj.server:app_factory',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
@ -8,12 +8,12 @@
|
||||
%{!?_name:%define _name __PKG_NAME__}
|
||||
%{!?_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}
|
||||
Version : %{_version}
|
||||
Release : %{_release}%{?dist}
|
||||
Group : Application/File
|
||||
URL : http://launchpad.net/gluster-swift
|
||||
URL : https://github.com/swiftonfile/swiftonfile
|
||||
Vendor : Fedora Project
|
||||
Source0 : %{_name}-%{_version}-%{_release}.tar.gz
|
||||
License : ASL 2.0
|
||||
@ -46,7 +46,7 @@ as top-level directories of volumes, where accounts are mapped one-to-one to
|
||||
gluster volumes.
|
||||
|
||||
%prep
|
||||
%setup -q -n gluster_swift-%{_version}
|
||||
%setup -q -n swiftonfile-%{_version}
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
@ -68,23 +68,11 @@ done
|
||||
# Remove tests
|
||||
%{__rm} -rf %{buildroot}/%{python_sitelib}/test
|
||||
|
||||
# Remove files provided by glusterfs-api
|
||||
%{__rm} -rf %{buildroot}/%{python_sitelib}/gluster/__init__.p*
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{python_sitelib}/gluster
|
||||
%{python_sitelib}/gluster_swift-%{_version}_*.egg-info
|
||||
%{_bindir}/gluster-swift-gen-builders
|
||||
%{_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
|
||||
%{python_sitelib}/swiftonfile
|
||||
%{python_sitelib}/swiftonfile-%{_version}_*.egg-info
|
||||
%{_bindir}/swiftonfile-print-metadata
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%dir %{_confdir}
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
""" Gluster for Swift """
|
||||
""" SwiftOnFile """
|
||||
|
||||
|
||||
class PkgInfo(object):
|
||||
@ -45,6 +45,6 @@ class PkgInfo(object):
|
||||
###
|
||||
### 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
|
||||
__canonical_version__ = _pkginfo.canonical_version
|
@ -22,8 +22,8 @@ import urllib
|
||||
|
||||
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
|
||||
from swift.common.utils import TRUE_VALUES
|
||||
from gluster.swift.common.fs_utils import do_ismount
|
||||
from gluster.swift.common.exceptions import FailureToMountError
|
||||
from swiftonfile.swift.common.fs_utils import do_ismount
|
||||
from swiftonfile.swift.common.exceptions import FailureToMountError
|
||||
|
||||
#
|
||||
# Read the fs.conf file once at startup (module load)
|
@ -25,7 +25,7 @@ from itertools import repeat
|
||||
import ctypes
|
||||
from eventlet import sleep
|
||||
from swift.common.utils import load_libc_function
|
||||
from gluster.swift.common.exceptions import FileOrDirNotFoundError, \
|
||||
from swiftonfile.swift.common.exceptions import FileOrDirNotFoundError, \
|
||||
NotDirectoryError, GlusterFileSystemOSError
|
||||
from swift.common.exceptions import DiskFileNoSpace
|
||||
|
@ -21,9 +21,9 @@ import logging
|
||||
from hashlib import md5
|
||||
from eventlet import sleep
|
||||
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 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_getxattr, do_setxattr, do_removexattr, do_read, \
|
||||
do_close, do_dup, do_lseek, do_fstat, do_fsync, do_rename
|
@ -28,7 +28,7 @@ from hashlib import md5
|
||||
from eventlet import sleep
|
||||
from greenlet import getcurrent
|
||||
from contextlib import contextmanager
|
||||
from gluster.swift.common.exceptions import AlreadyExistsAsFile, \
|
||||
from swiftonfile.swift.common.exceptions import AlreadyExistsAsFile, \
|
||||
AlreadyExistsAsDir
|
||||
from swift.common.utils import TRUE_VALUES, ThreadPool, hash_path, \
|
||||
normalize_timestamp
|
||||
@ -37,14 +37,14 @@ from swift.common.exceptions import DiskFileNotExist, DiskFileError, \
|
||||
DiskFileExpired
|
||||
from swift.common.swob import multi_range_iterator
|
||||
|
||||
from gluster.swift.common.exceptions import GlusterFileSystemOSError
|
||||
from gluster.swift.common.fs_utils import do_fstat, do_open, do_close, \
|
||||
from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
|
||||
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_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, \
|
||||
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, \
|
||||
FILE_TYPE, DEFAULT_UID, DEFAULT_GID, DIR_NON_OBJECT, DIR_OBJECT, \
|
||||
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/,
|
||||
etc, or object names with multiple consecutive slahes, like a//b,
|
||||
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.
|
||||
|
||||
:param mgr: associated on-disk manager instance
|
@ -15,16 +15,16 @@
|
||||
|
||||
""" 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.utils import public, timing_stats
|
||||
from gluster.swift.common.exceptions import AlreadyExistsAsFile, \
|
||||
from swiftonfile.swift.common.exceptions import AlreadyExistsAsFile, \
|
||||
AlreadyExistsAsDir
|
||||
from swift.common.request_helpers import split_and_validate_path
|
||||
|
||||
from swift.obj import server
|
||||
|
||||
from gluster.swift.obj.diskfile import DiskFileManager
|
||||
from swiftonfile.swift.obj.diskfile import DiskFileManager
|
||||
|
||||
|
||||
class ObjectController(server.ObjectController):
|
||||
@ -64,7 +64,7 @@ class ObjectController(server.ObjectController):
|
||||
def PUT(self, request):
|
||||
try:
|
||||
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)
|
||||
except (AlreadyExistsAsFile, AlreadyExistsAsDir):
|
||||
device = \
|
@ -19,7 +19,7 @@ import time
|
||||
import StringIO
|
||||
import mock
|
||||
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):
|
||||
return False
|
||||
@ -92,7 +92,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
def test_mount(self):
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'test'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
@ -104,7 +104,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
def test_mount_egain(self):
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'test'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
@ -117,7 +117,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
def test_mount_get_export_list_err(self):
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'test3'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
@ -132,7 +132,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
"""
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'test'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
@ -150,7 +150,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
"""
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'test'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
@ -166,7 +166,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
def test_invalid_drive_name(self):
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'te st'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
@ -178,14 +178,14 @@ class TestGlusterfs(unittest.TestCase):
|
||||
def test_already_mounted(self):
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile')
|
||||
drive = 'test'
|
||||
|
||||
_init_mock_variables(tmpdir)
|
||||
def mock_do_ismount(path):
|
||||
return True
|
||||
|
||||
with mock.patch("gluster.swift.common.Glusterfs.do_ismount",
|
||||
with mock.patch("swiftonfile.swift.common.Glusterfs.do_ismount",
|
||||
mock_do_ismount):
|
||||
self.assertTrue(gfs.mount(root, drive))
|
||||
finally:
|
||||
@ -195,7 +195,7 @@ class TestGlusterfs(unittest.TestCase):
|
||||
def test_get_export_list(self):
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
root = os.path.join(tmpdir, 'mnt/gluster-object')
|
||||
root = os.path.join(tmpdir, 'mnt/swiftonfile-object')
|
||||
drive = 'test'
|
||||
|
||||
# undo mocking of _get_export_list
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import unittest
|
||||
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):
|
||||
@ -41,7 +41,7 @@ class TestConstraints(unittest.TestCase):
|
||||
self.assertTrue(cnt.validate_obj_name_component(''))
|
||||
|
||||
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):
|
||||
req = Mock()
|
||||
req.headers = []
|
||||
|
@ -22,8 +22,8 @@ from nose import SkipTest
|
||||
from mock import patch, Mock
|
||||
from time import sleep
|
||||
from tempfile import mkdtemp, mkstemp
|
||||
from gluster.swift.common import fs_utils as fs
|
||||
from gluster.swift.common.exceptions import NotDirectoryError, \
|
||||
from swiftonfile.swift.common import fs_utils as fs
|
||||
from swiftonfile.swift.common.exceptions import NotDirectoryError, \
|
||||
FileOrDirNotFoundError, GlusterFileSystemOSError
|
||||
from swift.common.exceptions import DiskFileNoSpace
|
||||
|
||||
|
@ -26,8 +26,8 @@ import tarfile
|
||||
import shutil
|
||||
from collections import defaultdict
|
||||
from mock import patch
|
||||
from gluster.swift.common import utils, Glusterfs
|
||||
from gluster.swift.common.exceptions import GlusterFileSystemOSError
|
||||
from swiftonfile.swift.common import utils, Glusterfs
|
||||
from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
|
||||
from swift.common.exceptions import DiskFileNoSpace
|
||||
|
||||
#
|
||||
@ -466,7 +466,7 @@ class TestUtils(unittest.TestCase):
|
||||
try:
|
||||
fpp = os.path.join(td, 'pp')
|
||||
# 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):
|
||||
utils.write_pickle('pickled peppers', fpp)
|
||||
with open(fpp, "rb") as f:
|
||||
@ -483,7 +483,7 @@ class TestUtils(unittest.TestCase):
|
||||
fpp = os.path.join(td, 'pp')
|
||||
# Also test an explicity pickle protocol
|
||||
# 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):
|
||||
utils.write_pickle('pickled peppers', fpp, tmp=tf.name,
|
||||
pickle_protocol=2)
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
""" Tests for gluster.swift.obj.diskfile """
|
||||
""" Tests for swiftonfile.swift.obj.diskfile """
|
||||
|
||||
import os
|
||||
import stat
|
||||
@ -26,18 +26,18 @@ from eventlet import tpool
|
||||
from mock import Mock, patch
|
||||
from hashlib import md5
|
||||
from copy import deepcopy
|
||||
from gluster.swift.common.exceptions import AlreadyExistsAsDir, \
|
||||
from swiftonfile.swift.common.exceptions import AlreadyExistsAsDir, \
|
||||
AlreadyExistsAsFile
|
||||
from swift.common.exceptions import DiskFileNotExist, DiskFileError, \
|
||||
DiskFileNoSpace, DiskFileNotOpen
|
||||
from swift.common.utils import ThreadPool
|
||||
|
||||
from gluster.swift.common.exceptions import GlusterFileSystemOSError
|
||||
import gluster.swift.common.utils
|
||||
from gluster.swift.common.utils import normalize_timestamp
|
||||
import gluster.swift.obj.diskfile
|
||||
from gluster.swift.obj.diskfile import DiskFileWriter, DiskFile, DiskFileManager
|
||||
from gluster.swift.common.utils import DEFAULT_UID, DEFAULT_GID, X_TYPE, \
|
||||
from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
|
||||
import swiftonfile.swift.common.utils
|
||||
from swiftonfile.swift.common.utils import normalize_timestamp
|
||||
import swiftonfile.swift.obj.diskfile
|
||||
from swiftonfile.swift.obj.diskfile import DiskFileWriter, DiskFile, DiskFileManager
|
||||
from swiftonfile.swift.common.utils import DEFAULT_UID, DEFAULT_GID, X_TYPE, \
|
||||
X_OBJECT_TYPE, DIR_OBJECT
|
||||
|
||||
from test.unit.common.test_utils import _initxattr, _destroyxattr
|
||||
@ -81,7 +81,7 @@ class MockException(Exception):
|
||||
|
||||
|
||||
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):
|
||||
@ -96,12 +96,12 @@ def _mock_renamer(a, b):
|
||||
raise MockRenamerCalled()
|
||||
|
||||
class TestDiskFileWriter(unittest.TestCase):
|
||||
""" Tests for gluster.swift.obj.diskfile.DiskFileWriter """
|
||||
""" Tests for swiftonfile.swift.obj.diskfile.DiskFileWriter """
|
||||
|
||||
def test_close(self):
|
||||
dw = DiskFileWriter(100, 'a', None)
|
||||
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
|
||||
self.assertEqual(100, dw._fd)
|
||||
dw.close()
|
||||
@ -115,7 +115,7 @@ class TestDiskFileWriter(unittest.TestCase):
|
||||
self.assertEqual(1, mock_close.call_count)
|
||||
|
||||
class TestDiskFile(unittest.TestCase):
|
||||
""" Tests for gluster.swift.obj.diskfile """
|
||||
""" Tests for swiftonfile.swift.obj.diskfile """
|
||||
|
||||
def setUp(self):
|
||||
self._orig_tpool_exc = tpool.execute
|
||||
@ -123,16 +123,16 @@ class TestDiskFile(unittest.TestCase):
|
||||
self.lg = FakeLogger()
|
||||
_initxattr()
|
||||
_mock_clear_metadata()
|
||||
self._saved_df_wm = gluster.swift.obj.diskfile.write_metadata
|
||||
self._saved_df_rm = gluster.swift.obj.diskfile.read_metadata
|
||||
gluster.swift.obj.diskfile.write_metadata = _mock_write_metadata
|
||||
gluster.swift.obj.diskfile.read_metadata = _mock_read_metadata
|
||||
self._saved_ut_wm = gluster.swift.common.utils.write_metadata
|
||||
self._saved_ut_rm = gluster.swift.common.utils.read_metadata
|
||||
gluster.swift.common.utils.write_metadata = _mock_write_metadata
|
||||
gluster.swift.common.utils.read_metadata = _mock_read_metadata
|
||||
self._saved_do_fsync = gluster.swift.obj.diskfile.do_fsync
|
||||
gluster.swift.obj.diskfile.do_fsync = _mock_do_fsync
|
||||
self._saved_df_wm = swiftonfile.swift.obj.diskfile.write_metadata
|
||||
self._saved_df_rm = swiftonfile.swift.obj.diskfile.read_metadata
|
||||
swiftonfile.swift.obj.diskfile.write_metadata = _mock_write_metadata
|
||||
swiftonfile.swift.obj.diskfile.read_metadata = _mock_read_metadata
|
||||
self._saved_ut_wm = swiftonfile.swift.common.utils.write_metadata
|
||||
self._saved_ut_rm = swiftonfile.swift.common.utils.read_metadata
|
||||
swiftonfile.swift.common.utils.write_metadata = _mock_write_metadata
|
||||
swiftonfile.swift.common.utils.read_metadata = _mock_read_metadata
|
||||
self._saved_do_fsync = swiftonfile.swift.obj.diskfile.do_fsync
|
||||
swiftonfile.swift.obj.diskfile.do_fsync = _mock_do_fsync
|
||||
self.td = tempfile.mkdtemp()
|
||||
self.conf = dict(devices=self.td, mb_per_sync=2,
|
||||
keep_cache_size=(1024 * 1024), mount_check=False)
|
||||
@ -142,11 +142,11 @@ class TestDiskFile(unittest.TestCase):
|
||||
tpool.execute = self._orig_tpool_exc
|
||||
self.lg = None
|
||||
_destroyxattr()
|
||||
gluster.swift.obj.diskfile.write_metadata = self._saved_df_wm
|
||||
gluster.swift.obj.diskfile.read_metadata = self._saved_df_rm
|
||||
gluster.swift.common.utils.write_metadata = self._saved_ut_wm
|
||||
gluster.swift.common.utils.read_metadata = self._saved_ut_rm
|
||||
gluster.swift.obj.diskfile.do_fsync = self._saved_do_fsync
|
||||
swiftonfile.swift.obj.diskfile.write_metadata = self._saved_df_wm
|
||||
swiftonfile.swift.obj.diskfile.read_metadata = self._saved_df_rm
|
||||
swiftonfile.swift.common.utils.write_metadata = self._saved_ut_wm
|
||||
swiftonfile.swift.common.utils.read_metadata = self._saved_ut_rm
|
||||
swiftonfile.swift.obj.diskfile.do_fsync = self._saved_do_fsync
|
||||
shutil.rmtree(self.td)
|
||||
|
||||
def _get_diskfile(self, d, p, a, c, o, **kwargs):
|
||||
@ -207,7 +207,7 @@ class TestDiskFile(unittest.TestCase):
|
||||
def test_open_and_close(self):
|
||||
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",
|
||||
"bar", "z")
|
||||
with gdf.open():
|
||||
@ -308,7 +308,7 @@ class TestDiskFile(unittest.TestCase):
|
||||
closed[0] = True
|
||||
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")
|
||||
with gdf.open():
|
||||
assert gdf._fd is not None
|
||||
@ -361,7 +361,7 @@ class TestDiskFile(unittest.TestCase):
|
||||
closed[0] = True
|
||||
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)
|
||||
with gdf.open():
|
||||
assert gdf._fd is not None
|
||||
@ -388,7 +388,7 @@ class TestDiskFile(unittest.TestCase):
|
||||
try:
|
||||
chunks = [ck for ck in reader]
|
||||
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):
|
||||
reader.close()
|
||||
assert not called[0]
|
||||
@ -437,11 +437,11 @@ class TestDiskFile(unittest.TestCase):
|
||||
assert u == DEFAULT_UID
|
||||
assert g == DEFAULT_GID
|
||||
|
||||
dc = gluster.swift.obj.diskfile.do_chown
|
||||
gluster.swift.obj.diskfile.do_chown = _mock_do_chown
|
||||
dc = swiftonfile.swift.obj.diskfile.do_chown
|
||||
swiftonfile.swift.obj.diskfile.do_chown = _mock_do_chown
|
||||
self.assertRaises(
|
||||
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(_mapit(the_dir) in _metadata)
|
||||
|
||||
@ -459,11 +459,11 @@ class TestDiskFile(unittest.TestCase):
|
||||
assert u == DEFAULT_UID
|
||||
assert g == DEFAULT_GID
|
||||
|
||||
dc = gluster.swift.obj.diskfile.do_chown
|
||||
gluster.swift.obj.diskfile.do_chown = _mock_do_chown
|
||||
dc = swiftonfile.swift.obj.diskfile.do_chown
|
||||
swiftonfile.swift.obj.diskfile.do_chown = _mock_do_chown
|
||||
self.assertRaises(
|
||||
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(_mapit(the_dir) in _metadata)
|
||||
|
||||
@ -756,7 +756,7 @@ class TestDiskFile(unittest.TestCase):
|
||||
def mock_rename(*args, **kwargs):
|
||||
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):
|
||||
try:
|
||||
with gdf.create() as dw:
|
||||
|
@ -13,12 +13,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
""" Tests for gluster.swift.obj.server subclass """
|
||||
""" Tests for swiftonfile.swift.obj.server subclass """
|
||||
|
||||
import unittest
|
||||
from nose import SkipTest
|
||||
|
||||
import gluster.swift.obj.server as server
|
||||
import swiftonfile.swift.obj.server as server
|
||||
|
||||
|
||||
class TestObjServer(unittest.TestCase):
|
||||
|
@ -13,36 +13,36 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
""" Tests for gluster.swift """
|
||||
""" Tests for swiftonfile.swift """
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import gluster.swift as gs
|
||||
import swiftonfile.swift as sof
|
||||
|
||||
|
||||
class TestPkgInfo(unittest.TestCase):
|
||||
"""
|
||||
Tests for gluster.swift PkgInfo class.
|
||||
Tests for swiftonfile.swift PkgInfo class.
|
||||
"""
|
||||
|
||||
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.name == 'c'
|
||||
self.assertEqual(pi.release, 'b')
|
||||
assert pi.final == 'd'
|
||||
|
||||
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'
|
||||
pi = gs.PkgInfo('a', 'b', 'c', True)
|
||||
pi = sof.PkgInfo('a', 'b', 'c', True)
|
||||
assert pi.pretty_version == 'a'
|
||||
|
||||
def test_save_config(self):
|
||||
pi = gs.PkgInfo('a', 'b', 'c', 'd')
|
||||
pi = sof.PkgInfo('a', 'b', 'c', 'd')
|
||||
td = tempfile.mkdtemp()
|
||||
try:
|
||||
sc = os.path.join(td, 'saved_config.txt')
|
||||
|
@ -28,8 +28,8 @@ cleanup()
|
||||
sudo service memcached stop
|
||||
sudo_env swift-init main stop
|
||||
sudo rm -rf /etc/swift > /dev/null 2>&1
|
||||
sudo rm -rf /mnt/gluster-object/test{,2}/* > /dev/null 2>&1
|
||||
sudo setfattr -x user.swift.metadata /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/swiftonfile/test{,2} > /dev/null 2>&1
|
||||
}
|
||||
|
||||
quit()
|
||||
@ -53,7 +53,7 @@ if [ -x /etc/swift ] ; then
|
||||
fi
|
||||
|
||||
# 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
|
||||
if [ ! -x $d ] ; then
|
||||
quit "$d must exist on an XFS or GlusterFS volume"
|
||||
|
4
tox.ini
4
tox.ini
@ -16,7 +16,7 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
NOSE_OPENSTACK_STDOUT=1
|
||||
NOSE_WITH_COVERAGE=1
|
||||
NOSE_COVER_BRANCHES=1
|
||||
NOSE_COVER_PACKAGE=gluster
|
||||
NOSE_COVER_PACKAGE=swiftonfile
|
||||
deps =
|
||||
# GitHub's .zip URL won't work! pip supports installing from git repos.
|
||||
# https://pip.pypa.io/en/latest/reference/pip_install.html#git
|
||||
@ -48,7 +48,7 @@ commands = bash ./.functests -q
|
||||
[testenv:pep8]
|
||||
changedir = {toxinidir}
|
||||
commands =
|
||||
flake8 gluster test setup.py
|
||||
flake8 swiftonfile test setup.py
|
||||
|
||||
[testenv:venv]
|
||||
changedir = {toxinidir}
|
||||
|
Loading…
Reference in New Issue
Block a user