71 Commits

Author SHA1 Message Date
Liam Young
9b11d24d40 Implementation of deferred restarts
Add deferred restart actions and config.

Change-Id: I334df5ca932e9f94e128d9fa66c1ab91d60233b4
2021-04-09 12:53:58 +00:00
Frode Nordahl
a88259a768 SR-IOV: match on PCI address, don't do runtime config
Replace in-charm SR-IOV code with the common ``SRIOVContext``

Do not do run-time configuration of SR-IOV or hardware adaption
for hardware offload. In addition to being detrimental to any
virtual machine instance consuming the VF this will break NIC
firmware in some configurations.

The task is delegated to the installed packages and their systemd
services and configuration will occur at system bootup time.

We may consider adding an action to perform the configuration at
run-time if the operator really wants to, but it is very
complicated to get right. For example if you are using bonding
and hardware offload the virtual functions and hardware specific
setup has to happen _BEFORE_ netplan applies network configuration
to the system.

Closes-Bug: #1908351
Change-Id: Id0b81848658a3bd34470440bd68928ae9f6682e4
2021-02-16 11:45:53 +01:00
Frode Nordahl
840e255325
Fix ordering issue for disabling mlockall
The charm will attempt to do run-time configuration of
Open vSwitch prior to writing configuration files to disk and
restarting services when required.

When running in a container or on a system where it is required
to disable mlockall this will not work as the charm will attempt
to do run-time configuration of OVS prior to having (re-)started
it with the required ``--no-mlockall`` option.

Closes-Bug: #1906280
Change-Id: I8d98e6310aafcd840f3b4947ccc065c97069afe2
2021-01-19 22:23:41 +01:00
James Page
7ba64f9412 Refactor SR-IOV support
Refactor SR-IOV VF configuration support to use sriov-netplan-shim
to configure VF's on PF's so the charm simply writes out the required
interfaces.yaml file and restarts the sriov-netplan-shim service
which is fully idempotent.

Change-Id: I7a3ddf91d4b2ae6aa0806d97c45b59e8a951f67f
2020-03-18 10:59:21 +00:00
Frode Nordahl
ee709a5ab3
Use hosts official name for FQDN
The current implementations use of a specific interface to build
FQDN from has the undesired side effect of the ``nova-compute`` and
``neutron-openvswitch`` charms ending up with using different
hostnames in some situations.  It may also lead to use of a
identifier that is mutable throughout the lifetime of a deployment.

Use of a specific interface was chosen due to ``socket.getfqdn()``
not giving reliable results (https://bugs.python.org/issue5004).

This patch gets the FQDN by mimicking the behaviour of a call to
``hostname -f`` with fallback to shortname on failure.

Add relevant update from c-h.

Depends-On: I82db81937e5a46dc6bd222b7160ca1fa5b190c10
Change-Id: Ic8f8742261b773484687985aa0a366391cd2737a
Closes-Bug: #1839300
2020-01-13 00:35:53 +01:00
Frode Nordahl
4b2935d5a6
Don't enable DVR services when deployed in container
Also set upper constraint for ``python-cinderclient`` in the
functional test requirements as it relies on the v1 client
which has been removed.  We will not fix this in Amulet, charm
pending migration to the Zaza framework.

Change-Id: If4d3b3cd79767b37fe6b74a1d6d399076c122bc8
Closes-Bug: #1843557
2019-11-27 15:20:20 +01:00
Frode Nordahl
ed4ca7b1c4
Fix gate for enabling FQDN agent registration
If a new version of the charm is used to install a version of
OpenStack prior to Stein, do not enable the FQDN registration.

Change-Id: I64afa582cdfadafcd249ddfbeec267ba610d166a
Closes-Bug: #1846781
2019-10-08 14:27:14 +02:00
Frode Nordahl
32d7c17b7f
Provide configured hostname over subordinate relation
Change-Id: I75cbc5eb97cf3603ffa5a9a49670411288d90520
Closes-Bug: #1845303
2019-10-01 08:03:17 +02:00
Frode Nordahl
31e2aabb03
Use FQDN when registering agents with Neutron
The change of behaviour will only affect newly installed
deployments on OpenStack Train and onwards.

Also set upper constraint for ``python-cinderclient`` in the
functional test requirements as it relies on the v1 client
which has been removed.  We will not fix this in Amulet, charm
pending migration to the Zaza framework.

Related-Bug: #1839300
Needed-By: Ia73ed6b76fc7f18014d4fa913397cc069e51ff07
Change-Id: Iee73164358745628a4b8658614608bc872771fd1
2019-09-20 12:03:19 +02:00
Alex Kavanagh
9fcc8e55a5 Fix log update-status error
This patch adds a dummy update_status function so that the update-status
hook 'has' a function to run and thus silence the log error.

Change-Id: I1f008b1cb0958e90967a6a4e95fb0fddb37795f4
Closes-bug: #1837639
2019-07-24 11:43:01 +01:00
Nicolas Pochet
d02fad482d
Replace SR-IOV systemd unit script
* The goal of this change is to enable the ability to configure only the
VFs that are configured through the charm and not fallback to the
blanket configuration.
* This python version of the script brings unit-tests that fully covers
it.
* Move the the template files to `files` and modify `neutron_ovs_utils`
accordingly.

Closes-Bug: 1832379
Depends-On: https://review.opendev.org/#/c/664837/

Change-Id: I7ad1ebc16883bda23cbad89a852e7e8f88f49c49
2019-06-28 17:37:51 +02:00
Frode Nordahl
0f4eefcf4e Do not remove `haproxy` package
The principal charm may have use for it.

Change-Id: I342e3be7067a218c466a94728920377367239887
Closes-Bug: #1832739
2019-06-13 18:52:30 +02:00
James Page
e7ed38fcc8 sysctl: skip application when running in container
This charm is used in containers when deploying Octavia; sysctl
can't be updated from within a LXD container, so skip the call
to apply sysctl configuration if the unit is running in a
container of any sort.

Change-Id: If3c40fa6c8b6e5448293caf726088d152f6eeee8
2019-03-26 09:49:34 +00:00
Edward Hope-Morley
7b6f93fc11 Remove keepalived purge when dvr enabled
Stop the charm from uninstalling keepalived when
using dvr since it also removes neutron-l3-agent.

Change-Id: I62d4cd2ee635ce793e37d4760387047b1b38f973
Closes-Bug: #1819499
2019-03-11 18:17:05 +00:00
Pete Vander Giessen
00ca87fec3 Added gc_threshold overrides to sysctl.conf
When clouds have a large number of hosts, the default size of the ARP
cache is too small. The cache can overflow, which means that the
system has no way to reach some ip addresses.

Setting the threshold limits higher addresses the situation, in a
reasonably safe way (the maximum impact is 5MB or so of additional RAM
used). Docs on ARP at http://man7.org/linux/man-pages/man7/arp.7.html,
and more discussion of the issue in the bug.

Change-Id: I329ec51eff85a2a99a929c67ff0c68b3b36d7273
Closes-Bug: 1780348
2019-02-28 11:55:05 +01:00
Dmitrii Shcherbakov
1486c83a1f Allow dvr_snat l3 agent mode to be used with DVR
Currently it is a requirement to have a network node with an l3 agent
running in the dvr_snat mode even for DVR deployments that do not use
SNAT or have a very limited usage of SNAT.

It is not possible to disable snat completely:
https://bugs.launchpad.net/neutron/+bug/1761591

Neutron creates a network:router_centralized_snat port and if it is not
possible to find a dvr_snat agent to schedule it on there are various
side-effects which are not seen at first. For example, Designate stops
creating records for floating IPs and Neutron/Designate integration is,
therefore, not functional.

The Neutron DVR documentation says that dvr_snat should be used on
network nodes. However, there is nothing restricting a DVR deployment
from using dvr_snat l3 agents on every compute node and not having
dedicated network nodes.

This change modifies neutron-openvswitch to optionally enable dvr_snat
l3 agent mode (this includes supporting L3HA routers if enabled). As a
result, it is possible to have deployments without neutron-gateway thus
saving on the amount of required nodes. Care should be taken when a
large amount of L3HA routers is used and using DVR routers without L3HA
is a recommended.

Change-Id: Iad3a64967f91c81312911f6db856ce2271b0e068
Closes-Bug: #1808045
2018-12-12 00:37:29 +03:00
Liam Young
71b5196b5b Restart nova-compute if packages have been purged.
If packages have been purged off the system then trigger a
restart of nova-compute by sending a restart trigger via the
neutron-plugin relation.

Change-Id: I5c8272d8c83b5112b6d8cebbbf3c485b87b7ef31
Closes-Bug: 1802304
2018-11-08 17:45:56 +00:00
James Page
3015d95af8 py3: Switch to Python 3 for OpenStack Rocky
Switch to execution of Neutron agents under Python 3 for
OpenStack Rocky; this is triggered by the nova-compute charm
mutating the container scoped neutron-plugin relation post
OpenStack series upgrade.

Update default smoke test target to bionic-rocky.

Change-Id: Ic5e96336b6a2ca474fc28d358553c6a05e1a75ce
2018-10-04 14:58:19 +01:00
David Ames
2bfa6c0605 Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu
series.

Change-Id: Iccffccec390495b72750fe1fac81d06c96fa7dd4
2018-09-18 10:06:06 +00:00
James Page
96c1788e94 Misc updates for DPDK support
Fix use of OVS DPDK context by direct use of methods on context
for OVS table values.

For modern OVS versions that require the PCI address of the
DPDK device for type=dpdk ports, use a hash of the PCI address
for the port name rather than the index of the PCI device in
the current list of devices to use; this is idempotent in the
event that the configuration changes and new devices appear
in the list of devices to use for DPDK.

Only set OVS table values if the value has changed; OVS will
try to re-allocate hugepage memory, irrespective as to whether
the table value actually changed.

Switch to using /run/libvirt-vhost-user for libvirt created DPDK
sockets, allowing libvirt to directly create the socket as part
of instance creation; Use systemd-tmpfiles to ensure that the
vhost-user subdirectory is re-created on boot with the correct
permissions.

Scan data-port and dpdk-bond-mappings for PCI devices to use
for DPDK to avoid having to replicate all PCI devices in data-port
configuration when DPDK bonds are in use.

Change-Id: I2964046bc8681fa870d61c6cd23b6ad6fee47bf4
2018-09-04 12:43:03 +01:00
Edward Hope-Morley
e8af22633b Fix charm upgrade broken by commit 862c362
Currently, upgrading this charm on a host that is running
ovs >= 2.6 will break because the OVS_DEFAULT config file
is not expected to be written by the charm.

Change-Id: I33352deb3b60231347045d5f39f3508a29dda61e
2018-07-17 14:31:49 +01:00
James Page
fe9633856b 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: Ib954ddd1fb63d409af77949d8e76a6d6da8f2cde
2018-01-10 12:01:23 +00:00
James Page
46faae4ff8 Drop zeromq support
Support for the ZeroMQ messaging driver has bit-rotted over
the last few years across the OpenStack charms; drop support
for ZMQ inline with deprecation notices issued in 17.02 charm
release.

Change-Id: I3a4f4bc84327ee2e269d3ebd93d102494102b05e
2017-12-15 12:26:50 -08:00
James Page
0e86a664be Update to run under Python 3
Refactoring of charm to support execution under Python 3.

Change-Id: I8d48614f38abf31159311d82b0cbb54e60f710c1
2017-11-20 08:54:31 -08:00
Jenkins
c937133368 Merge "Migrate openvswitch-switch file to avoid restarts" 2017-08-24 22:57:42 +00:00
Frode Nordahl
4ffbc2fe25 Fix handling of SR-IOV interface configuration
SR-IOV interfaces are currently only configured on charm
installation and not after seubsequent reboots.

The VFs need to be configured before the Neutron SR-IOV
agent is started. Charms should also really not be involved
in boot time system configuration. Due to these factors
this commit adds a init script and corrensponding systemd
unit file and upstart job to handle the boot-time configuration.

Keep configure_sriov function for runtime configuration. Add
warning about runtime configuration disrupting network service.

Add restart of Neutron SR-IOV agent after runtime configuration.

Cap value of sriov-numvfs at each interfaces sriov_totalvfs value.

Change-Id: I7bde7217bf027db09ded35a262c214ccb11d6d86
Closes-Bug: #1697572
2017-08-24 12:34:58 -07:00
Billy Olsen
e3ec31c91d Migrate openvswitch-switch file to avoid restarts
The 16.10 release of the neutron-openvswitch charm changed the
file management strategy of /etc/default/openvswitch-switch
config file from managing the file when dpdk is enabled to always
managing the file. Additionally, the template file was changed
in the 16.10 release to modify the file header (commit 4463c334).
These two changes guarantee that the contents of the file will
change when upgrading the charm.

The changing file contents causes the openvswitch-switch service
to be restarted, which in turn causes a data plane outage. This
commit fixes that by migrating the /etc/default/openvswitch-switch
to be charm managed without restarting the openvswitch-switch
service.

The change will only attempt to migrate versions of the file
which were created before 16.10 by searching for a marker in the
rendered version of the file which was added in 16.10.

Change-Id: Icc0f326991be239b88a57292740473f501181ebb
Closes-Bug: #1712444
2017-08-23 15:39:36 -07:00
James Page
790819c237 Update SR-IOV support for >= Mitaka
SR-IOV network for OpenStack release later than Mitaka requires the
use of the neutron-sriov-agent to support management of SR-IOV PF
and VF interface state by Neutron - said interfaces are still
consumed directly by nova-compute/libvirt via PCI device allocation
scheduling for instances.

Add new configuration options to the neutron-openvswitch charm to
support enablement of the SR-IOV agent; this could have been done
automatically from data presented from neutron-api, but its possible
that cloud deployments may only have subsets of compute nodes that
are SR-IOV enabled in terms of hardware.

Enabling this option ('enable-sriov') will install and configure
the neutron-sriov-agent; configuration of SR-IOV PF's are made
using the 'sriov-numvfs', which by default automatically configures
all SR-IOV devices on every machine to the maximum number of VF's
supported by the device.  This option can be used to configure
devices at an individual level as well.

Finally, neutron needs to understand what underlying provider
network each SR-IOV device maps to - this is configured using the
sriov-device-mappings configuration option.

Change-Id: Ie185fd347ddc1b11e9ed13cefaf44fb7c8546ab0
2017-02-07 14:55:32 +01:00
Liam Young
a92b6fb881 Add neutron-control interface
Add neutron-control interface to allow charms to send triggers to
restart neutron services managed by this charm

Change-Id: I0e44f7cab99db4fb9b5d2764859e16b30705e6fe
2016-08-31 10:40:07 +00:00
James Page
ed83413331 Re-license charm as Apache-2.0
All contributions to this charm where made under Canonical
copyright; switch to Apache-2.0 license as agreed so we
can move forward with official project status.

Change-Id: I7bd44dc15ad951bf2536e5ee10de01ec592b8970
2016-07-01 17:36:39 +01:00
Alex Kavanagh
a9b41dfbed Enhanced pause/resume for maintenance mode
Add in pause/resume feature for maintenance mode along with tests.
Sync charmhelpers with support for the maintenance mode feature.

Change-Id: I075459e56ce34e78f5206d116208165aa43aae21
2016-03-30 19:57:58 +00:00
James Page
f7c430f9d0 Ensure that metadata agent packages are not uninstalled if dvr is enabled but local dhcp is not 2015-11-12 09:33:27 +00:00
Liam Young
e0d58eb289 Move from decorator to new format for workload status 2015-10-08 14:25:23 +01:00
Liam Young
bbecca866a Added workload status 2015-10-07 10:41:12 +00:00
Liam Young
d87daa8805 Purge dhcp packages when no longer required 2015-09-12 09:58:58 +01:00
Liam Young
883c01903a Unit test updates 2015-09-08 15:12:14 +01:00
Liam Young
806049e08f Metadata tidy 2015-09-08 13:23:26 +01:00
Liam Young
9595e7516c Enable metadata 2015-09-08 13:17:28 +01:00
Corey Bryant
b22c6aebbf Deploy from source 2015-04-02 20:35:37 +00:00
James Page
16e98c628a Rebase 2015-04-01 15:19:17 +01:00
James Page
be6b39e892 [gnuoy,r=james-page] Add support for Neutron DVR 2015-04-01 13:53:02 +01:00
Corey Bryant
d5e9cebd14 Overall refresh to current install from source approach 2015-03-21 10:25:07 +00:00
James Page
b30df45a48 Make 0mq support >= kilo 2015-03-16 16:15:06 +00:00
Corey Bryant
c8885bba2a Initial support for deploying from git 2015-03-08 10:52:40 +00:00
Liam Young
7a4e0e1222 Purge pkgs when not in dvr mode 2015-03-02 14:56:11 +00:00
Liam Young
8b5d14e345 More unit tests 2015-02-25 13:50:38 +00:00
Liam Young
63e451fbcf Inform nova-compute if dvr is enabled as it'll need to enable the metadata service 2015-02-20 08:17:24 +00:00
Liam Young
b9fd91de35 Fix BASE_RESOURCE_MAP 2015-02-05 09:57:47 +00:00
Liam Young
c02f501399 Add relation to nova-cc (as neutron-gateway has) to get ks service info 2015-02-04 16:30:03 +00:00
Liam Young
a0c85efdd4 Reenable configure_ovs 2015-02-03 14:17:30 +00:00