From aef4f3c40a05a35759054059a44dda8a478da443 Mon Sep 17 00:00:00 2001 From: Justin Hammond Date: Mon, 17 Dec 2012 11:07:05 -0600 Subject: [PATCH] Added conf support for security groups Modified the way nova.compute.api.API loads the security group API. Previously it would accept a named-parameter and if that was None, default to SecurityGroupAPI. It still accepts a named-parameter but if that is None, then it will attempt to load the API from CONF, and then default to SecurityGroupAPI. The basic use-case should not be altered by these changes. Implements: blueprint nova-securitygroups-expansion Change-Id: Ib252a0755f320289c3c7cb6518d55e63d3392789 --- nova/compute/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nova/compute/api.py b/nova/compute/api.py index 19f5a3a26867..cc02e4a82d2d 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -81,6 +81,9 @@ compute_opts = [ cfg.StrOpt('security_group_handler', default='nova.network.sg.NullSecurityGroupHandler', help='The full class name of the security group handler class'), + cfg.StrOpt('security_group_api', + default='nova.compute.api.SecurityGroupAPI', + help='The full class name of the security API class'), ] @@ -165,7 +168,9 @@ class API(base.Base): self.network_api = network_api or network.API() self.volume_api = volume_api or volume.API() - self.security_group_api = security_group_api or SecurityGroupAPI() + self.security_group_api = (security_group_api or + importutils.import_object( + CONF.security_group_api)) self.sgh = importutils.import_object(CONF.security_group_handler) self.consoleauth_rpcapi = consoleauth_rpcapi.ConsoleAuthAPI() self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI()