Fix image restore failed with file system bank

Change-Id: I98cc8abb445555d2ef23e5e4c5508bb2085f35b7
Closes-Bug: #1735877
This commit is contained in:
jiaopengju 2017-12-27 12:37:52 +08:00
parent d565afe9d0
commit a6b174d821
2 changed files with 5 additions and 3 deletions

View File

@ -186,4 +186,6 @@ class FileSystemBankPlugin(BankPlugin):
LOG.error("List objects failed. err: %s", err)
raise exception.BankListObjectsFailed(reason=err)
else:
if prefix is not None:
file_lists = [(prefix + file_name) for file_name in file_lists]
return file_lists[-limit:] if limit is not None else file_lists

View File

@ -54,10 +54,10 @@ class FileSystemBankPluginTest(base.TestCase):
def test_list_objects(self):
self.fs_bank_plugin.update_object("/list/key-1", "value-1")
self.fs_bank_plugin.update_object("/list/key-2", "value-2")
objects = self.fs_bank_plugin.list_objects(prefix="/list")
objects = self.fs_bank_plugin.list_objects(prefix="/list/")
self.assertEqual(2, len(objects))
self.assertIn('key-1', objects)
self.assertIn('key-2', objects)
self.assertIn('/list/key-1', objects)
self.assertIn('/list/key-2', objects)
def test_update_object(self):
self.fs_bank_plugin.update_object("/key-1", "value-1")