# so nova can update it's cache.
# notify_nova_on_port_data_changes = True
-# URL for connection to nova (Only supports one nova region currently).
-# nova_url = http://127.0.0.1:8774/v2
-
-# Name of nova region to use. Useful if keystone manages more than one region
-# nova_region_name =
-
-# Username for connection to nova in admin context
-# nova_admin_username =
-
-# The uuid of the admin nova tenant
-# nova_admin_tenant_id =
-
-# The name of the admin nova tenant. If the uuid of the admin nova tenant
-# is set, this is optional. Useful for cases where the uuid of the admin
-# nova tenant is not available when configuration is being done.
-# nova_admin_tenant_name =
-
-# Password for connection to nova in admin context.
-# nova_admin_password =
-
-# Authorization URL for connection to nova in admin context.
-# nova_admin_auth_url =
-
-# CA file for novaclient to verify server certificates
-# nova_ca_certificates_file =
-
-# Boolean to control ignoring SSL errors on the nova url
-# nova_api_insecure = False
-
# Number of seconds between sending events to nova if there are any events to send
# send_events_interval = 2
cfg.BoolOpt('notify_nova_on_port_data_changes', default=True,
help=_("Send notification to nova when port data (fixed_ips/"
"floatingip) changes so nova can update its cache.")),
- cfg.StrOpt('nova_url',
- default='http://127.0.0.1:8774/v2',
- help=_('URL for connection to nova. '
- 'Deprecated in favour of an auth plugin in [nova].')),
- cfg.StrOpt('nova_admin_username',
- help=_('Username for connecting to nova in admin context. '
- 'Deprecated in favour of an auth plugin in [nova].')),
- cfg.StrOpt('nova_admin_password',
- help=_('Password for connection to nova in admin context. '
- 'Deprecated in favour of an auth plugin in [nova].'),
- secret=True),
- cfg.StrOpt('nova_admin_tenant_id',
- help=_('The uuid of the admin nova tenant. '
- 'Deprecated in favour of an auth plugin in [nova].')),
- cfg.StrOpt('nova_admin_tenant_name',
- help=_('The name of the admin nova tenant. '
- 'Deprecated in favour of an auth plugin in [nova].')),
- cfg.StrOpt('nova_admin_auth_url',
- default='http://localhost:5000/v2.0',
- help=_('Authorization URL for connecting to nova in admin '
- 'context. '
- 'Deprecated in favour of an auth plugin in [nova].')),
cfg.IntOpt('send_events_interval', default=2,
help=_('Number of seconds between sending events to nova if '
'there are any events to send.')),
NOVA_CONF_SECTION = 'nova'
-nova_deprecated_opts = {
- 'cafile': [cfg.DeprecatedOpt('nova_ca_certificates_file', 'DEFAULT')],
- 'insecure': [cfg.DeprecatedOpt('nova_api_insecure', 'DEFAULT')],
-}
-ks_session.Session.register_conf_options(cfg.CONF, NOVA_CONF_SECTION,
- deprecated_opts=nova_deprecated_opts)
+ks_session.Session.register_conf_options(cfg.CONF, NOVA_CONF_SECTION)
auth.register_conf_options(cfg.CONF, NOVA_CONF_SECTION)
nova_opts = [
cfg.StrOpt('region_name',
- deprecated_name='nova_region_name',
- deprecated_group='DEFAULT',
help=_('Name of nova region to use. Useful if keystone manages'
' more than one region.')),
]
# under the License.
from keystoneclient import auth as ks_auth
-from keystoneclient.auth.identity import v2 as v2_auth
from keystoneclient import session as ks_session
from novaclient import client as nova_client
from novaclient import exceptions as nova_exceptions
NOVA_API_VERSION = "2"
-class DefaultAuthPlugin(v2_auth.Password):
- """A wrapper around standard v2 user/pass to handle bypass url.
-
- This is only necessary because novaclient doesn't support endpoint_override
- yet - bug #1403329.
-
- When this bug is fixed we can pass the endpoint_override to the client
- instead and remove this class.
- """
-
- def __init__(self, **kwargs):
- self._endpoint_override = kwargs.pop('endpoint_override', None)
- super(DefaultAuthPlugin, self).__init__(**kwargs)
-
- def get_endpoint(self, session, **kwargs):
- if self._endpoint_override:
- return self._endpoint_override
-
- return super(DefaultAuthPlugin, self).get_endpoint(session, **kwargs)
-
-
class Notifier(object):
def __init__(self):
# authenticating the exact same thing len(controllers) times. This
# should be an easy thing to optimize.
auth = ks_auth.load_from_conf_options(cfg.CONF, 'nova')
- endpoint_override = None
-
- if not auth:
- LOG.warning(_LW('Authenticating to nova using nova_admin_* options'
- ' is deprecated. This should be done using'
- ' an auth plugin, like password'))
-
- if cfg.CONF.nova_admin_tenant_id:
- endpoint_override = "%s/%s" % (cfg.CONF.nova_url,
- cfg.CONF.nova_admin_tenant_id)
-
- auth = DefaultAuthPlugin(
- auth_url=cfg.CONF.nova_admin_auth_url,
- username=cfg.CONF.nova_admin_username,
- password=cfg.CONF.nova_admin_password,
- tenant_id=cfg.CONF.nova_admin_tenant_id,
- tenant_name=cfg.CONF.nova_admin_tenant_name,
- endpoint_override=endpoint_override)
session = ks_session.Session.load_from_conf_options(cfg.CONF,
'nova',