Support Storage Policy - Rev 7
* Rename references of '/mnt/gluster-object' to '/mnt/swiftonfile'. * Rename swiftonfile SP name from 'sof' to 'swiftonfile'. * Retain reseller_prefix in account dir created. This is to comply with Swift's behavior. * Cleanup mountpoint after running swiftonfile specific tests. Signed-off-by: Prashanth Pai <ppai@redhat.com>
This commit is contained in:
parent
285aece1ee
commit
50067f9c69
@ -39,8 +39,8 @@ cleanup()
|
||||
print "Stopping swift sevices"
|
||||
sudo_env swift-init main stop
|
||||
print "Cleaning SoF mount point"
|
||||
sudo rm -rf /mnt/gluster-object/test/* > /dev/null 2>&1
|
||||
sudo setfattr -x user.swift.metadata /mnt/gluster-object/test > /dev/null 2>&1
|
||||
sudo rm -rf /mnt/swiftonfile/test/* > /dev/null 2>&1
|
||||
sudo setfattr -x user.swift.metadata /mnt/swiftonfile/test > /dev/null 2>&1
|
||||
print "Invoking SAIO's resetswift script"
|
||||
resetswift
|
||||
}
|
||||
@ -57,7 +57,7 @@ fail()
|
||||
print """
|
||||
Before proceeding forward, please make sure you already have:
|
||||
1. SAIO deployment. (with resetswift and remakerings script)
|
||||
2. XFS/GlusterFS mounted at /mnt/gluster-object/test
|
||||
2. XFS/GlusterFS mounted at /mnt/swiftonfile/test
|
||||
"""
|
||||
|
||||
prompt=true
|
||||
|
@ -4,7 +4,7 @@
|
||||
# setting the following value in {account,container,object}-server.conf files.
|
||||
# It is recommended to keep this value same for all the three services but can
|
||||
# be kept different if environment demands.
|
||||
devices = /mnt/gluster-object
|
||||
devices = /mnt/swiftonfile
|
||||
#
|
||||
# Once you are confident that your startup processes will always have your
|
||||
# gluster volumes properly mounted *before* the object-server workers start,
|
||||
|
@ -40,10 +40,10 @@ default = yes
|
||||
#[storage-policy:1]
|
||||
#name = silver
|
||||
|
||||
# The following section defines a policy called 'sof' to be used by swiftonfile
|
||||
# object-server implementation.
|
||||
# The following section defines a policy called 'swiftonfile' to be used by
|
||||
# swiftonfile object-server implementation.
|
||||
[storage-policy:2]
|
||||
name = sof
|
||||
name = swiftonfile
|
||||
|
||||
# The swift-constraints section sets the basic constraints on data
|
||||
# saved in the swift cluster. These constraints are automatically
|
||||
|
@ -231,7 +231,7 @@ class DiskFileManager(SwiftDiskFileManager):
|
||||
def __init__(self, conf, logger):
|
||||
super(DiskFileManager, self).__init__(conf, logger)
|
||||
self.reseller_prefix = \
|
||||
conf.get('reseller_prefix', 'AUTH_').strip()
|
||||
conf.get('reseller_prefix', 'AUTH_').strip() # Not used, currently
|
||||
|
||||
def get_diskfile(self, device, partition, account, container, obj,
|
||||
policy_idx=0, **kwargs):
|
||||
@ -589,10 +589,6 @@ class DiskFile(object):
|
||||
# Don't store a value for data_file until we know it exists.
|
||||
self._data_file = None
|
||||
|
||||
# Is this the right thing to do ? The Swift databases include
|
||||
# the resller_prefix while storing the account name.
|
||||
if account.startswith(self._mgr.reseller_prefix):
|
||||
account = account[len(self._mgr.reseller_prefix):]
|
||||
self._account = account
|
||||
self._container = container
|
||||
|
||||
|
@ -11,7 +11,7 @@ name = silver
|
||||
|
||||
# SwiftOnFile
|
||||
[storage-policy:2]
|
||||
name = sof
|
||||
name = swiftonfile
|
||||
default = yes
|
||||
|
||||
[swift-constraints]
|
||||
|
@ -18,6 +18,7 @@
|
||||
import os
|
||||
import re
|
||||
import hashlib
|
||||
from shutil import rmtree
|
||||
|
||||
from test.functional.tests import Base, Utils
|
||||
from test.functional.swift_test_client import Account, Connection, \
|
||||
@ -32,7 +33,7 @@ class TestSwiftOnFileEnv:
|
||||
cls.conn.authenticate()
|
||||
cls.account = Account(cls.conn, tf.config.get('account',
|
||||
tf.config['username']))
|
||||
cls.root_dir = os.path.join('/mnt/gluster-object/test')
|
||||
cls.root_dir = os.path.join('/mnt/swiftonfile/test')
|
||||
cls.account.delete_containers()
|
||||
|
||||
cls.file_size = 8
|
||||
@ -85,6 +86,12 @@ class TestSwiftOnFile(Base):
|
||||
env = TestSwiftOnFileEnv
|
||||
set_up = False
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
self.env.account.delete_containers()
|
||||
for account_dir in os.listdir(self.env.root_dir):
|
||||
rmtree(os.path.join(self.env.root_dir, account_dir))
|
||||
|
||||
def testObjectsFromMountPoint(self):
|
||||
found_files = []
|
||||
found_dirs = []
|
||||
@ -99,7 +106,7 @@ class TestSwiftOnFile(Base):
|
||||
found_dirs.append(file)
|
||||
elif os.path.isfile(os.path.join(path, file)):
|
||||
filename = os.path.join(os.path.relpath(path, os.path.join(
|
||||
self.env.root_dir, self.env.account.name,
|
||||
self.env.root_dir, 'AUTH_' + self.env.account.name,
|
||||
self.env.container.name)), file)
|
||||
if re.match('^[\.]', filename):
|
||||
filename = filename[2:]
|
||||
@ -107,7 +114,8 @@ class TestSwiftOnFile(Base):
|
||||
else:
|
||||
pass # Just a Place holder
|
||||
|
||||
recurse_path(os.path.join(self.env.root_dir, self.env.account.name,
|
||||
recurse_path(os.path.join(self.env.root_dir,
|
||||
'AUTH_' + self.env.account.name,
|
||||
self.env.container.name))
|
||||
for file in self.env.stored_files:
|
||||
self.assert_(file in found_files)
|
||||
@ -120,7 +128,8 @@ class TestSwiftOnFile(Base):
|
||||
self.assert_status(201)
|
||||
file_info = file_item.info()
|
||||
fhOnMountPoint = open(os.path.join(self.env.root_dir,
|
||||
self.env.account.name, self.env.container.name,
|
||||
'AUTH_' + self.env.account.name,
|
||||
self.env.container.name,
|
||||
file_name), 'r')
|
||||
data_read_from_mountP = fhOnMountPoint.read()
|
||||
md5_returned = hashlib.md5(data_read_from_mountP).hexdigest()
|
||||
|
Loading…
Reference in New Issue
Block a user