Merge "pickle_async_update should create tmp_dir"
This commit is contained in:
commit
79be80f126
@ -1115,12 +1115,14 @@ class BaseDiskFileManager(object):
|
|||||||
"""
|
"""
|
||||||
device_path = self.construct_dev_path(device)
|
device_path = self.construct_dev_path(device)
|
||||||
async_dir = os.path.join(device_path, get_async_dir(policy))
|
async_dir = os.path.join(device_path, get_async_dir(policy))
|
||||||
|
tmp_dir = os.path.join(device_path, get_tmp_dir(policy))
|
||||||
|
mkdirs(tmp_dir)
|
||||||
ohash = hash_path(account, container, obj)
|
ohash = hash_path(account, container, obj)
|
||||||
write_pickle(
|
write_pickle(
|
||||||
data,
|
data,
|
||||||
os.path.join(async_dir, ohash[-3:], ohash + '-' +
|
os.path.join(async_dir, ohash[-3:], ohash + '-' +
|
||||||
Timestamp(timestamp).internal),
|
Timestamp(timestamp).internal),
|
||||||
os.path.join(device_path, get_tmp_dir(policy)))
|
tmp_dir)
|
||||||
self.logger.increment('async_pendings')
|
self.logger.increment('async_pendings')
|
||||||
|
|
||||||
def get_diskfile(self, device, partition, account, container, obj,
|
def get_diskfile(self, device, partition, account, container, obj,
|
||||||
|
@ -246,10 +246,6 @@ class TestDiskFileModuleMethods(unittest.TestCase):
|
|||||||
self.assertFalse(os.path.isdir(tmp_path))
|
self.assertFalse(os.path.isdir(tmp_path))
|
||||||
pickle_args = (self.existing_device, 'a', 'c', 'o',
|
pickle_args = (self.existing_device, 'a', 'c', 'o',
|
||||||
'data', 0.0, policy)
|
'data', 0.0, policy)
|
||||||
# async updates don't create their tmpdir on their own
|
|
||||||
self.assertRaises(OSError, self.df_mgr.pickle_async_update,
|
|
||||||
*pickle_args)
|
|
||||||
os.makedirs(tmp_path)
|
|
||||||
# now create a async update
|
# now create a async update
|
||||||
self.df_mgr.pickle_async_update(*pickle_args)
|
self.df_mgr.pickle_async_update(*pickle_args)
|
||||||
# check tempdir
|
# check tempdir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user