def _load_dynamic_class(self, module_name, class_prefix, base_name, namespace): """Try to load a datastore specific class if it exists; use the default otherwise. """ try: # This is for overridden Runner classes impl = self._build_class_path(module_name, class_prefix, base_name) return Strategy.get_strategy(impl, namespace) except ImportError: pass try: # This is for overridden Helper classes module = module_name.replace('test', class_prefix.lower()) impl = self._build_class_path(module, class_prefix, base_name, strip_test=True) return Strategy.get_strategy(impl, namespace) except ImportError: # Just import the base class impl = self._build_class_path(module_name, '', base_name) return Strategy.get_strategy(impl, namespace)
def get_restore_strategy(restore_driver, ns=__name__): LOG.debug("Getting restore strategy: %s." % restore_driver) return Strategy.get_strategy(restore_driver, ns)
def get_replication_strategy(replication_driver, ns=__name__): LOG.debug("Getting replication strategy: %s.", replication_driver) return Strategy.get_strategy(replication_driver, ns)
def get_backup_strategy(backup_driver, ns=__name__): LOG.debug("Getting backup strategy: %s" % backup_driver) return Strategy.get_strategy(backup_driver, ns)
def get_storage_strategy(storage_driver, ns=__name__): LOG.debug("Getting storage strategy: %s" % storage_driver) return Strategy.get_strategy(storage_driver, ns)
def get_strategy_cls(replication_driver, ns=__name__): return Strategy.get_strategy(replication_driver, ns)