Fix bank and protection plugins not being successfully loaded
Change-Id: I51420082f78e790f4c22dbb06972fe8f59fd439f Closes-Bug:#1587433
This commit is contained in:
parent
d4850d4d2c
commit
c589534338
|
@ -2,8 +2,18 @@
|
|||
name = OS Infra Provider
|
||||
description = This provider uses OpenStack's own services (swift, cinder) as storage
|
||||
id = cf56bd3e-97a7-4078-b6d5-f36246333fd9
|
||||
# TODO(yuvalbr)
|
||||
# bank = swift
|
||||
# plugin = cinder_backup
|
||||
# plugin = glance_backup
|
||||
# plugin = neutron_backup
|
||||
|
||||
plugin=smaug-volume-protection-plugin
|
||||
bank=smaug-swift-bank-plugin
|
||||
|
||||
#[swift_client]
|
||||
#swift_auth_url=http://162.3.111.250:5000/v2.0/
|
||||
#swift_auth_version=2
|
||||
#swift_user=admin
|
||||
#swift_key=password
|
||||
#swift_tenant_name=admin
|
||||
|
||||
#[swift_bank_plugin]
|
||||
#lease_expire_window=100
|
||||
#lease_renew_window=100
|
||||
#lease_validity_window=100
|
|
@ -41,7 +41,7 @@ smaug.database.migration_backend =
|
|||
sqlalchemy = oslo_db.sqlalchemy.migration
|
||||
smaug.protections =
|
||||
smaug-swift-bank-plugin = smaug.services.protection.bank_plugins.swift_bank_plugin:SwiftBankPlugin
|
||||
smaug-volume-protection-plugin = smaug.services.protection.plugins.cinder_backup_plugin:CinderBackupPlugin
|
||||
smaug-volume-protection-plugin = smaug.services.protection.protection_plugins.volume.cinder_protection_plugin:CinderProtectionPlugin
|
||||
smaug.provider =
|
||||
provider-registry = smaug.services.protection.provider:ProviderRegistry
|
||||
|
||||
|
|
|
@ -71,16 +71,6 @@ global_opts = [
|
|||
choices=['noauth', 'keystone'],
|
||||
help='The strategy to use for auth. Supports noauth or '
|
||||
'keystone.'),
|
||||
cfg.IntOpt('lease_renew_window',
|
||||
default=120,
|
||||
help='period for bank lease, in seconds, '
|
||||
'between bank lease client renew the lease'),
|
||||
cfg.IntOpt('lease_expire_window',
|
||||
default=600,
|
||||
help='expired_window for bank lease, in seconds'),
|
||||
cfg.IntOpt('lease_validity_window',
|
||||
default=100,
|
||||
help='validity_window for bank lease, in seconds'),
|
||||
]
|
||||
|
||||
CONF.register_opts(global_opts)
|
||||
|
|
|
@ -33,25 +33,41 @@ swift_bank_plugin_opts = [
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
lease_opt = [cfg.IntOpt('lease_expire_window',
|
||||
default=600,
|
||||
help='expired_window for bank lease, in seconds'),
|
||||
cfg.IntOpt('lease_renew_window',
|
||||
default=120,
|
||||
help='period for bank lease, in seconds, '
|
||||
'between bank lease client renew the lease'),
|
||||
cfg.IntOpt('lease_validity_window',
|
||||
default=100,
|
||||
help='validity_window for bank lease, in seconds'), ]
|
||||
|
||||
|
||||
class SwiftConnectionFailed(exception.SmaugException):
|
||||
message = _("Connection to swift failed: %(reason)s")
|
||||
|
||||
|
||||
class SwiftBankPlugin(BankPlugin, LeasePlugin):
|
||||
def __init__(self, config, context):
|
||||
def __init__(self, config, context=None):
|
||||
super(SwiftBankPlugin, self).__init__(config)
|
||||
self._config.register_opts(swift_bank_plugin_opts,
|
||||
"swift_bank_plugin")
|
||||
self._config.register_opts(lease_opt,
|
||||
"swift_bank_plugin")
|
||||
self.bank_object_container = \
|
||||
self._config.swift_bank_plugin.bank_swift_object_container
|
||||
self.lease_expire_window = self._config.lease_expire_window
|
||||
self.lease_renew_window = self._config.lease_renew_window
|
||||
self.lease_expire_window = \
|
||||
self._config.swift_bank_plugin.lease_expire_window
|
||||
self.lease_renew_window = \
|
||||
self._config.swift_bank_plugin.lease_renew_window
|
||||
self.context = context
|
||||
# TODO(luobin):
|
||||
# init lease_validity_window
|
||||
# according to lease_renew_window if not configured
|
||||
self.lease_validity_window = self._config.lease_validity_window
|
||||
self.lease_validity_window = \
|
||||
self._config.swift_bank_plugin.lease_validity_window
|
||||
|
||||
# TODO(luobin): create a uuid of this bank_plugin
|
||||
self.owner_id = str(uuid.uuid4())
|
||||
|
|
|
@ -127,6 +127,7 @@ def get_bool_param(param_string, params):
|
|||
|
||||
def load_plugin(namespace, plugin_name, *args, **kwargs):
|
||||
try:
|
||||
LOG.debug('Start load plugin %s. ', plugin_name)
|
||||
# Try to resolve plugin by name
|
||||
mgr = driver.DriverManager(namespace, plugin_name)
|
||||
plugin_class = mgr.driver
|
||||
|
|
Loading…
Reference in New Issue