Skip to content

[manila] [tests] enforce sharev2 manila client service type#1848

Merged
kayrus merged 1 commit intoterraform-provider-openstack:mainfrom
kayrus:manila-service-type
Mar 14, 2025
Merged

[manila] [tests] enforce sharev2 manila client service type#1848
kayrus merged 1 commit intoterraform-provider-openstack:mainfrom
kayrus:manila-service-type

Conversation

@kayrus
Copy link
Copy Markdown
Collaborator

@kayrus kayrus commented Mar 13, 2025

Resolves #1847

fixes issues with service type aliases in devstack environment with the following catalog:

$ openstack catalog list
+--------------------+--------------------+----------------------------------------------------------------------------+
| Name               | Type               | Endpoints                                                                  |
+--------------------+--------------------+----------------------------------------------------------------------------+
| manila             | share              | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/share/v1/f8ec9151c3eb4ed488668bf05f3784af   |
|                    |                    |                                                                            |
| placement          | placement          | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/placement                                   |
|                    |                    |                                                                            |
| shared-file-system | shared-file-system | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/share/v2                                    |
|                    |                    |                                                                            |
| manilav2           | sharev2            | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/share/v2                                    |
|                    |                    |                                                                            |
| manilav2_legacy    | sharev2_legacy     | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/share/v2/f8ec9151c3eb4ed488668bf05f3784af   |
|                    |                    |                                                                            |
| neutron            | network            | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47:9696/networking                             |
|                    |                    |                                                                            |
| nova               | compute            | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/compute/v2.1                                |
|                    |                    |                                                                            |
| keystone           | identity           | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/identity                                    |
|                    |                    |                                                                            |
| glance             | image              | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/image                                       |
|                    |                    |                                                                            |
| nova_legacy        | compute_legacy     | RegionOne                                                                  |
|                    |                    |   public: http://10.180.142.47/compute/v2/f8ec9151c3eb4ed488668bf05f3784af |
|                    |                    |                                                                            |
+--------------------+--------------------+----------------------------------------------------------------------------+

A new gophercloud feature ends up with the first endpoint found, when:

https://github.com/gophercloud/gophercloud/blob/908ce172717ef96ddea87a969e405e2190a18371/endpoint_search.go#L48

// ServiceTypeAliases contains a mapping of service types to any aliases, as
// defined by the OpenStack Service Types Authority. Only service types that
// we support are included.
var ServiceTypeAliases = map[string][]string{
        "shared-file-system":                  {"sharev2", "share"},
}

And according to https://github.com/gophercloud/gophercloud/blob/908ce172717ef96ddea87a969e405e2190a18371/openstack/endpoint_location.go#L97-L103 only the first endpoint is being picked up.

Therefore terraform tries to use an outdated v1 endpoint, which doesn't support microversions.

cc @stephenfin

@stephenfin
Copy link
Copy Markdown

stephenfin commented Mar 13, 2025

I need to do some more investigation next week to figure out how openstacksdk is avoiding this issue, but I'm not a massive fan of this particular approach. Would it be possible to rework the discovery and alias map so that it's priority-ordered instead, rather than doing an wholesale override like this?

EDIT: Then again, if you're only going to support v2 in terraform and want to get a fix in now, this could be okay. I'd probably add a NOTE about what we're doing here though

@kayrus
Copy link
Copy Markdown
Collaborator Author

kayrus commented Mar 13, 2025

@stephenfin initially these service types were hardcoded. But with this new renaming mess in openstack upstream this appears to be a big headache. @nikParasyr let's discuss what else we can do.

UPD: probably it makes sense to enforce aliases for tests, for other users we can suggest #1804, if they experience issues.

@kayrus kayrus force-pushed the manila-service-type branch from 16cad9d to f309447 Compare March 14, 2025 17:42
@kayrus kayrus changed the title [manila] enforce sharev2 manila client service type [manila] [tests] enforce sharev2 manila client service type Mar 14, 2025
@kayrus
Copy link
Copy Markdown
Collaborator Author

kayrus commented Mar 14, 2025

I decided to add a workaround only for tests.

@kayrus kayrus merged commit 9e8321e into terraform-provider-openstack:main Mar 14, 2025
2 checks passed
@kayrus kayrus deleted the manila-service-type branch March 14, 2025 17:45
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.

[manila] [tests] dalmatian release doesn't respect client microversion

2 participants