Update Openstack Provider related to goose endpoint version and tests… #6428

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Member

hmlanigan commented Oct 11, 2016

…service changes

These changes are related to go-goose/goose#25

provider/openstack/provider.go
@@ -718,7 +718,7 @@ func (e *Environ) getKeystoneDataSource(mu *sync.Mutex, datasource *simplestream
}
}
- url, err := makeServiceURL(e.client, keystoneName, nil)
+ url, err := makeServiceURL(e.client, keystoneName, "v2.0", nil)
@wallyworld

wallyworld Oct 12, 2016

Owner

Dumb question - we ask for "2.0". Should we fall back to "1.0" if 2.0 not available? What happens if they try on an openstack version that doesn't have the newer 2.0 API?

Also, why pass in "v2.0" and not "2.0"? What does using the "v" prefix gain in return for the added complexity?

Member

hmlanigan commented Oct 12, 2016

Regarding the “v” prefix:
We’re matching the id value from a http:/// call to get the API version info. Though goose will parse it out while trying to get the major and minor version. Either way would work. We have to parse it out of the version data from the API anyways.

Regarding the version asked for not being available:
Returning a different major version could be problematic in general as the API functions can change between them, or the data structures change.
E.g: /images/detail no longer exists in v2, it’s /v2/images/{image_id}
E.g: /v2/tokens is now /v3/auth/tokens

Deprecated functions are being removed as well, sometimes between minor versions. /os-floating-ips is being removed in micro version 2.35.

If you ask for v2 and there are v2.0 and v2.1 available, you’ll get v2.1.

If you ask for no version, it’ll return the url in the endpoint list. Which we do for a cases where the openstack provider makes urls for Swift container retrieval.

If there is no match to the version an error is returned.

There could be a project here to add different code for different versions, in the callers.

On Oct 11, 2016, at 10:08 PM, Ian Booth <notifications@github.commailto:notifications@github.com> wrote:

@wallyworld commented on this pull request.


In provider/openstack/provider.gohttps://github.com/juju/juju/pull/6428#pullrequestreview-3798435:

@@ -718,7 +718,7 @@ func (e *Environ) getKeystoneDataSource(mu *sync.Mutex, datasource *simplestream
}
}

  •   url, err := makeServiceURL(e.client, keystoneName, nil)
    
  •   url, err := makeServiceURL(e.client, keystoneName, "v2.0", nil)
    

Dumb question - we ask for "2.0". Should we fall back to "1.0" if 2.0 not available? What happens if they try on an openstack version that doesn't have the newer 2.0 API?

Also, why pass in "v2.0" and not "2.0"? What does using the "v" prefix gain in return for the added complexity?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/juju/juju/pull/6428#pullrequestreview-3798435, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARbClMx8Z_wPnITypueYMe_FivJfa_FUks5qzEEagaJpZM4KUCNa.

Owner

wallyworld commented Oct 13, 2016

Don't forget to update the goose dependency in dependencies.tsv before landing.
"godeps -u dependencies.tsv" is a good check that the dependency change was valid.

Member

axw commented Oct 26, 2016

@hmlanigan I've merged your commit as part of #6501, so I'm closing this one. Thank you.

@axw axw closed this Oct 26, 2016

@hmlanigan hmlanigan deleted the hmlanigan:api-discovery branch Mar 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment