Fix image protection plugins not being successfully loaded

Change-Id: Ibf47a0bf59d3f7bb6006e68823b1591f2d4a62be
Closes-Bug:#1598811
This commit is contained in:
chenying 2016-07-07 10:36:09 +08:00
parent 350dda0417
commit 34ce246195
3 changed files with 12 additions and 8 deletions

View File

@ -42,6 +42,7 @@ smaug.database.migration_backend =
smaug.protections =
smaug-swift-bank-plugin = smaug.services.protection.bank_plugins.swift_bank_plugin:SwiftBankPlugin
smaug-volume-protection-plugin = smaug.services.protection.protection_plugins.volume.cinder_protection_plugin:CinderProtectionPlugin
smaug-image-protection-plugin = smaug.services.protection.protection_plugins.image.image_protection_plugin:GlanceProtectionPlugin
smaug.provider =
provider-registry = smaug.services.protection.provider:ProviderRegistry
smaug.protectables =

View File

@ -40,8 +40,8 @@ LOG = logging.getLogger(__name__)
class GlanceProtectionPlugin(BaseProtectionPlugin):
_SUPPORT_RESOURCE_TYPES = [constants.IMAGE_RESOURCE_TYPE]
def __init__(self):
super(GlanceProtectionPlugin, self).__init__()
def __init__(self, config=None):
super(GlanceProtectionPlugin, self).__init__(config)
self._tp = eventlet.GreenPool()
self.data_block_size_bytes = CONF.backup_image_object_size
@ -57,13 +57,13 @@ class GlanceProtectionPlugin(BaseProtectionPlugin):
except Exception:
return "undefined"
def get_options_schema(self):
def get_options_schema(self, resources_type):
return image_schemas.OPTIONS_SCHEMA
def get_restore_schema(self):
def get_restore_schema(self, resources_type):
return image_schemas.RESTORE_SCHEMA
def get_saved_info_schema(self):
def get_saved_info_schema(self, resources_type):
return image_schemas.SAVED_INFO_SCHEMA
def get_saved_info(self, metadata_store, resource):

View File

@ -99,15 +99,18 @@ class GlanceProtectionPluginTest(base.TestCase):
self.assertEqual(status, constants.RESOURCE_STATUS_PROTECTING)
def test_get_options_schema(self):
options_schema = self.plugin.get_options_schema()
options_schema = self.plugin.get_options_schema(
constants.IMAGE_RESOURCE_TYPE)
self.assertEqual(options_schema, image_plugin_schemas.OPTIONS_SCHEMA)
def test_get_restore_schema(self):
options_schema = self.plugin.get_restore_schema()
options_schema = self.plugin.get_restore_schema(
constants.IMAGE_RESOURCE_TYPE)
self.assertEqual(options_schema, image_plugin_schemas.RESTORE_SCHEMA)
def test_get_saved_info_schema(self):
options_schema = self.plugin.get_saved_info_schema()
options_schema = self.plugin.get_saved_info_schema(
constants.IMAGE_RESOURCE_TYPE)
self.assertEqual(options_schema,
image_plugin_schemas.SAVED_INFO_SCHEMA)