Skip to content

feat: upgrade openstacksdk - #508

Open
rpocase wants to merge 4 commits into
canonical:mainfrom
rpocase:20260626-upgrade-openstack-sdk
Open

feat: upgrade openstacksdk#508
rpocase wants to merge 4 commits into
canonical:mainfrom
rpocase:20260626-upgrade-openstack-sdk

Conversation

@rpocase

@rpocase rpocase commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

PR Checklist

To ease the process of reviewing your PR, do make sure to complete the following checklist before submitting a pull
request.

  • I have added unit tests to cover the new behavior under ``tests/unit_tests/```
  • I have run tox -e format locally to automatically format my code before submitting
  • I have run tox locally ensuring that it passes before submitting
  • [-] (if applicable) I have added a reference to issues that this PR relates to in the PR message (Refs GH-1234, Fixes GH-1234)
  • My commits are atomic and follow the convetional commit message format (https://www.conventionalcommits.org/en/v1.0.0/)

Description

this migrates openstacksdk to a modern modern version. the intention is
to drop netiface from the dependency tree because the package is no
longer maintained

this also drops python 3.8, 3.9 support. this started as a means to get to an openstack version that
did not include netiface as a dependency. after that, i noticed python 3.8 + 3.9 went EOL and are not tested in CI. to get to a version of openstacksdk without inetface it required dropping 3.8, 3.9.

Additional Context and Relevant Issues

this builds off of #507

Test Steps

N/A

@rpocase rpocase changed the title 20260626 upgrade openstack sdk feat: upgrade openstack sdk Jun 26, 2026
@rpocase rpocase changed the title feat: upgrade openstack sdk feat: upgrade openstacksdk Jun 26, 2026
@rpocase
rpocase force-pushed the 20260626-upgrade-openstack-sdk branch 2 times, most recently from d9b641d to c651c91 Compare July 24, 2026 20:06

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @rpocase cloud-init is +1 on the breaking change w/ floor of python support at 3.10 for all our test harnesses. With the bump in openstacksdk, I'd like to see us also adapt to the new Compute, Network connection objects to insulate pycloudlib from future SDK changes and eventual deprecation of legacy top-level conn methods.

Comment thread pyproject.toml
"knack >= 0.7.1",
"oci >= 2.17.0",
"openstacksdk >= 1.1.0, < 1.5.0",
"openstacksdk >= 4.2.0, < 4.9.0",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge bump in openstackSDK, can we provide a separate commit to all self.conn changes to align with latest openstacksdk API changes?

It looks to me like we'd expect to see methods hung off of separate self.conn.compute, self.conn.network or self.conn.image. For example, instead of top-level self.conn.create_floating_ip we should be able to use the self.conn.network.create_ip method.

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this changeset may break openstacksdk as APIs have changed to Connection-based objects conn.network conn.compute etc.

Can we get a validation that the following works when you have a sourced valid .novarc?

openstack image list # determine the ID  your want to launch
IMAGE_ID=<IMAGE_ID>
tox -e pytest
source .tox/.testenv/bin/activate
python3 ./examples/openstack_example.py $IMAGE_ID

NOTE: I ran into issues that openstack doesn't like the keyname pycloudlib comes up with , which is our corparate-laptop username. I think we may need to replace any @ and . with hyphens before trying to upload keys to openstack from pycloudlib.

NOTE: I also had to add a specific instance_type to examples to align with my current openstack instance I had access too. From: openstack flavor list

diff --git a/examples/openstack_example.py b/examples/openstack_example.py
index fe8657e..4458d18 100644
--- a/examples/openstack_example.py
+++ b/examples/openstack_example.py
@@ -14,7 +14,7 @@ REQUIRED_ENV_VARS = ("OS_AUTH_URL", "OS_PASSWORD", "OS_USERNAME")
 def basic_lifecycle(image_id: str):
     """Demonstrate basic set of lifecycle operations with OpenStack."""
     with pycloudlib.Openstack("pycloudlib-test") as os_cloud:
-        with os_cloud.launch(image_id=image_id) as inst:
+        with os_cloud.launch(instance_type="production-cpu2-ram4-disk20", image_id=image_id) as inst:
             inst.wait()

Comment thread tox.ini
rpocase and others added 4 commits August 6, 2026 15:39
Require Python >= 3.10, remove py3.8/3.9 classifiers and the py38
tox environment, and bump the package version accordingly.

Python 3.8 support ended on October 7th, 2024 and is not being tested in CI.
Python 3.9 support ended on October 31th, 2025 and is not being tested in CI.
Bump openstacksdk to >= 4.2.0, < 4.9.0 and cap
python-openstackclient at < 8.3.0, updating the lockfile
accordingly. The intention is to drop netiface from the dependency
tree because the package is no longer maintained
openstacksdk >=1.0 folded the legacy shade Connection helpers
(delete_image, create_image_snapshot, get_keypair, create_keypair)
into thin compat wrappers around the per-service proxies
(self.conn.image/self.conn.compute). With the 4.2-4.9 bump these
top-level helpers still work, but the rest of the module already
calls the proxies directly (self.conn.compute.*, self.conn.network.*),
so keep call sites consistent and avoid relying on the shade
compat layer:

- delete_image: use self.conn.image.delete_image + wait_for_delete
  to preserve the original wait=True (poll-until-gone) behavior.
- snapshot: use self.conn.compute.create_server_image directly with
  the already-fetched instance.server, matching what the removed
  create_image_snapshot compat call did internally.
- _get_openstack_keypair: use self.conn.compute.find_keypair/
  create_keypair, the same calls the removed get_keypair/
  create_keypair compat helpers wrapped.

self.conn.create_floating_ip/delete_floating_ip in instance.py are
intentionally left as-is: the compat layer performs external/floating
network auto-discovery that the network.create_ip proxy does not,
so switching would be a real behavior change rather than a pure
API-surface alignment.

Updates unit tests to mock the proxy calls instead of the compat
methods.
The openstacksdk 4.x service proxy APIs default image deletion and server-image waits to 120 seconds. Preserve the replaced compatibility helpers' 3600-second timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rpocase
rpocase force-pushed the 20260626-upgrade-openstack-sdk branch from 27b700b to 1a3fe2d Compare August 6, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants