diff --git a/cinderclient/base.py b/cinderclient/base.py index c6a22b294..bf74dda6a 100644 --- a/cinderclient/base.py +++ b/cinderclient/base.py @@ -44,7 +44,7 @@ def getid(obj): return obj -class Manager(utils.HookableMixin): +class Manager(common_base.HookableMixin): """ Managers interact with a particular type of API (servers, flavors, images, etc.) and provide CRUD operations for them. diff --git a/cinderclient/extension.py b/cinderclient/extension.py index 84c67e979..1ea062f47 100644 --- a/cinderclient/extension.py +++ b/cinderclient/extension.py @@ -14,10 +14,11 @@ # under the License. from cinderclient import base +from cinderclient.openstack.common.apiclient import base as common_base from cinderclient import utils -class Extension(utils.HookableMixin): +class Extension(common_base.HookableMixin): """Extension descriptor.""" SUPPORTED_HOOKS = ('__pre_parse_args__', '__post_parse_args__') diff --git a/cinderclient/utils.py b/cinderclient/utils.py index 13baf11e0..9941bbf55 100644 --- a/cinderclient/utils.py +++ b/cinderclient/utils.py @@ -228,36 +228,6 @@ def find_volume(cs, volume): return find_resource(cs.volumes, volume) -def _format_servers_list_networks(server): - output = [] - for (network, addresses) in list(server.networks.items()): - if len(addresses) == 0: - continue - addresses_csv = ', '.join(addresses) - group = "%s=%s" % (network, addresses_csv) - output.append(group) - - return '; '.join(output) - - -class HookableMixin(object): - """Mixin so classes can register and run hooks.""" - _hooks_map = {} - - @classmethod - def add_hook(cls, hook_type, hook_func): - if hook_type not in cls._hooks_map: - cls._hooks_map[hook_type] = [] - - cls._hooks_map[hook_type].append(hook_func) - - @classmethod - def run_hooks(cls, hook_type, *args, **kwargs): - hook_funcs = cls._hooks_map.get(hook_type) or [] - for hook_func in hook_funcs: - hook_func(*args, **kwargs) - - def safe_issubclass(*args): """Like issubclass, but will just return False if not a class."""