From: Tim Smith Date: Sun, 25 Aug 2013 01:07:23 +0000 (-0700) Subject: Autoload Nova extensions X-Git-Tag: 2014.1~127^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=230fe1e5ef53d3884f09b59f1c999a1046b23deb;p=openstack-build%2Fheat-build.git Autoload Nova extensions 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 --- diff --git a/heat/engine/clients.py b/heat/engine/clients.py index 7866973f..6deae5b1 100644 --- a/heat/engine/clients.py +++ b/heat/engine/clients.py @@ -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)