diff --git a/swift/obj/diskfile.py b/swift/obj/diskfile.py index 49deb36f67..7f9135f229 100644 --- a/swift/obj/diskfile.py +++ b/swift/obj/diskfile.py @@ -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, diff --git a/test/unit/obj/test_diskfile.py b/test/unit/obj/test_diskfile.py index 0a92f184f2..cc7d97d6aa 100644 --- a/test/unit/obj/test_diskfile.py +++ b/test/unit/obj/test_diskfile.py @@ -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