89 Commits

Author SHA1 Message Date
Edward Hope-Morley
104626a19f Fix db init notifications
Ensures that leader does not respond to db init
notifications to avoid infitinite looping after
leader switches to a different unit.

Also ensures that leader only restarts its neutron-server
once on db init.

Closes-Bug: #1893008

Change-Id: I59b9d5e0caab62b72380879bf16cb0fd8703bb32
2020-08-26 13:49:52 +01:00
Frode Nordahl
4ac5e3f71c Conditionally make neutron-plugin relations required
When charm is not managing the plugin the neutron-plugin-* relations
should be required.

Change-Id: I8c061f272e68b05b6d415e0686564bd7f617aa12
2020-02-24 16:44:54 +01:00
Frode Nordahl
38117ba022 Conditional default of `manage-neutron-plugin-legacy-mode`
The new default will take effect on newly deployed units when
openstack-origin is set to 'ussuri' or newer.

Any existing units or newly deployed units with openstack-origin
set to prior versions will retain the existing default.

Change-Id: Ia38dd7882105c3adad1afbf754ba2ed047dd05e2
2020-02-24 16:44:54 +01:00
Zuul
ece024b467 Merge "Disable Apache port 80" 2020-01-31 15:48:35 +00:00
Liam Young
1b978ffd78 When resuming, exclude haproxy
When resuming services exclude those managed by hacluster, in
this case haproxy. If pacemaker lacks quorum it may shut haproxy
down which will cause this charm to error.

Charmhelper sync included to bring in required
get_managed_services_and_ports method.

Change-Id: Ie6f117f47a8189c8e30224f7200d8976cdec9605
2020-01-29 18:51:51 +00:00
tpsilva
b972488ad2 Disable Apache port 80
Currently, Apache ports.conf file is not being configured by this
charm. This patch changes the ports.conf default file with another one
that does not open port 80 on SSL environments.

Change-Id: I0d935de2eada861b986e2f17ead6a5674afd2969
Closes-bug: #1845665
2020-01-27 17:32:50 +00:00
Felipe Reyes
518ae9a01b Use the version of neutron-common to determine the OpenStack version
There are transient situations where the config option openstack-origin will
hold the target OpenStack version, so it's not safe to be used to determine
what packages should be installed in the unit, an accurate method is to use
the version of the neutron-common package.

Change-Id: I88693be390f66ba94626e52b949b5573532ea5d7
Closes-Bug: #1854538
2019-12-04 15:35:45 -03:00
Stamatis Katsaounis
b36ac4b4ed Remove lbaas in OpenStack Train deployments
This patch removes completely any lbaas related service or
configuration for OS Train deployements.

Change-Id: Ib48adee32d649e5254265924175c3bf2d3437c0b
Closes-Bug: #1853868
Signed-off-by: Stamatis Katsaounis <skatsaounis@admin.grnet.gr>
2019-11-26 13:58:13 +02:00
Stamatis Katsaounis
1967d7794d Apply validation on designate zone prefix values
This patch applies validation on values ipv4-ptr-zone-prefix-size and
ipv6-ptr-zone-prefix-size to prevent users from choosing values not
supported by Neutron's Designate driver.

Change-Id: I6f2d5c9d1a3f16242263f11b1f999ab7ec3a4266
Signed-off-by: Stamatis Katsaounis <katsaouniss@gmail.com>
2019-10-29 12:57:25 +01:00
James Page
fc2a172b9b Misc updates for OpenStack Train
Drop install of python3-neutron-lbaas as this package has been
dropped from the UCA at Train.

Add test bundle for train; make smoke to validate changes.

Change-Id: I355a136a0ced7367d69ee9fb8c3b493ddae5e087
2019-10-16 13:51:00 +01:00
Frode Nordahl
40b3977d16
Expose ML2 context and config to new style plugins
When a plugin does not override the ``core_plugin`` and
``neutron_plugin_config`` and leaves them to the ML2 default the
charm will now register the ``ml2_conf.ini`` config with both
the default Neutron and subordinate plugin contexts.

Any exposed context variables not provided by the plugin will no
longer be returned as empty values on the context, allowing for
passing of the Neutron API charm deduced and configured context
values.

The ``neutron.conf`` and ``ml2_conf.ini`` templates have been
updated to allow adding of new sections.

Partial-Bug: #1845212
Change-Id: I90ca77ad16c1a0f59deb34c4faa7e7a89f22aea9
2019-09-30 08:17:12 +02:00
Sahid Orentino Ferdjaoui
2ad425b1cd revert "Ensure that only cloud admins are neutron admins"
We can't add constraints to admin role without consider
regressions. It happens that two tempest scenarios are now failling:

 tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops
 tempest.scenario.test_server_multinode.TestServerMultinode.test_schedule_to_all_nodes

If admin wants to give role (even Admin role) to an user for a tenant,
the right way is to use keystone trust API.

Change-Id: I161ea7d1aec5e5784455b5bce4605b2f9143daa2
Related-Bug: #1830536
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
2019-09-18 13:39:43 +00:00
Liam Young
e03501dee1 Ensure that only cloud admins are neutron admins
When determining if a user is an admin the default neutron policy
file only checks if a user has the 'admin'  role. It does not check
what that role is applied to.

The problem is illustrated by the following scenario: A cloud
admin creates a new domain, then creates a new project within that
domain. The cloud admin wants to delegate the maintenance of the
new project to userA so she grants them admin on the new project.
UserA is now a cloud admin from Neutrons pov.

To fix this issue a policy override file is added which checks that
the user is admin either against the admin project (as defined by
keystone) or the service project.

Change-Id: If4c5b0c1ab7bf2c75e911e77531d442d417a1231
Closes-Bug: 1830536
2019-07-19 13:00:59 +00:00
Liam Young
1cdfc381ad Check Apache ssl dir when determining restart map
If the certificates change then services needs to
be restarted. This change adds the SSL directory to the restart map
to ensure any certificate changes trigger a restart.

Change-Id: I891b3104c08c6b9cde06ce30d4279a239ae329b1
Closes-Bug: 1828530
2019-05-10 15:09:31 +00:00
James Page
71542f7452 stein: migrate v1 firewalls -> v2
Ensure that the firewall v1->v2 migrate tool is executed post
upgrade to stein or later.

Fix minor issue with switch of default mysql dialect to mysqldb
at Stein by writing all new configuration files prior to
executing the database upgrade.

Change-Id: Ifb0b33038a4df7a2a6f5c1a55caaeea01a92fc20
Closes-Bug: 1821192
2019-03-25 09:04:23 +00:00
James Page
49d377bfea py3: Switch to Python 3 for OpenStack Rocky
Switch neutron installation to use Python 3 for OpenStack Rocky.

Purge python- packages on upgrade.

Fix duplicate keystone entry in api-paste.ini for Rocky.

Change-Id: I9ead4d0b637f3067e0aa9a20604b2738221860df
2018-09-21 16:17:57 +02:00
James Page
7eac81a36e Remove deploy from source support
Drop support for deployment from Git repositories, as deprecated
in the 17.02 charm release.  This feature is unmaintained and has
no known users.

Change-Id: I44f00afeee8623713055310b025f1e91af18b86a
2018-01-10 15:41:05 +00:00
James Page
5f22e621c2 Update charm to use Python 3
Updates across the charm and unit tests to switch to
execution under Python 3.

Note that the changes are not backwards compatible
with Python 2.

Refactor use of neutronclient python module to simply
wrap the neutron binary, using the yaml output format
to avoid the requirement for a Python 3 module on
older OpenStack release versions.

Change-Id: Ic26b0dd19a76552481939325963a6c21585dee3c
2017-11-07 13:53:40 +11:00
zhangyangyang
df4040b541 change assert(Not)Equals to assert(Not)Equal
According to http://docs.python.org/2/library/unittest.html
assert(Not)Equals is a deprecated alias of assert(Not)Equal.

Change-Id: Ia5df59c1f59d022231a8575cd7bc7e9bd0013ac5
Closes-Bug: #1329757
2017-09-12 21:12:20 +08:00
Edward Hope-Morley
2c21ad14ab Add db initialised detection
Currently whenever the shared-db hook fires we call
migrate_neutron_database() which will always (unless unit
is paused) do a migration and restart the neutron-server
service. This is unnecessary and disruptive so we avoid
doing this by first checking whether we have already
initialised and and skipping migrate and restart if we
have already initialised. We also add support to override
this logic if an upgrade is in progress.

Change-Id: Ia4c104ff21d10a0d24ac3038bb75a5a9dc67ca94
Closes-Bug: 1708459
2017-08-23 15:45:47 +01:00
Alex Kavanagh
750a3e2c13 Fix alphanumeric comparisons for openstack and ubuntu releases
- sync charmhelpers with fix-alpha helpers
- fix up code where the alpha comparisons are done
- fix tests which assumed mocks would just work on os_release()

Change-Id: I3d1a8993286f0e7a1037c03e6711015883f1b615
Related-Bug: #1659575
2017-03-28 17:30:14 +01:00
Dmitrii Shcherbakov
f3b655acdf add keystone middleware update logic
In order to support changes in the api-paste.ini file for the keystone
middleware of the neutron-api service by subordinates we need a generic
mechanism to pass wsgi middleware data via a relation.

The following approach is used in this change:

- relation data set by subordinates:
{'extra_middleware': [{
        'type': 'middleware_type',
        'name': 'middleware_name',
        'config': {
            'setting_1': 'value_1',
            'setting_2': 'value_2'}}]}
- there may be many subordinates each with their own set of middleware
all of which should be taken into account
- besides a factory method for middleware other settings can be
specified, therefore, a generic config dictionary is used
- neutron-server has to be restarted as api-paste.ini is read upon
startup of the service
- api-paste.ini rendering code is added along with a template code
containing loops over a list of middleware provided in a context to
construct the following entries:

keystone = [name-1 ... name-m] <default_middleware>

[type-1:name-1]
key-1 = value-1
...
key-n = value-n
...
[type-m:name-m]
key-1 = value-1
...
key-k = value-k

- api-paste.ini defaults are copied from their respective upstream
neutron branches

Change-Id: I9449aa2e85b1523f24acdcee11ca1f635dda47c0
2017-03-09 22:49:10 +03:00
Neil Jerram
fcdf2df065 Use new Calico 1.4 PPA
Change-Id: Ia79f7521bc0d12493222df66975f41f50cd029b7
2016-10-05 17:20:24 +01:00
James Page
fa1451445c Add support for application version
Juju 2.0 provides support for display of the version of
an application deployed by a charm in juju status.

Insert the os_application_version_set function into the
existing assess_status function - this gets called after
all hook executions, and periodically after that, so any
changes in package versions due to normal system updates
will also be reflected in the status output.

This review also includes a resync of charm-helpers to
pickup hookenv and contrib.openstack support for this
feature.

Change-Id: I33cce8efc03f9217552234a8e03133d360ce95e3
2016-09-20 12:25:54 +01:00
Jenkins
6ee476166b Merge "Added Hyper-V networking support" 2016-07-08 15:56:57 +00:00
Ionut Balutoiu
353ab6f9f8 Added Hyper-V networking support
This patch adds hyperv mechanism driver to ml2_conf.ini template
and the required python package to the list of packages to install.

Change-Id: If23f22aea53ba5549160f44442567d57b8077af6
2016-07-08 11:42:31 +03:00
Corey Bryant
731ca45e07 Add systemd init support for deploy from source
systemd is used instead of upstart by default since Ubuntu 15.10
(Wily).  This adds systemd init file support for nova services
that are deployed from source.

Change-Id: I45757fcd52426369b42916ad2195d2fe2f6a4c15
2016-07-07 10:58:51 +01:00
James Page
69faf85da3 Re-license charm as Apache-2.0
All contributors to this charm have agreed to the switch
from GPL v3 to Apache 2.0; switch to Apache-2.0 license
as agreed so we can move forward with official project status.

Change-Id: Ie7859853644fb819f1cd3062a2fea86766de0afb
2016-07-03 17:47:52 +01:00
Alex Kavanagh
638e06de08 Fix for multiple status-set - related to bug 1588462
This change fixes the obvious race for a status_set() between
check_optional_interfaces() and assess_status() as the later calls the former
which calls status_set(), returns the status, which is then potentially set
again by the assess_status() function.  This cleans up the code so that only a
single status_set() is performed when calling assess_status().

Change-Id: Ic5d0be6e1f7a2283e4dd0594c6465a99497dbbec
Related-Bug:#1588462
2016-06-16 10:35:37 +00:00
Liam Young
dd5bc11622 No db stamp for upgrade from Liberty
Stamping the Neutron db for Liberty fails and appears to be
unneccesary.

Change-Id: I93ff69db57bc3418a4c73e79e884f5c85d533f99
Closes-Bug: 1536675
2016-04-18 14:21:33 +00:00
James Page
e1d5e7ef68 Full control of db migrations
Earlier versions of the nova-cloud-controller charm controlled
upgrades of the neutron databases; this has now been dropped
from the nova-cloud-controller charm.

Drop logic around conditional migration related to OpenStack
releases and always migrate the neutron database, so long as
the unit is the lead unit.

Change-Id: I944621203e8f4a2337151f2d406fe0f2c7d1a71f
2016-04-11 16:37:03 +01:00
Edward Hope-Morley
1ef99d852e Add hardening support
Add charmhelpers.contrib.hardening and calls to install,
config-changed, upgrade-charm and update-status hooks.
Also add new config option to allow one or more hardening
modules to be applied at runtime.

Change-Id: I46e1b43df3a5e59018f604ce1ae20bd62744a45b
2016-03-31 10:40:23 +01:00
Liam Young
9be47125b5 Add pause/resume actions and sync charm-helpers
Adds pause and resume unit to the charm such that the
charm stays paused during maintenance operations.

Partial-Bug: 1558642
Change-Id: Id5c44143f30305a3c412648cebb4c30caaa3e789
2016-03-20 14:25:47 +00:00
Neil Jerram
892db0dbd7 Changes for Calico networking with OpenStack Liberty
- Stable PPA source for Liberty onwards
- New neutron.conf for Liberty without dhcp_agents_per_network = 1000
- Testing for PPA source

Change-Id: I6ebee0ac3704a56f31ffbd48206360a3f0ba267a
2016-03-04 16:21:18 +00:00
sunny.verma@nuagenetworks.net
0009140792 fixed lint error 2016-02-24 18:26:15 -05:00
sunny.verma@nuagenetworks.net
8dd25c9aa0 Merged from lp:~openstack-charmers/charms/trusty/neutron-api/next 2016-02-24 17:35:54 -05:00
sunny.verma@nuagenetwork.net
a6b315e66f Removed lint errors and Added correct unit test 2016-02-19 21:27:40 -05:00
Adam Gandelman
86f6174d5f Advertise API readiness to subordinates, allow subordinate specification of api_extensions
This advertises API readiness to subordinates via a new flag int the subordinate
relation. It determines readiness by the completion of required contexts. This
simply means the API service has enough of its topology completed to begin
servicing requests, and it has at least *started* the service (from the POV of
the init system). Its up to the subordinate service to ensure the API is
functional.

It also allows subordinates to specify custom api_extension_paths to neutron-api.
2016-02-03 11:17:14 -08:00
Subbarayudu Mukkamala
428b5d1918 Merge from lp:~openstack-charmers/charms/trusty/.../next/ 2015-10-27 07:50:30 -07:00
James Page
e44d898e0c Fixup more lint 2015-09-16 10:20:49 +01:00
James Page
d36d90689e Fixups for liberty b3 support 2015-09-15 09:28:02 +01:00
James Page
f87ad07e29 [project-calico,r=james-page] Add support for Calico plugin 2015-09-04 12:03:14 +01:00
James Page
9457427f4d Switch to using neutron-common for package version detection 2015-09-03 10:16:17 +01:00
Cory Benfield
8d5aa82328 synced /next 2015-08-21 08:33:43 +01:00
Subbarayudu Mukkamala
37802d3866 Merge from lp:~openstack-charmers/.../next 2015-08-20 06:45:36 -07:00
Liam Young
421056efa5 [gnuoy, r=jamespage] Add support for neutron-plugin-api-subordinate relation 2015-08-12 11:40:58 +01:00
Subbarayudu Mukkamala
97d0cc4d07 Merge from lp:~openstack-charmers/.../next 2015-07-26 19:42:50 -07:00
Liam Young
a6c3663eb8 Add unit tests for new utils and add missing relation hook links 2015-06-30 10:03:16 +01:00
James Page
2d2e950e8f Fixup upgrades to ensure that only the leader attempts to migrate the database 2015-06-29 12:33:36 +01:00
Cory Benfield
4629d6b115 Select install location from openstack-origin 2015-06-16 10:25:27 +01:00