Skip to content

V3 blockstorage snapshot list is using the wrong endpoint #2403

@TaminoWalter

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")
}

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