Add multi-store support

Added multi-store support. User can now use '--backend'
option to pass desired store while creating, uploading or
importing image to speific store backend.

Added new command 'stores-info' which will return available
stores information to the user.

Related to blueprint multi-store
Change-Id: I7370094fc4ed47205b5a86a18b22aaa7b9457e5b
This commit is contained in:
Abhishek Kekane
2018-05-30 09:38:37 +00:00
parent 71abbfca2a
commit 71bfd7bfad
3 changed files with 113 additions and 11 deletions
+6 -4
View File
@@ -95,6 +95,7 @@ class ShellV2Test(testtools.TestCase):
# dict directly, it throws an AttributeError.
class Args(object):
def __init__(self, entries):
self.backend = None
self.__dict__.update(entries)
return Args(args)
@@ -1102,7 +1103,8 @@ class ShellV2Test(testtools.TestCase):
utils.get_data_file = mock.Mock(return_value='testfile')
mocked_upload.return_value = None
test_shell.do_image_upload(self.gc, args)
mocked_upload.assert_called_once_with('IMG-01', 'testfile', 1024)
mocked_upload.assert_called_once_with('IMG-01', 'testfile', 1024,
backend=None)
@mock.patch('glanceclient.common.utils.exit')
def test_neg_image_import_not_available(self, mock_utils_exit):
@@ -1263,7 +1265,7 @@ class ShellV2Test(testtools.TestCase):
mock_import.return_value = None
test_shell.do_image_import(self.gc, args)
mock_import.assert_called_once_with(
'IMG-01', 'glance-direct', None)
'IMG-01', 'glance-direct', None, backend=None)
def test_image_import_web_download(self):
args = self._make_args(
@@ -1281,7 +1283,7 @@ class ShellV2Test(testtools.TestCase):
test_shell.do_image_import(self.gc, args)
mock_import.assert_called_once_with(
'IMG-01', 'web-download',
'http://example.com/image.qcow')
'http://example.com/image.qcow', backend=None)
@mock.patch('glanceclient.common.utils.print_image')
def test_image_import_no_print_image(self, mocked_utils_print_image):
@@ -1299,7 +1301,7 @@ class ShellV2Test(testtools.TestCase):
mock_import.return_value = None
test_shell.do_image_import(self.gc, args)
mock_import.assert_called_once_with(
'IMG-02', 'glance-direct', None)
'IMG-02', 'glance-direct', None, backend=None)
mocked_utils_print_image.assert_not_called()
def test_image_download(self):