feat: upgrade openstacksdk - #508
Conversation
d9b641d to
c651c91
Compare
blackboxsw
left a comment
There was a problem hiding this comment.
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.
| "knack >= 0.7.1", | ||
| "oci >= 2.17.0", | ||
| "openstacksdk >= 1.1.0, < 1.5.0", | ||
| "openstacksdk >= 4.2.0, < 4.9.0", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()c651c91 to
27b700b
Compare
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>
27b700b to
1a3fe2d
Compare
PR Checklist
To ease the process of reviewing your PR, do make sure to complete the following checklist before submitting a pull
request.
tox -e formatlocally to automatically format my code before submittingtoxlocally ensuring that it passes before submittingDescription
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