Manila: add Get for share-access-rules API#2496
Conversation
|
Ready for reviews. PTAL @mandre @gouthampacha, thanks! |
6ce5ac4 to
57997d8
Compare
|
I'll try my best to clear my backlog of reviews before the end of the week, sorry for the time it takes. |
|
Thanks, @mandre! |
|
I've just added an acceptance test but it's failing: https://github.com/gophercloud/gophercloud/actions/runs/3429349022/jobs/5714846083#step:5:1097 I'll have a look ASAP, but if anyone has ideas what's wrong please let me know. |
I haven't looked into the details but according to #1795 (comment), setting the microversion to 2.49 helps. |
| type tmp ShareAccess | ||
| var s struct { | ||
| tmp | ||
| CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"` |
There was a problem hiding this comment.
According to the doc, the date is returned in ISO 8601 format. Was JSONRFC3339MilliNoZ perhaps an old date format used by Manila?
There was a problem hiding this comment.
It seems RFC3339 offers ISO 8601 interoperability: https://www.rfc-editor.org/rfc/rfc3339. Also other structs seem to use this JSONRFC3339MilliNoZ where the docs mention ISO 8601... I'm not an expert in this area
There was a problem hiding this comment.
I don't get the question perhaps, all date and timestamp fields from openstack services use this datatype within the gophercloud SDK:
Line 308 in 5137346
There was a problem hiding this comment.
I'm not exactly an expert either in date format either, but it looks like we expect the 2006-01-02T15:04:05.999999 format for JSONRFC3339MilliNoZ, which is different from what Manila claims to return:
The date and time stamp format is ISO 8601:
CCYY-MM-DDThh:mm:ss±hh:mm
The ±hh:mm value, if included, returns the time zone as an offset from UTC.
For example, 2019-03-27T09:49:58-05:00.
Playing a little bit with it, it seems to break as soon as the date include an UTC offset: https://go.dev/play/p/pJh7jLgonx6. It looks like we're just being lucky.
See for example how we parse the dates in neutron: https://github.com/gophercloud/gophercloud/blob/master/openstack/networking/v2/networks/results.go#L101-L131
There was a problem hiding this comment.
I've reported #2507 for the date parsing issue if anyone wants to take a crack at it.
57997d8 to
41a6bc5
Compare
| t.Fatalf("Unable to create a shared file system client: %v", err) | ||
| } | ||
|
|
||
| client.Microversion = "2.49" |
There was a problem hiding this comment.
this API should be available from "2.45": https://docs.openstack.org/api-ref/shared-file-system/?expanded=list-access-rules-deprecated-detail,list-shares-detail#share-access-rules-since-api-v2-45
There was a problem hiding this comment.
Indeed, in general we should try to stick to the minimum needed microversion, although in that particular case, 2.49 is Stein and we're running only newer versions in our CI so that isn't a big deal.
|
Thanks @gman0 - the code LGTM! |
mandre
left a comment
There was a problem hiding this comment.
Not necessarily for this PR since the issue seems to be more generalized in the sharedfilesystems module, and possibly elsewhere, but the date parsing seems fragile to me and it would be nice to clean it at some point.
| type tmp ShareAccess | ||
| var s struct { | ||
| tmp | ||
| CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"` |
There was a problem hiding this comment.
I'm not exactly an expert either in date format either, but it looks like we expect the 2006-01-02T15:04:05.999999 format for JSONRFC3339MilliNoZ, which is different from what Manila claims to return:
The date and time stamp format is ISO 8601:
CCYY-MM-DDThh:mm:ss±hh:mm
The ±hh:mm value, if included, returns the time zone as an offset from UTC.
For example, 2019-03-27T09:49:58-05:00.
Playing a little bit with it, it seems to break as soon as the date include an UTC offset: https://go.dev/play/p/pJh7jLgonx6. It looks like we're just being lucky.
See for example how we parse the dates in neutron: https://github.com/gophercloud/gophercloud/blob/master/openstack/networking/v2/networks/results.go#L101-L131
| t.Fatalf("Unable to create a shared file system client: %v", err) | ||
| } | ||
|
|
||
| client.Microversion = "2.49" |
There was a problem hiding this comment.
Indeed, in general we should try to stick to the minimum needed microversion, although in that particular case, 2.49 is Stein and we're running only newer versions in our CI so that isn't a big deal.
This PR adds
Getforshare-access-rulesManila API.Part of #2495
Links to the line numbers/files in the OpenStack source code that support the
code in this PR:
https://github.com/openstack/manila/blob/stable/yoga/manila/db/sqlalchemy/api.py#L2591-L2601
https://github.com/openstack/manila/blob/stable/yoga/manila/api/v2/share_accesses.py#L39-L45
https://github.com/openstack/manila/blob/stable/yoga/manila/api/views/share_accesses.py#L50-L62