Fix backup_api_class doesn't work
The backup_api_class should be called after the CONF initialised. Change-Id: Ifd31c855a1647faa7718d36b6fa13f7ae83a49eb Closes-bug: #1689523
This commit is contained in:
parent
9da1945871
commit
788ab6af19
@ -23,4 +23,7 @@ from cinder.common import config
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
API = importutils.import_class(CONF.backup_api_class)
|
||||
|
||||
def API(*args, **kwargs):
|
||||
class_name = CONF.backup_api_class
|
||||
return importutils.import_object(class_name, *args, **kwargs)
|
||||
|
@ -19,7 +19,7 @@ import webob
|
||||
|
||||
from cinder.api.openstack import api_version_request as api_version
|
||||
from cinder.api.v3 import router as router_v3
|
||||
from cinder import backup
|
||||
from cinder.backup import api as backup_api
|
||||
from cinder import context
|
||||
from cinder import objects
|
||||
from cinder import test
|
||||
@ -54,8 +54,8 @@ class BackupProjectAttributeTest(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BackupProjectAttributeTest, self).setUp()
|
||||
self.stubs.Set(backup.API, 'get', fake_backup_get)
|
||||
self.stubs.Set(backup.API, 'get_all', fake_backup_get_all)
|
||||
self.stubs.Set(backup_api.API, 'get', fake_backup_get)
|
||||
self.stubs.Set(backup_api.API, 'get_all', fake_backup_get_all)
|
||||
|
||||
def _send_backup_request(self, ctx, detail=False, version='3.18'):
|
||||
req = None
|
||||
|
@ -1380,7 +1380,7 @@ class BackupsAPITestCase(test.TestCase):
|
||||
# Ensure that the original volume name wasn't overridden
|
||||
self.assertEqual(orig_vol_name, restored_vol['display_name'])
|
||||
|
||||
@mock.patch('cinder.backup.API.restore')
|
||||
@mock.patch('cinder.backup.api.API.restore')
|
||||
def test_restore_backup_with_InvalidInput(self,
|
||||
_mock_volume_api_restore):
|
||||
|
||||
@ -1503,7 +1503,7 @@ class BackupsAPITestCase(test.TestCase):
|
||||
|
||||
db.backup_destroy(context.get_admin_context(), backup_id)
|
||||
|
||||
@mock.patch('cinder.backup.API.restore')
|
||||
@mock.patch('cinder.backup.api.API.restore')
|
||||
def test_restore_backup_with_VolumeSizeExceedsAvailableQuota(
|
||||
self,
|
||||
_mock_backup_restore):
|
||||
@ -1536,7 +1536,7 @@ class BackupsAPITestCase(test.TestCase):
|
||||
'2G has been consumed.',
|
||||
res_dict['overLimit']['message'])
|
||||
|
||||
@mock.patch('cinder.backup.API.restore')
|
||||
@mock.patch('cinder.backup.api.API.restore')
|
||||
def test_restore_backup_with_VolumeLimitExceeded(self,
|
||||
_mock_backup_restore):
|
||||
|
||||
|
@ -24,6 +24,7 @@ from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from cinder import backup
|
||||
from cinder.backup import api as backup_api
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder.db.sqlalchemy import api as sqa_api
|
||||
@ -183,7 +184,7 @@ class QuotaIntegrationTestCase(test.TestCase):
|
||||
self.flags(**flag_args)
|
||||
vol_ref = self._create_volume()
|
||||
backup_ref = self._create_backup(vol_ref)
|
||||
with mock.patch.object(backup.API,
|
||||
with mock.patch.object(backup_api.API,
|
||||
'_get_available_backup_service_host') as \
|
||||
mock__get_available_backup_service:
|
||||
mock__get_available_backup_service.return_value = 'host'
|
||||
@ -227,7 +228,7 @@ class QuotaIntegrationTestCase(test.TestCase):
|
||||
def test_too_many_combined_backup_gigabytes(self):
|
||||
vol_ref = self._create_volume(size=10000)
|
||||
backup_ref = self._create_backup(vol_ref)
|
||||
with mock.patch.object(backup.API,
|
||||
with mock.patch.object(backup_api.API,
|
||||
'_get_available_backup_service_host') as \
|
||||
mock__get_available_backup_service:
|
||||
mock__get_available_backup_service.return_value = 'host'
|
||||
@ -273,7 +274,7 @@ class QuotaIntegrationTestCase(test.TestCase):
|
||||
)
|
||||
vol_ref = self._create_volume(size=10)
|
||||
backup_ref = self._create_backup(vol_ref)
|
||||
with mock.patch.object(backup.API,
|
||||
with mock.patch.object(backup_api.API,
|
||||
'_get_available_backup_service_host') as \
|
||||
mock_mock__get_available_backup_service:
|
||||
mock_mock__get_available_backup_service.return_value = 'host'
|
||||
|
Loading…
Reference in New Issue
Block a user