Skip to content

Manila: add Get for share-access-rules API#2496

Merged
mandre merged 1 commit intogophercloud:masterfrom
gman0:shareaccessrules-get
Nov 18, 2022
Merged

Manila: add Get for share-access-rules API#2496
mandre merged 1 commit intogophercloud:masterfrom
gman0:shareaccessrules-get

Conversation

@gman0
Copy link
Copy Markdown
Contributor

@gman0 gman0 commented Oct 20, 2022

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Oct 20, 2022

Ready for reviews. PTAL @mandre @gouthampacha, thanks!

@coveralls
Copy link
Copy Markdown

coveralls commented Oct 20, 2022

Coverage Status

Coverage increased (+0.02%) to 80.07% when pulling 41a6bc5 on gman0:shareaccessrules-get into 92af431 on gophercloud:master.

@gman0 gman0 force-pushed the shareaccessrules-get branch from 6ce5ac4 to 57997d8 Compare November 9, 2022 15:09
@mandre
Copy link
Copy Markdown
Contributor

mandre commented Nov 9, 2022

I'll try my best to clear my backlog of reviews before the end of the week, sorry for the time it takes.

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Nov 10, 2022

Thanks, @mandre!

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Nov 10, 2022

I've just added an acceptance test but it's failing:

=== RUN   TestShareAccessRulesGet
    shareaccessrules_test.go:29: Unable to grant access to share 70959eca-bcb4-4999-afaf-3e371e044ac1: Resource not found: [POST http://10.1.0.220/share/v2/shares/70959eca-bcb4-4999-afaf-3e371e044ac1/action], error message: {"itemNotFound": {"code": 404, "message": "The resource could not be found."}}
    shares.go:98: Deleted share: 70959eca-bcb4-4999-afaf-3e371e044ac1
--- FAIL: TestShareAccessRulesGet (4.38s)

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.

@mandre
Copy link
Copy Markdown
Contributor

mandre commented Nov 10, 2022

I've just added an acceptance test but it's failing:

=== RUN   TestShareAccessRulesGet
    shareaccessrules_test.go:29: Unable to grant access to share 70959eca-bcb4-4999-afaf-3e371e044ac1: Resource not found: [POST http://10.1.0.220/share/v2/shares/70959eca-bcb4-4999-afaf-3e371e044ac1/action], error message: {"itemNotFound": {"code": 404, "message": "The resource could not be found."}}
    shares.go:98: Deleted share: 70959eca-bcb4-4999-afaf-3e371e044ac1
--- FAIL: TestShareAccessRulesGet (4.38s)

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"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the doc, the date is returned in ISO 8601 format. Was JSONRFC3339MilliNoZ perhaps an old date format used by Manila?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the question perhaps, all date and timestamp fields from openstack services use this datatype within the gophercloud SDK:

type JSONRFC3339MilliNoZ time.Time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reported #2507 for the date parsing issue if anyone wants to take a crack at it.

t.Fatalf("Unable to create a shared file system client: %v", err)
}

client.Microversion = "2.49"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gouthampacha
Copy link
Copy Markdown

Thanks @gman0 - the code LGTM!

Copy link
Copy Markdown
Contributor

@mandre mandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mandre mandre merged commit 3002039 into gophercloud:master Nov 18, 2022
@pierreprinetti pierreprinetti added this to the v1.1.0 milestone Nov 24, 2022
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.

5 participants