Charm Interface - Neutron Plugin API Subordinate
Go to file
Nobuto Murata 46e001d36c subordinate_configuration in the interface expects a dict
When a subordinate charm doesn't provide an explicit value for the
optional "subordinate_configuration" arg, the error "TypeError: argument
of type 'NoneType' is not iterable" happends. Because the principal
charm expects it as a dict as documented in the interface. So let's use
a empty dict as the fallback value.

Change-Id: Ib8456ab32ec8ee5bee160d0b38a61b7ee43e16ca
Closes-Bug: #1803040
2018-11-14 10:51:51 +09:00
.gitignore Generl tidy, docstrings, copyright, tox.ini etc 2016-09-12 15:02:22 +00:00
.gitreview Fix repo setup 2018-10-13 09:23:07 +02:00
.zuul.yaml Fix repo setup 2018-10-13 09:23:07 +02:00
copyright Generl tidy, docstrings, copyright, tox.ini etc 2016-09-12 15:02:22 +00:00
interface.yaml Add remote restart support 2016-09-12 09:36:40 +00:00
provides.py subordinate_configuration in the interface expects a dict 2018-11-14 10:51:51 +09:00
README.md README update 2016-09-15 07:38:43 +00:00
test-requirements.txt Generl tidy, docstrings, copyright, tox.ini etc 2016-09-12 15:02:22 +00:00
tox.ini fix tox python3 overrides 2018-10-13 07:43:49 +00:00

Overview

This interface is used for a charm to send configuration information to the neutron-api principle charm and request a restart of a service managed by that charm.

Usage

States

The interface provides the {relation-name}.connected and {relation_name}.available states.

configure_plugin

The configure_plugin method allows the following to be configured in the principle charm:

  • neutron_plugin: Name of the plugin type eg 'ovs', 'odl' etc. This is not currently used in the principle but should be set to something representitve of the plugin type.
  • core_plugin: Value of core_plugin to be set in neutron.conf
  • neutron_plugin_config: File containing plugin config. This config file is appended to the list of configs the neutron services read on startup.
  • service_plugins: Value of service_plugins to be set in neutron.conf
  • subordinate_configuration: Config to be inserted into a configuration file that the principle manages.

Request foo = bar is inserted into the DEFAULT section of neutron.conf

@reactive.when('neutron-plugin-api-subordinate.connected')
def configure_principle(api_principle):
    ...
    inject_config = {
        "neutron-api": {
            "/etc/neutron/neutron.conf": {
                "sections": {
                    'DEFAULT': [
                        ('foo', 'bar')
                    ],
                }
            }
        }
    }
    api_principle.configure_plugin(
        neutron_plugin='odl',
        core_plugin='neutron.plugins.ml2.plugin.Ml2Plugin',
        neutron_plugin_config='/etc/neutron/plugins/ml2/ml2_conf.ini',
        service_plugins='router,firewall,lbaas,vpnaas,metering',
        subordinate_configuration=inject_config)

request_restart

Requesting a restart of all remote services:

@reactive.when('neutron-plugin-api-subordinate.connected')
def remote_restart(api_principle):
    ...
    api_principle.request_restart()

Requesting a restart of a specific type of remote services:

@reactive.when('neutron-plugin-api-subordinate.connected')
def remote_restart(api_principle):
    ...
    api_principle.request_restart(service_type='neutron')

Metadata

To consume this interface in your charm or layer, add the following to layer.yaml:

includes: ['interface:neutron-plugin-api-subordinate']

and add a provides interface of type neutron-plugin-api-subordinate to your charm or layers metadata.yaml eg:

provides:
  neutron-plugin-api-subordinate:
    interface: neutron-plugin-api-subordinate
    scope: container

Bugs

Please report bugs on Launchpad.

For development questions please refer to the OpenStack Charm Guide.