Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Port to gophercloud v2#505

Open
vooon wants to merge 33 commits intoopenstack-exporter:mainfrom
vooon:port-to-gc-v2
Open

Port to gophercloud v2#505
vooon wants to merge 33 commits intoopenstack-exporter:mainfrom
vooon:port-to-gc-v2

Conversation

@vooon
Copy link
Contributor

@vooon vooon commented Oct 31, 2025

That is a refactoring to use gophercloud/v2.

Tries to solve some of #500

@Sharpz7
Copy link
Collaborator

Sharpz7 commented Oct 31, 2025

Wow! Thanks for this @vooon. Really appreciate it

@Sharpz7
Copy link
Collaborator

Sharpz7 commented Nov 4, 2025

Looks good - I think with a few fixes and a quick change to the heat test fixture, tests should pass.

I think I would feel more comfortable merging this however after merging #481 - just since this is such a large change. I would be interested in your opinion too :)

@vooon
Copy link
Contributor Author

vooon commented Nov 10, 2025

@Sharpz7 sorry, i was on a vacation. I'm unsure if i can fully test things like Heat or Designate, as the stacks i'm currently working on have quite a narrow use.
Of course i can setup devstack, just it'll be far from what i had working on full featured distro (at the same time, i'm glad not:).

@Sharpz7
Copy link
Collaborator

Sharpz7 commented Nov 12, 2025

@vooon I don't have that either, but the CI is pretty good right now. If you don't mind, I can work on this PR after I get the integration tests working (that sets up a devstack in CI so that we get better tests).

Just let me know if you are okay with me pushing to this branch

@vooon
Copy link
Contributor Author

vooon commented Nov 12, 2025

@Sharpz7 yes, please go ahead. Devstack setup surprisingly takes more time...

@Sharpz7
Copy link
Collaborator

Sharpz7 commented Nov 13, 2025

Sounds good - might take me a while to get to but hopefully not too long, I think you have done a large chunk of the work already :)

@vooon
Copy link
Contributor Author

vooon commented Nov 19, 2025

@Sharpz7 some updates:

  • Updated nova hypervisors with the one I got from the devstack (but then i editied values to be the same).
    Mainly that was required because of incorrect next page link.
    It was a bit unpleasant to find out why the heck gophercloud tries to pull some unrelated url.

  • Added request logging is OS_DEBUG env set (what helped me to debug trouble above).

  • Fixed microversion requirement for Nova. Unsure why that worked in fleeting runner... But now, when API responds with multiple versions, and you don't have /v2.1 suffix - it breaks.
    That's actually not the case for recent clouds, where you usually has only /v2.1...

  • Updated gophercloud to 2.9.0 and fixed vCPU counting bug. But that enforced to change Go to 1.24.

@vooon vooon marked this pull request as ready for review November 20, 2025 14:33
@vooon
Copy link
Contributor Author

vooon commented Nov 20, 2025

@Sharpz7 well, i'm complete. Ready for review. Please run also Copilot, interesting if it'll find anything useful.

@vooon vooon requested a review from Sharpz7 November 20, 2025 14:39
@Sharpz7
Copy link
Collaborator

Sharpz7 commented Nov 22, 2025

Hey @vooon ! Thank you so much with this. I am stuck with a lot of academic work right now, but will review soon.

As requested, I will run copilot now

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the openstack-exporter codebase by migrating from gophercloud v1 to v2, a significant refactoring effort. The migration updates the underlying OpenStack SDK library to its latest version, which involves updating import paths, API signatures, and client initialization patterns throughout the codebase. The PR also updates the Go version requirement from 1.23 to 1.24 and includes comprehensive test coverage updates with new fixtures for API discovery endpoints.

Key changes:

  • Complete migration from github.com/gophercloud/gophercloud v1 to v2 with updated import paths
  • Introduction of microversion handling utilities for better API version management
  • Updated all service exporters to use context-aware v2 API calls with context.Context parameter
  • Refactored status mapping from array-based to map-based for better performance and maintainability

Reviewed changes

Copilot reviewed 42 out of 44 changed files in this pull request and generated no comments.

Show a summary per file
File Description
go.mod, go.sum Updated Go version to 1.24 and gophercloud dependencies to v2.9.0
utils/microversion.go New utility for managing API microversions with environment variable support
exporters/exporter.go Removed v1 client, added context-aware collection, improved transport configuration
exporters/utils.go Refactored client creation to v2 API, added generic RemoveElements helper
exporters/nova.go Added microversion setup, refactored flavor ID mapping, improved CPU topology calculation
exporters/neutron.go Updated to v2 APIs, improved port fixed IP handling, added identity client helper
exporters/cinder.go Simplified volume status handling, updated to context-aware v2 calls
exporters/*.go All service exporters updated to accept context parameter and use v2 client
exporters/fixtures/* Added API discovery fixtures for most services, updated test data
exporters/*_test.go Updated test expectations to match v2 API responses
cache/*.go Updated to use v2 client config, improved test assertions
Dockerfile, .github/workflows/ci.yaml Updated Go version to 1.24

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vooon
Copy link
Contributor Author

vooon commented Nov 22, 2025

Hmm, this time Copilot has nice description, not just retelling PR comment :)

@Sharpz7 ok, in a mean time I'm started testing it up on some of clouds.

@Sharpz7
Copy link
Collaborator

Sharpz7 commented Nov 24, 2025

Yes @vooon! I view this AI stuff as "the worst it will ever be" - I think eventually it will be really helpful!

Meanwhile I'll work on #481

@vooon
Copy link
Contributor Author

vooon commented Dec 2, 2025

@Sharpz7 i've encountered the same bug as in #513 but done some refactoring. Also fixed merge error.

@vooon vooon requested a review from Copilot December 3, 2025 10:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 44 out of 46 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

vooon and others added 29 commits February 28, 2026 09:02
Why: mechanical migration to gophercloud v2 APIs.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical framework migration to gophercloud v2.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical signature alignment for gophercloud v2.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: centralize microversion setup during gophercloud v2 porting.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: mechanical service client migration.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: move ironic microversion setup to the common framework helper.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: prevent project-name collisions (cardinality).

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: prevent project-name collisions (cardinality).

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: alert correlation improvement (cardinality).

Signed-off-by: Vladimir Ermakov <[email protected]>
Fix openstack-exporter#519 which is proposed in openstack-exporter#520

Co-authored-by: Dejan Sanader <[email protected]>
Signed-off-by: Vladimir Ermakov <[email protected]>
Why: improve troubleshooting context for baremetal.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: add operational visibility for node lifecycle.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: expose provider generation for drift diagnostics.

Signed-off-by: Vladimir Ermakov <[email protected]>
Why: select available services and fail fast on auth/catalog issues.

Signed-off-by: Vladimir Ermakov <[email protected]>
Signed-off-by: Vladimir Ermakov <[email protected]>
Summary:
- align README metrics table and CLI flags with current behavior
- add exporter build info metric entry

Why:

Keep documentation in sync with implementation to avoid operator confusion.

Signed-off-by: Vladimir Ermakov <[email protected]>
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.

Wrong hypervisor vCPUs calculation if node reports multiple NUMA cells

3 participants