Skip to content

V3 blockstorage snapshot list is using the wrong endpoint #2403

Description

@TaminoWalter

Currently used endpoint and the correct endpoint

The snapshot list of blockstorage v3 is using the following endpoint:

https://URL/v3/ADMIN_PROJECT_ID/snapshots?all_tenants=true

But this endpoint is missing some values (for example the project ID). To include all attributes of the snapshot the following endpoint should be used:

https://URL/v3/ADMIN_PROJECT_ID/snapshots/detail?all_tenants=true

Code cause for this issue

This is because a error in https://github.com/gophercloud/gophercloud/blob/master/openstack/blockstorage/v3/snapshots/urls.go. With the following code:

...
func createURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("snapshots")
}
...
func listURL(c *gophercloud.ServiceClient) string {
	return createURL(c)
}
...

As comparison the url generation for the blockstorage volumes (which use the correct detail endpoint) https://github.com/gophercloud/gophercloud/blob/master/openstack/blockstorage/v3/volumes/urls.go

func listURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("volumes", "detail")
}

Potential fix for this issue

This can be fixed by using the same logic for the snapshots like used for the volumes. That would look something like this:

func listURL(c *gophercloud.ServiceClient) string {
	return c.ServiceURL("snapshots", "detail")
}

Activity

  1. github-actions commented on May 18, 2022

    @github-actions

    Thank you for reporting your first issue! Be sure that we will be looking at it, but keep in mind
    this sometimes takes a while.
    Please let the maintainers know if your issue has not got enough attention after a few days.
    If any doubt, please consult our issue tutorial.

  2. TaminoWalter commented on May 19, 2022

    @TaminoWalter
    Author

    I created the following pull request to fix this issue:
    #2404

  3. mandre commented on May 27, 2022

    @mandre
    Contributor

    As I explained in the PR, I think we should add a new function to provide more detailed results rather than modifying List().

    I'm not exactly sure why the blockstorage List() function uses /v3/{project_id}/volumes/detail rather than /v3/{project_id}/volumes, however that looks like a bug. If we were to fix blockstorage List(), this would be a breaking change, and we can do it after we cut the first major version.

  4. added a commit that references this issue on Feb 20, 2025
    6768382
  5. added a commit that references this issue on Mar 14, 2025
    07c8148
  6. added a commit that references this issue on Mar 15, 2025
    88b963b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions