Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ build-backend = "setuptools.build_meta"

[project]
name = "openstack-hypervisor"
version = "2025.1"
requires-python = "~=3.12.0"
version = "2026.1"
requires-python = "~=3.14.0"
license-files = ["LICENSE"]
description = "Hypervisor component of OpenStack"
readme = "README.md"
Expand All @@ -26,14 +26,14 @@ classifiers = [
"Operation System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.14",
]

dependencies = [
"snap-helpers @ git+https://github.com/albertodonato/snap-helpers@46803aa9d52cc0bb24f76df878dd1010fc08e6a0",
"jinja2",
"netifaces",
"pydantic>=2.11.0,<2.12.0", # incompatibility with typing-extensions 4.14.0, while distro is 4.10.0
"pydantic",
"cryptography>=38.0.0,<42,!=40.0.0,!=40.0.1", # PyOpenSSL requirements
"pyroute2==0.7.11", # matched to caracal cloud-archive
"click",
Expand Down
4 changes: 3 additions & 1 deletion snap/patches/libvirt/0001-Remove-definition-of-DNSMASQ.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ Subject: [PATCH] Remove definition of DNSMASQ

Part responsible for building libvirt will define the absolute path to
DNSMASQ. Remove not to create conflict.

---
src/util/virdnsmasq.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 7d6de943c..c782f2ba3 100644
index 7d6de94..c782f2b 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -43,7 +43,6 @@
Expand All @@ -23,3 +24,4 @@ index 7d6de943c..c782f2ba3 100644

--
2.43.0

96 changes: 57 additions & 39 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: openstack-hypervisor
version: '2025.1'
base: core24
version: '2026.1'
base: core26
build-base: devel
summary: OpenStack Hypervisor
description: |
The OpenStack Hypervisor snap provides the requires components
to operate a cloud hypervisor as part of an OpenStack deployment.
assumes:
- snapd2.73
grade: stable
grade: devel
confinement: strict
environment:
LC_ALL: C
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$SNAP/usr/local/bin:$SNAP/usr/local/sbin:$PATH
# Standard library components must have priority in module name resolution: https://storyboard.openstack.org/#!/story/2007806
PYTHONPATH: $PYTHONPATH:$SNAP/usr/lib/python3.12:$SNAP/usr/lib/python3.12/site-packages:$SNAP/usr/lib/python3/dist-packages:$SNAP/lib/python3.12:$SNAP/lib/python3.12/site-packages
PYTHONPATH: $PYTHONPATH:$SNAP/usr/lib/python3.14:$SNAP/usr/lib/python3.14/site-packages:$SNAP/usr/lib/python3/dist-packages:$SNAP/lib/python3.14:$SNAP/lib/python3.14/site-packages
# OVN runtime configuration
OVN_LOGDIR: $SNAP_COMMON/log/ovn
OVN_RUNDIR: $SNAP_COMMON/run/ovn
Expand All @@ -35,11 +36,6 @@ platforms:
arm64:
s390x:

package-repositories:
- type: apt
cloud: epoxy
priority: always

system-usernames:
snap_daemon: shared

Expand Down Expand Up @@ -79,7 +75,7 @@ apps:
openstack-hypervisor:
environment:
# Ensure site packages are loaded first
PYTHONPATH: $SNAP/usr/lib/python3.10:$SNAP/usr/lib/python3.10/site-packages:$SNAP/lib/python3.10:$SNAP/lib/python3.10/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
PYTHONPATH: $SNAP/usr/lib/python3.14:$SNAP/usr/lib/python3.14/site-packages:$SNAP/lib/python3.14:$SNAP/lib/python3.14/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
command: bin/hypervisor
plugs:
- network
Expand Down Expand Up @@ -396,7 +392,7 @@ parts:
qemu:
source: https://git.launchpad.net/ubuntu/+source/qemu
source-type: git
source-branch: ubuntu/noble-updates
source-branch: ubuntu/resolute-devel
source-depth: 1
plugin: autotools
stage-packages:
Expand All @@ -416,14 +412,13 @@ parts:
- libasound2t64
- libasyncns0
- libbluetooth3
- libboost-iostreams1.74.0
- libboost-random1.74.0
- libboost-system1.74.0
- libboost-thread1.74.0
- libboost-iostreams1.90.0
- libboost-random1.90.0
- libboost-thread1.90.0
- libcaca0
- libfdt1
- libflac++10
- libglib2.0-0
- libflac++11
- libglib2.0-0t64
- libglu1-mesa
- libiscsi7
- libjpeg-turbo8
Expand All @@ -439,7 +434,7 @@ parts:
- libslang2
- libsndfile1
- libusb-1.0-0
- libusbredirparser1
- libusbredirparser1t64
- libvorbis0a
- libvorbisenc2
- libx11-6
Expand All @@ -448,28 +443,28 @@ parts:
- libxcb1
- libxdmcp6
- libxext6
- libpng16-16
- libpng16-16t64
- libaio1t64
- libasn1-8-heimdal
- libasn1-8t64-heimdal
- libbrotli1
- libcurl3t64-gnutls
- libgssapi3t64-heimdal
- libhcrypto5t64-heimdal
- libheimbase1-heimdal
- libheimntlm0-heimdal
- libhx509-5-heimdal
- libkrb5-26-heimdal
- libheimbase1t64-heimdal
- libheimntlm0t64-heimdal
- libhx509-5t64-heimdal
- libkrb5-26t64-heimdal
- libldap2
- libnghttp2-14
- libpsl5
- libpsl5t64
- libroken19t64-heimdal
- librtmp1
- libssh-4
- libwind0-heimdal
- libwind0t64-heimdal
- libjack0
- libepoxy0
- libcacard0
- libnettle8
- libnettle8t64
build-packages:
- bison
- flex
Expand Down Expand Up @@ -506,7 +501,6 @@ parts:
- gcc
- meson
- ninja-build
- execstack
autotools-configure-parameters:
- --enable-system
- --target-list=x86_64-softmmu,aarch64-softmmu
Expand All @@ -528,14 +522,14 @@ parts:
install -Dp -m0644 -t $CRAFT_PART_INSTALL/usr/share/qemu/keymaps $(ls -1 $CRAFT_PART_SRC/pc-bios/keymaps/* | fgrep -v /meson.build)
override-prime: |
craftctl default
for f in $(execstack -q $CRAFT_PRIME/usr/share/qemu/* 2>/dev/null| grep -e "^X" | cut -d " " -f2); do
execstack --clear-execstack $f
done
# execstack is no longer available in Ubuntu 26.04 (removed with prelink).
# Modern toolchains produce binaries with correct PT_GNU_STACK by default,
# so clearing executable stack flags manually is no longer necessary.

libvirt:
source: https://git.launchpad.net/ubuntu/+source/libvirt
source-type: git
source-branch: ubuntu/noble-updates
source-branch: ubuntu/resolute-devel
source-depth: 1
after:
- qemu
Expand All @@ -558,6 +552,7 @@ parts:
- libnl-route-3-dev
- libtirpc-dev
- libxml2-utils
- libjson-c-dev
- uuid-dev
- libnuma-dev
- python3-all
Expand All @@ -580,11 +575,11 @@ parts:
- dnsmasq
- iptables
- genisoimage
- libxml2
- libxml2-16
- libyajl2
- libnuma1
- libcurl3-gnutls
- libpcap0.8
- libcurl3t64-gnutls
- libpcap0.8t64
- libpciaccess0
# libvirt uses the pm-is-supported tool.
- pm-utils
Expand Down Expand Up @@ -667,14 +662,32 @@ parts:
#define EBTABLES \"/snap/$CRAFT_PROJECT_NAME/current/usr/sbin/ebtables-legacy\"
" >> $CRAFT_PART_SRC/config.h

# Guard firewall macros in virfirewall.h to prevent redefinition errors
# with the snap-specific paths defined in config.h above.
sed -i \
-e 's/^#define EBTABLES .*/#ifndef EBTABLES\n\0\n#endif/' \
-e 's/^#define IPTABLES .*/#ifndef IPTABLES\n\0\n#endif/' \
-e 's/^#define IP6TABLES .*/#ifndef IP6TABLES\n\0\n#endif/' \
$CRAFT_PART_SRC/src/util/virfirewall.h

pushd $CRAFT_PART_SRC
git config user.email "snapcraft@build"
git config user.name "snapcraft"
git am --abort 2>/dev/null || true
git am $CRAFT_PROJECT_DIR/snap/patches/libvirt/*.patch
popd || exit 1

craftctl default

rsync --remove-source-files -arhvP $CRAFT_PART_INSTALL/snap/$CRAFT_PROJECT_NAME/current/usr/* $CRAFT_PART_INSTALL/usr/
rm -rf $CRAFT_PART_INSTALL/snap/$CRAFT_PROJECT_NAME/current/usr
# purge dangling symlinks from stage-packages
rm -f $CRAFT_PART_INSTALL/usr/bin/on_ac_power
override-prime: |
craftctl default
# on_ac_power is a symlink into the host filesystem (/sbin/on_ac_power);
# remove it here (prime phase) to ensure it never lands in the snap.
rm -f $CRAFT_PRIME/usr/bin/on_ac_power

templates:
source: templates/
Expand Down Expand Up @@ -773,22 +786,24 @@ parts:
popd

openstack-hypervisor:
plugin: python
plugin: uv
source: .
build-snaps: [astral-uv]
build-packages:
- git
- cargo
- rustc
python-requirements:
- requirements.txt
stage-packages:
- python3-venv
after:
- openstack
- apache2-webdav
override-build: |
uv export --frozen --no-hashes --format=requirements-txt -o requirements.txt
craftctl default
snap-helpers write-hooks
# purge dangling venv symlinks pointing into the build directory
rm -f $CRAFT_PART_INSTALL/bin/python
rm -f $CRAFT_PART_INSTALL/bin/python3.14

libvirt-exporter:
plugin: go
Expand Down Expand Up @@ -846,6 +861,9 @@ parts:
- DEBIAN_FRONTEND: "noninteractive"
after: [openstack]
override-build: |
# Ensure meson finds system python3 (with cffi) rather than the
# staged python3 from netplan.io dependencies which lacks cffi.
export PATH=/usr/bin:/usr/sbin:$PATH
meson setup _build -Dunit_testing=false --prefix=/usr
meson compile -C _build
meson install -C _build --destdir $CRAFT_PART_INSTALL
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_returns_1_when_tls_invalid_base64(self, snap, config_file):
@patch("openstack_hypervisor.services.os.set_inheritable")
@patch("openstack_hypervisor.services.os.lseek")
@patch("openstack_hypervisor.services.os.write")
@patch("openstack_hypervisor.services.os.memfd_create", return_value=[10, 11, 12])
@patch("openstack_hypervisor.services.os.memfd_create", create=True, return_value=[10, 11, 12])
@patch("openstack_hypervisor.services.os.dup2")
@patch("openstack_hypervisor.services.os.close")
def test_returns_1_when_config_missing(
Expand All @@ -72,7 +72,7 @@ def test_returns_1_when_config_missing(
@patch("openstack_hypervisor.services.os.set_inheritable")
@patch("openstack_hypervisor.services.os.lseek")
@patch("openstack_hypervisor.services.os.write")
@patch("openstack_hypervisor.services.os.memfd_create", return_value=[10, 11, 12])
@patch("openstack_hypervisor.services.os.memfd_create", create=True, return_value=[10, 11, 12])
def test_success_path(
self,
mock_memfd,
Expand Down
Loading
Loading