Commit Graph

44 Commits

Author SHA1 Message Date
John P Lettman 7929fc4909 add nagios checks
Updates charmhelpers for nrpe; adds metadata and config entries for nrpe relation; adds services and ovs liveliness nrpe checks.

Change-Id: I991fb6943d833d45e632358141b130c0f2225c09
2022-05-24 10:09:30 -04:00
Hervé Beraud 9951beeff2 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: I8eedfa05c07067bb9a0d3a331d1868210534d84c
2021-12-15 14:11:43 +00:00
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
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 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
Zuul 3da7ab086f Merge "Replace SR-IOV systemd unit script" 2019-07-02 10:31:27 +00: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
Zuul bc3e150f88 Merge "Add support for FWaaS v2 logging" 2019-06-25 18:37:42 +00:00
James Page 9b0de9bbff Add support for FWaaS v2 logging
Enable support for configuration of FWaaS v2 firewall group
logging.

Configuration options mirror those for neutron-openvswitch
for security group logging.

This feature is currently only enabled for FWaaS v2 at Stein
for the charms (but is supported back to Queens in Neutron).

Change-Id: Ic60ee47078089c59ccb09b8659422e7ad7081149
Partial-Bug: 1831972
2019-06-25 16:53:24 +01: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
David Ames a1639fe51f Enable isolated provider network metadata access
When an isolated provider network with no virtual routers metadata
access occurs in the qdhcp netns.

Without the force_metadata option in dhcp_agent.ini and the haproxy
package installed ns-metadata-proxy is not enabled. ns-metdata-proxy
sits in the ip netns and proxies requests from 169.254.169.254 to the
nova-api-metadata service outside the netns.

This change adds the force_metadata option and installs haproxy when
enable-local-dhcp-and-metadata is True.

Closes-Bug: #1831935

Change-Id: Iaad1501e8d7d58888ef0917b6700d22a7cf05ecf
2019-06-07 10:34:50 -07: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
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
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
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
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 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
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
Liam Young 0f1309df41 Fixed lint 2015-03-25 10:31:44 +00:00
Liam Young 67b068f3f8 Merged next in 2015-03-25 09:49:01 +00:00
Liam Young 8534a357af Fix lint and unit tests 2015-03-03 11:12:19 +00:00
Liam Young 8b5d14e345 More unit tests 2015-02-25 13:50:38 +00:00
Liam Young e3bc81a2eb Merged trunk in and tidyup 2015-02-19 15:55:06 +00:00
James Page ff27468326 [james-page,r=coreycb] Add option to disable security groups like nova-compute 2014-10-22 17:53:56 +01:00
Liam Young c076fee522 Fix lint and unit tests 2014-10-20 14:07:59 +00:00
Liam Young 392ed152dc determine_packages should return a list of lists which the install hook should iterate over passing each inner list to apt_install in turn to ensure the dkms module gets install prior to openvswitch-switch trying to load it 2014-06-24 15:04:51 +01:00
Liam Young a600002f41 More lint fixes 2014-06-19 11:01:12 +01:00
Liam Young 3c85d2249a Lint tidyup and unit tests 2014-06-19 10:56:25 +01:00