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
This commit is contained in:
Justin Hammond 2012-12-17 11:07:05 -06:00
parent aaae75dc35
commit aef4f3c40a

View File

@ -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()