@ -43,20 +43,26 @@ from nova import wsgi as base_wsgi
api_opts = [
cfg . BoolOpt ( ' enabled ' ,
default = True ,
help = ' DEPRECATED: Whether the V 3 API is enabled or not. '
' This option will be removed in the 14.0.0 " N " releas e.' ,
deprecated_for_removal = True ),
help = ' DEPRECATED: Whether the V 2.1 API is enabled or not. '
' This option will be removed in the near futur e.' ,
deprecated_for_removal = True , deprecated_group = ' osapi_v21 ' ),
cfg . ListOpt ( ' extensions_blacklist ' ,
default = [ ] ,
help = ' A list of v3 API extensions to never load. '
' Specify the extension aliases here. ' ) ,
help = ' DEPRECATED: A list of v2.1 API extensions to never '
' load. Specify the extension aliases here. '
' This option will be removed in the near future. '
' After that point you have to run all of the API. ' ,
deprecated_for_removal = True , deprecated_group = ' osapi_v21 ' ) ,
cfg . ListOpt ( ' extensions_whitelist ' ,
default = [ ] ,
help = ' If the list is not empty then a v3 API extension '
' will only be loaded if it exists in this list. Specify '
' the extension aliases here. ' )
help = ' DEPRECATED: If the list is not empty then a v2.1 '
' API extension will only be loaded if it exists in this '
' list. Specify the extension aliases here. '
' This option will be removed in the near future. '
' After that point you have to run all of the API. ' ,
deprecated_for_removal = True , deprecated_group = ' osapi_v21 ' )
]
api_opts_group = cfg . OptGroup ( name = ' osapi_v3 ' , title = ' API v3 Options ' )
api_opts_group = cfg . OptGroup ( name = ' osapi_v 21' , title = ' API v2.1 Options' )
LOG = logging . getLogger ( __name__ )
CONF = cfg . CONF
@ -323,27 +329,36 @@ class APIRouterV21(base_wsgi.Router):
# Check whitelist is either empty or if not then the extension
# is in the whitelist
if ( not CONF . osapi_v 3 . extensions_whitelist or
ext . obj . alias in CONF . osapi_v 3 . extensions_whitelist ) :
if ( not CONF . osapi_v 21 . extensions_whitelist or
ext . obj . alias in CONF . osapi_v 21 . extensions_whitelist ) :
# Check the extension is not in the blacklist
if ext . obj . alias not in CONF . osapi_v3 . extensions_blacklist :
blacklist = CONF . osapi_v21 . extensions_blacklist
if ext . obj . alias not in blacklist :
return self . _register_extension ( ext )
return False
if not CONF . osapi_v 3 . enabled :
if not CONF . osapi_v 21 . enabled :
LOG . info ( _LI ( " V3 API has been disabled by configuration " ) )
LOG . warning ( _LW ( " In the M release you must run the v2.1 API. " ) )
return
if ( CONF . osapi_v21 . extensions_blacklist or
CONF . osapi_v21 . extensions_whitelist ) :
LOG . warning (
_LW ( ' In the M release you must run all of the API. '
' The concept of API extensions will be removed from '
' the codebase to ensure there is a single Compute API. ' ) )
self . init_only = init_only
LOG . debug ( " v3 API Extension Blacklist: %s " ,
CONF . osapi_v3 . extensions_blacklist )
CONF . osapi_v 21 . extensions_blacklist )
LOG . debug ( " v3 API Extension Whitelist: %s " ,
CONF . osapi_v3 . extensions_whitelist )
CONF . osapi_v 21 . extensions_whitelist )
in_blacklist_and_whitelist = set (
CONF . osapi_v 3 . extensions_whitelist ) . intersection (
CONF . osapi_v 3 . extensions_blacklist )
CONF . osapi_v 21 . extensions_whitelist ) . intersection (
CONF . osapi_v 21 . extensions_blacklist )
if len ( in_blacklist_and_whitelist ) != 0 :
LOG . warning ( _LW ( " Extensions in both blacklist and whitelist: %s " ) ,
list ( in_blacklist_and_whitelist ) )