Merge "pickle_async_update should create tmp_dir"

This commit is contained in:
Jenkins 2016-07-05 18:40:08 +00:00 committed by Gerrit Code Review
commit 79be80f126
2 changed files with 3 additions and 5 deletions

View File

@ -1115,12 +1115,14 @@ class BaseDiskFileManager(object):
"""
device_path = self.construct_dev_path(device)
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)
write_pickle(
data,
os.path.join(async_dir, ohash[-3:], ohash + '-' +
Timestamp(timestamp).internal),
os.path.join(device_path, get_tmp_dir(policy)))
tmp_dir)
self.logger.increment('async_pendings')
def get_diskfile(self, device, partition, account, container, obj,

View File

@ -246,10 +246,6 @@ class TestDiskFileModuleMethods(unittest.TestCase):
self.assertFalse(os.path.isdir(tmp_path))
pickle_args = (self.existing_device, 'a', 'c', 'o',
'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
self.df_mgr.pickle_async_update(*pickle_args)
# check tempdir