update to latest swift code
More updates will most likely be needed but these updates allow for some basic of functionality. Change-Id: I40ce259a0954be490ece06e93dc0a652c4cf3362 Signed-off-by: Thiago da Silva <thiago@redhat.com>
This commit is contained in:
parent
1164a57616
commit
0a11da7bb0
@ -100,11 +100,12 @@ class RadosFileSystem(object):
|
||||
|
||||
def write(self, obj, offset, data):
|
||||
try:
|
||||
return self._ioctx.write(obj, data, offset)
|
||||
self._ioctx.write(obj, data, offset)
|
||||
except self._fs.RADOS.NoSpace:
|
||||
raise DiskFileNoSpace()
|
||||
except Exception:
|
||||
raise DiskFileError()
|
||||
return len(data)
|
||||
|
||||
def read(self, obj, off):
|
||||
return self._ioctx.read(obj, offset=off)
|
||||
@ -163,6 +164,9 @@ class DiskFileWriter(object):
|
||||
metadata['name'] = self._name
|
||||
self._fs.put_object(self._name, metadata)
|
||||
|
||||
def commit(self, timestamp):
|
||||
pass
|
||||
|
||||
|
||||
class DiskFileReader(object):
|
||||
"""
|
||||
|
@ -51,7 +51,8 @@ class ObjectController(server.ObjectController):
|
||||
container, obj, **kwargs)
|
||||
|
||||
def async_update(self, op, account, container, obj, host, partition,
|
||||
contdevice, headers_out, objdevice):
|
||||
contdevice, headers_out, objdevice, policy,
|
||||
logger_thread_locals=None):
|
||||
"""
|
||||
Sends or saves an async update.
|
||||
|
||||
@ -66,7 +67,7 @@ class ObjectController(server.ObjectController):
|
||||
request
|
||||
:param objdevice: device name that the object is in
|
||||
"""
|
||||
headers_out['user-agent'] = 'obj-server %s' % os.getpid()
|
||||
headers_out['user-agent'] = 'object-server %s' % os.getpid()
|
||||
full_path = '/%s/%s/%s' % (account, container, obj)
|
||||
if all([host, partition, contdevice]):
|
||||
try:
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from mock import call
|
||||
from mock import call, patch
|
||||
import cPickle as pickle
|
||||
import unittest
|
||||
from hashlib import md5
|
||||
@ -397,23 +397,24 @@ class TestRadosDiskFile(unittest.TestCase):
|
||||
|
||||
writes = []
|
||||
|
||||
def ioctx_write(obj, data, offset):
|
||||
def mock_write(self, obj, offset, data):
|
||||
writes.append((data, offset))
|
||||
return 2
|
||||
|
||||
self.ioctx.write = ioctx_write
|
||||
with self.df.create() as writer:
|
||||
assert(writer.write(fcont) == len(fcont))
|
||||
with patch('swift_ceph_backend.rados_diskfile.'
|
||||
'RadosFileSystem._radosfs.write', mock_write):
|
||||
with self.df.create() as writer:
|
||||
assert(writer.write(fcont) == len(fcont))
|
||||
|
||||
check_list = [
|
||||
(fcont, 0),
|
||||
(fcont[2:], 2),
|
||||
(fcont[4:], 4),
|
||||
(fcont[6:], 6),
|
||||
(fcont[8:], 8)]
|
||||
assert(writes == check_list)
|
||||
self._assert_if_rados_not_opened()
|
||||
self._assert_if_rados_not_closed()
|
||||
check_list = [
|
||||
(fcont, 0),
|
||||
(fcont[2:], 2),
|
||||
(fcont[4:], 4),
|
||||
(fcont[6:], 6),
|
||||
(fcont[8:], 8)]
|
||||
assert(writes == check_list)
|
||||
self._assert_if_rados_not_opened()
|
||||
self._assert_if_rados_not_closed()
|
||||
|
||||
def test_df_writer_put(self):
|
||||
meta = {'Content-Length': 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user