]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Autoload Nova extensions
authorTim Smith <tsmith@gridcentric.com>
Sun, 25 Aug 2013 01:07:23 +0000 (18:07 -0700)
committerTim Smith <tsmith@gridcentric.com>
Mon, 26 Aug 2013 01:18:40 +0000 (18:18 -0700)
This patch adds logic to autoload standard novaclient extensions
(e.g. baremetal) and any third-party extensions that might
be installed. Thus, resource plugins that make use of
installed extensions are able to use the standard OpenStackClients
rather than have to a) subclass and override OpenStackClients
or b) create a shadow nova client within the resource plugin
with the desired extension loaded.

Change-Id: Ifdcaa896babda0e1e7e10a55253a8baa37582264

heat/engine/clients.py

index 7866973f73138dca496003dddb8c70aa76bada5d..6deae5b15f33eae1e1125e63da5e1d9fff5f956f 100644 (file)
@@ -23,6 +23,7 @@ logger = logging.getLogger(__name__)
 
 from heat.common import heat_keystoneclient as hkc
 from novaclient import client as novaclient
+from novaclient import shell as novashell
 try:
     from swiftclient import client as swiftclient
 except ImportError:
@@ -93,12 +94,16 @@ class OpenStackClients(object):
             logger.error("Nova connection failed, no auth_token!")
             return None
 
+        computeshell = novashell.OpenStackComputeShell()
+        extensions = computeshell._discover_extensions("1.1")
+
         args = {
             'project_id': con.tenant,
             'auth_url': con.auth_url,
             'service_type': service_type,
             'username': None,
-            'api_key': None
+            'api_key': None,
+            'extensions': extensions
         }
 
         client = novaclient.Client(1.1, **args)