33 Commits

Author SHA1 Message Date
Hemanth Nakkina
d65c121ee5
[openstack-hypervisor] Add support for sev
* Add new config parameter reserved-host-memory-mb-for-sev
that updates snap config sev.reserved-host-memory-mb
* Add an action list-flavors to list the host flavors/
capabilities

Change-Id: I2500d1dafc0bb77dafa8a681daf833f7d1f76211
2025-02-25 13:49:14 +05:30
Guillaume Boutry
4d4b4a41b0
[ops-sunbeam] Ensure external connectivity for machine charms
Machine charms need external connectivity to access services hosted on a
K8S substrate.

Ensure rabbitmq / ovn relay are access remotely for machine charms.

Closes-Bug: #2098974
Change-Id: Ifadb196dd6d60e33feab7dc0d835a7ea84444b9e
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2025-02-21 17:39:48 +01:00
Ahmad Hassan
b3387c4ff1 [openstack-hypervisor] error out on snap installation failure
When the openstack-hypervisor snap fails to install, then set
the unit status to error instead of blocked.

Closes-Bug: #2065944.

Change-Id: I0b3817c8e8321e5bfd8eaabe63646c9cd48cdf36
2025-01-28 11:21:39 +05:00
Guillaume Boutry
66a4ae378f
[hypervisor] Add management actions to charm
Add management actions to hypervisor charm to allow enabling / disabling
the compute service, and get a list of running guests on that
hypervisor.

Change-Id: Ibea004be22462aff5a4d64704c67970af1b038d1
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-11-20 12:59:43 +01:00
Guillaume Boutry
de0e8bd10e
[openstack-hypervisor] Add list-nics action
Add action to list-nics on the hypervisor. This is used to gather
candidate for the external network nic.

Change-Id: Ife70804d035a900d5fe95059b26d3006860506da
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-10-15 19:49:41 +02:00
Hemanth Nakkina
0bdc19c4ea
Add support for masakarimonitors
* Add new interface service-ready to check for service
readiness of remote application.
* Create a placeholder charm sunbeam-libs to place all
the common libraries. The charm and the libraries need
not be published to charmhub since at this point of time
they are used internally by sunbeam.
* Add provider to service-ready in masakari-k8s
* Add requirer to service-ready in openstack-hypervisor
and enable/disable snap option masakari.enable based on
service-ready relation.

Change-Id: I99feccee2c871fc5a581fdea6f45a541efc2a968
2024-10-10 08:06:43 +05:30
Guillaume Boutry
5e13d3a679
[hypervisor] Add hostname as subject alternative names
Qemu blockdev-add command is unhappy when the hostname is not part of
the sAN in the certificates (even if it's already in the CN). Add
hostname to certificate's subject alternative names.

If there is a migration address, it will be the prefered one for qemu
migration, therefore also include hostname exposed on this address.

Change-Id: I7a1f0e9e0a21f8dbc4bab94acec4f1c5b445a054
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-10-08 16:07:12 +02:00
Guillaume Boutry
e911599abe
Migrate to unified charmcraft.yaml
Charmcraft 3 moves towards a single charmcraft.yaml, this is needed for
24.04 migration.

Change-Id: I743712752aaf37bf68730b64bd6c147dfad370e2
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-10-08 09:38:10 +02:00
Guillaume Boutry
ed4ed712bb
[tls-certificates] refactor tls certificate handler
This change refactors tls-certificates relation handler.
List of changes:
- Allow management of multiple tls certificates on the same relation
- Allow easier override of certificate signing request (csr)
- Enable certificate renewal on expiration / revokation
- Upgrade tls-certificates relation from v1 to v3

Change-Id: I4f6ac6a5570635388cc10131b34fbc6b422e1bca
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-06-26 23:59:37 +02:00
James Page
270a99d385
openstack-hypervisor: drop external-gateway
Drop configuration of external-gateway property via charm configuration
as its actually determined by whether the unit as an external nic or if
the unit is configured in local only mode, with an IP address on the OVS
bridge.

Related-Bug: #2067623
Change-Id: I31e8a95b831911560c1fc761b1b107b188544fb5
2024-06-03 15:33:33 +01:00
Guillaume Boutry
fbe0587157
Enable internal dns by default with a default dns name
Add dns-domain config option in neutron-k8s to allow building instances
within an internal domain.

Always enable extension dns_domain_ports.

Remove config option from openstack-hypervisor, as it is not the right
place.

Change-Id: I876269ba1b575ad108dc8c9defcc32dcf6044ba3
2024-05-01 15:45:46 +02:00
Guillaume Boutry
9c31e36587 Add resume-on-boot config option
Enable configuring whether or not should the guests resume after the
host boots.

Change-Id: Ic1eed829dca357be7734d2d93fbf508d3100323f
2024-04-30 19:54:11 +00:00
Hemanth Nakkina
ebd2cf0386
Rename nova-spiceproxy-url relation key to spice-proxy-url
snap-openstack-hypervisor config key for spice proxy
url is spice-proxy-url. So change the key set in
openstack-hypervisor charm to spice-proxy-url. Update
the lib nova-service to have same name in relation
data for consistency.
Fix spiceproxy url to include spice_auto.html

Change-Id: I8606519a3266d0105dc1afd7ed2a06fceef87dbe
2024-04-22 09:58:08 +05:30
Hemanth Nakkina
f611ba9e60
[nova] add support for nova spice proxy
lib changes
Add new library nova_service to exchange config
information like nova spice proxy url.

ops-sunbeam changes
Move TraefikRouteHandler from heat-k8s to
ops_sunbeam to reuse in nova-k8s charm as well.
Add nova-service requires handler

nova-k8s changes
Add new container in nova-k8s for nova spice proxy
Add the corresponding pebble handler with plan to
start nova spice proxy process
Change the ingress relation to use traefik-route so
that both nova-api and nova-spiceproxy applications
are exposed via traefik
Add new interface nova-service to provide nova
spiceproxy url to client openstack-hypervisor.
Add nova-service provider handler

openstack-hypervisor changes:
Add interace nova-service in requires section of
metadata.yaml
Handle nova-service requires and update snap config

Change-Id: I27dd6523628e492bef1d1dd851dc528e41c520c7
2024-04-19 14:28:46 +05:30
Samuel Allan
365aed9a21
Remove pypi mock package for tests
'mock' is built in to python as unittest.mock since python 3.3.
The mock package on pypi is a backport, and not required here.

The test code throughout this repo used a mix of unittest.mock and
the mock package.  This makes it consistently unittest.mock now,
and makes the import styles consistent too.

Change-Id: I643247ac4061c095b327a73cba75a1fa67f1c32e
2024-02-21 09:04:17 +10:30
Hemanth Nakkina
f120968772
Add receive-ca-cert relation to openstack-hypervisor
Add receive-ca-cert relation.
Update the CA bundle to snap config ca.bundle
Update nova configuration.

Change-Id: I7008d6525f38d1b6f2f74782f8488b3a95b43efb
2024-02-15 16:25:00 +05:30
James Page
3b89b09c1e
Allow snap to detect virt type
Don't provide an explicit value to virt-type to the snap, ensuring
that the code in the snap that falls back to userspace emulation
kicks in when KVM is not possible.

Change-Id: If4a21febf4b37d8a09da9448736d8bc84c4d4dda
2024-02-07 18:30:43 -07:00
Guillaume Boutry
66da01ee71
Configure live migration
Configure TLS certificates with the right extensions to be used in an
mTLS environment. (Used by Libvirt and QEMU for native TLS migration).
Ask for new TLS certificate if it's missing the mTLS clientAuth and
serverAuth extended key usages.
Libvirt/QEMU fail to read CA certificate with chain, therefore it's
templated without the chain.
Add extra binding `migration`.
Add extra configuration key `use-migration-binding`. It's false by
default, since on current sunbeam installation, there's no space
configuration, all ip addresses are part of the alpha space. Which makes
selecting the right ip address impossible.

Change-Id: Ia0622b12bcac6b90d7a9937695947c113f62d7fe
2023-11-30 13:54:06 +01:00
Hemanth Nakkina
df70e376ff
Add zuuljobs
* Add sunbeam project template to run pep8, py3 tests
* Add zuul.d/zuul.yaml to run pep8, py3, cover tests
* Update charmcraft and requirements for each charm
* Add global tox.ini to invoke fmt, pep8, py3, cover,
  build
* Add gitreview file
* Fix py3 test failures in ciner-ceph-k8s, glance-k8s,
  openstack-exporter
* Add jobs for charm builds using files option so that
  job is invoked if files within the component are
  modified. Add charm builds to both check and gate
  pipeline.
* Make function tests as part of global. Split the function
  tests into core, ceph, caas, misc mainly to accomodate
  function tests to run on 8GB. Add function tests as
  part of check pipeline.
* Add zuul job to publish charms in promote pipeline
  Add charmhub token as secret that can be used to
  publish charms.
  Note: Charmhub token is generated with ttl of 90 days.
* Run tox formatting
* Make .gitignore, .jujuignore, .stestr.conf global and
  remove the files from all charms.
* Make libs and templates global. Split libs to internal
  and external so that internal libs can adhere to
  sunbeam formatting styles.
* Add script to copy common files necessary libs, config
  templates, stestr conf, jujuignore during py3 tests
  and charm builds.
* Tests for keystone-ldap-k8s are commented due to
  intermittent bug LP#2045206

Change-Id: I804ca64182c109d16bd820ac00f129aa6dcf4496
2023-11-30 15:32:39 +05:30
Hemanth Nakkina
028658215e Stop services for goneaway events for relations
Implement stop-services function for the charm.
For relations amqp, ovsdb-cms, reset the
corresponding snap data.
Add mandatory_relations to openstack-hypervisor
charm.

Depends-On: https://review.opendev.org/c/openstack/charm-ops-sunbeam/+/899012
Change-Id: Ie6a735d4cad281c080e47208cf87f34e50d00fd1
2023-11-01 09:06:53 +05:30
Hemanth Nakkina
3c7295f19d Format the code
Change pyproject.toml to reflect similar ot other
sunbeam charms.
Run tox -e fmt for formatting.

Change-Id: I21f40c502a8503edd8d4c345b09fc33d0f67c5dc
2023-10-25 09:54:50 +05:30
Liam Young
947c2b34b2 Support ceph-access relation
Change-Id: I05872c91bd68ef5a9836a6a4a229138a8ebaabf3
Signed-off-by: Liam Young <liam.young@canonical.com>
2023-09-11 12:02:29 +00:00
Hemanth Nakkina
b3d4568882 Add support for ceilometer-service relation
Implement ceilometer-service requires part of the relation.
Configure snap-openstack-hypervsor config parameters
telemetry.enable and telemetry.publisher-secret when the
relation is joined/changed.
Configure telemetry.enable to False when ceilometer-service
relation is removed.

Change-Id: I168348aba340db3ec2f63b69acef439906542e63
2023-09-06 17:24:37 +05:30
Zuul
1ac1e494c9 Merge "Add cos-integration" into main 2023-09-06 11:10:25 +00:00
Chi Wai Chan
89635f8da9 Add cos-integration
Allow the charm-openstack-hypervisor to be related to grafana-agent
machine charm [1] via cos-agent interface.

- Add cos-agent library.
- Add cosl and pydantic to test requirements.
- Add cos-agent interface and its basic implmentation.
  - Add libvirt exporter integration (related to PR [2])
  - Add ovs exporter integration (related to PR [3])
  - Add node exporter integration (grafana-agent built-in)

[1] https://github.com/canonical/grafana-agent-k8s-operator/tree/main
[2] https://github.com/canonical/snap-openstack-hypervisor/pull/2
[3] https://github.com/canonical/snap-openstack-hypervisor/pull/3

Change-Id: I1bc8367af2e1d2677a43cf67f15cae49c5455e7f
2023-09-06 18:02:00 +08:00
Chi Wai Chan
ba533411b7 Fix the typing issue in snap configs.
Currently, setting boolean config with `Snap.set` will result in setting
the snap config to a string of `true` or `false`, and the openstack
hypervisor snap will read those configs as string as well. This makes
the condition checking in openstack-hypervisor snap behaves incorrectly
[1]. This PR is to update the snap library will proper typing support.

- Update snap library
- Fix the data types used in `Snap.set()`

[1] https://github.com/openstack-snaps/snap-openstack-hypervisor/blob/main/openstack_hypervisor/hooks.py#L740

Closes-Bug: #2033272
Change-Id: I7bec4599b23500aaad9e008fce648793c104b642
2023-08-30 18:42:47 +08:00
Hemanth Nakkina
cb22f40233 Use fallback for determining interface for local ip
In some cases, the netifaces does not properly detect the default
gateway for the node and returns an empty dict. However, there is
a default gateway actually set. This adds a fallback path to parse
the contents of the /proc/net/route table and determine which
interface to use based on which flags are set on the routes.

Closes-Bug: #2030497
Change-Id: I1cf358ad42f0cec4733e3afc9b60f5ddfade2bfe
2023-08-10 13:56:02 +05:30
Guillaume Boutry
bd44c98d96 Use identity internal endpoint
The charm configured the snap with the public endpoint while it should
be internal.

Change-Id: I428a4c275203641eaaa7cdb83c8f120503bcfd92
2023-07-11 10:45:10 +02:00
Liam Young
25fafd2c84 Add Service Token support
As documented in [1] service tokens are useful to prevent issues
with long running services or with requests that take a long time
to finish where the user token can expire in the middle of an operation.

[1] https://docs.openstack.org/cinder/latest/configuration/block-storage/service-token.html

Depends-On: I15682c66d252d506e8f1c9b8de818bc19b1af973

Change-Id: I4d906132876a3efe4bd1154ad2c58a3bc635febe
2023-06-15 11:35:59 +00:00
Liam Young
1a63fa2fdf Add action for applying local settings
Add action to apply snap setting specific to the local unit.

Change-Id: I6ab63de753046c07934a6f923206ff5179599e39
2023-04-25 17:15:19 +00:00
Liam Young
123b9af8f2 Add snap optimisations
Add optimisations to only install snap if it is absent and to
only update snap settings if they have changed.

Depends-On: If8086efcf7df4dcbe02be7454578dbbfb2d7945a
Change-Id: Icf2e9834cca6330eec92239aa5a5b76503c7c0f1
2023-04-24 16:53:11 +00:00
Liam Young
744491d03b Unit tests and CI config
Change-Id: I2dfa889913caba8f6ac96ec4e9393c23fdda6100
2023-04-21 11:27:32 +00:00
Liam Young
e4e34102ac Initial commit 2023-03-30 08:23:30 +00:00