summaryrefslogtreecommitdiff
path: root/openstackclient/volume
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-04-19 03:23:12 +0000
committerGerrit Code Review <review@openstack.org>2015-04-19 03:23:12 +0000
commita5e79d58ae508e218a113bfa3976fae369980688 (patch)
tree34bd042a6a7ffa305c165f6284c657606f3eee25 /openstackclient/volume
parent98604abcda52adffcfda866dc472b23714bfac70 (diff)
parentf43c1f76559ae8b5b738b7ae8b69b15c379f9145 (diff)
downloadpython-openstackclient-a5e79d58ae508e218a113bfa3976fae369980688.tar.gz
Merge "Defer client imports"
Diffstat (limited to 'openstackclient/volume')
-rw-r--r--openstackclient/volume/client.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py
index 21072aeb..a7b64def 100644
--- a/openstackclient/volume/client.py
+++ b/openstackclient/volume/client.py
@@ -15,17 +15,8 @@
import logging
-from cinderclient import extension
-from cinderclient.v1.contrib import list_extensions
-from cinderclient.v1 import volume_snapshots
-from cinderclient.v1 import volumes
-
from openstackclient.common import utils
-# Monkey patch for v1 cinderclient
-volumes.Volume.NAME_ATTR = 'display_name'
-volume_snapshots.Snapshot.NAME_ATTR = 'display_name'
-
LOG = logging.getLogger(__name__)
DEFAULT_VOLUME_API_VERSION = '1'
@@ -38,6 +29,17 @@ API_VERSIONS = {
def make_client(instance):
"""Returns a volume service client."""
+
+ # Defer client imports until we actually need them
+ from cinderclient import extension
+ from cinderclient.v1.contrib import list_extensions
+ from cinderclient.v1 import volume_snapshots
+ from cinderclient.v1 import volumes
+
+ # Monkey patch for v1 cinderclient
+ volumes.Volume.NAME_ATTR = 'display_name'
+ volume_snapshots.Snapshot.NAME_ATTR = 'display_name'
+
volume_client = utils.get_client_class(
API_NAME,
instance._api_version[API_NAME],