Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharedfilesystems: Add CreateShareFromSnapshotSupport field to Share struct #2191

Merged
merged 2 commits into from
Jul 15, 2021

Conversation

gman0
Copy link
Contributor

@gman0 gman0 commented Jul 9, 2021

This PR adds CreateShareFromSnapshotSupport field to Share struct. It maps to create_share_from_snapshot_support in response.

For #2190

Links to the line numbers/files in the OpenStack source code that support the
code in this PR:

https://docs.openstack.org/api-ref/shared-file-system/?expanded=show-share-details-detail#id27

@coveralls
Copy link

coveralls commented Jul 9, 2021

Coverage Status

Coverage remained the same at 79.872% when pulling bebec5c on gman0:manila-share-field-sharefromsnap into 5a7ac65 on gophercloud:master.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 9, 2021

Build succeeded.

@gman0
Copy link
Contributor Author

gman0 commented Jul 12, 2021

PTAL @gouthampacha @jtopjian

@jtopjian
Copy link
Contributor

@gman0 Thanks for submitting this.

Can you provide the Manila API code reference that defines this field? Also, are there any unit tests or acceptance tests that can be included in this PR?

@gouthampacha
Copy link

@gman0 Thanks for submitting this.

Can you provide the Manila API code reference that defines this field? Also, are there any unit tests or acceptance tests that can be included in this PR?

I suppose you want the API ref in the PR commit message, @jtopjian ?
https://docs.openstack.org/api-ref/shared-file-system/?expanded=show-share-details-detail#show-share-details

As far as tests are concerned, looks like we could update the fixtures here:




and the assertions here: https://github.com/gophercloud/gophercloud/blob/master/openstack/sharedfilesystems/v2/shares/testing/request_test.go

This seems like a simple case where a missing parameter's being added, but the API ref should contain the right response objects to copy over..

@jtopjian
Copy link
Contributor

@gman0

I suppose you want the API ref in the PR commit message

I was looking for something along the lines of this: https://github.com/openstack/manila/blob/a3aaea91494665a25bdccebf69d9e85e8475983d/manila/api/views/shares.py#L147-L151

If I understand the Manila code correctly, this block of code amends the view/result with the create_share_from_snapshot_support field, but I could be wrong. Step 3 of the contributor guide explains why this is important.

As far as tests are concerned, looks like we could update the fixtures here:

Yeah, updating fixtures (both the JSON responses and mock structs) should be fine. The important piece here is to keep the fixtures up-to-date in case missing fields cause an issue in the future. Unit tests currently pass because this is a boolean field, which defaults to false, which is the default value when a struct field is omitted, so it's more of a coincidence that the tests are passing.

Let me know if this helps or if you have any questions.

@gouthampacha
Copy link

@gman0

I suppose you want the API ref in the PR commit message

I was looking for something along the lines of this: https://github.com/openstack/manila/blob/a3aaea91494665a25bdccebf69d9e85e8475983d/manila/api/views/shares.py#L147-L151

If I understand the Manila code correctly, this block of code amends the view/result with the create_share_from_snapshot_support field, but I could be wrong. Step 3 of the contributor guide explains why this is important.

Totally, thank you for the link to the code-hunting doc. That explains what you were looking for. While it's true that this API can be extended/customized, the intent here is to expose the share object that will be common across all conformant openstack clouds.

As far as tests are concerned, looks like we could update the fixtures here:

Yeah, updating fixtures (both the JSON responses and mock structs) should be fine. The important piece here is to keep the fixtures up-to-date in case missing fields cause an issue in the future. Unit tests currently pass because this is a boolean field, which defaults to false, which is the default value when a struct field is omitted, so it's more of a coincidence that the tests are passing.

+1 Thanks for your response

Let me know if this helps or if you have any questions.

@gman0
Copy link
Contributor Author

gman0 commented Jul 14, 2021

Apologies, I was busy yesterday... Thank you both for suggestions around tests and finding the relevant places in src! I'll update the fixtures and their assertions.

@gman0 gman0 force-pushed the manila-share-field-sharefromsnap branch from 434778e to bebec5c Compare July 14, 2021 12:13
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 14, 2021

Build succeeded.

@jtopjian
Copy link
Contributor

@gouthampacha Sorry. I @'d the wrong person yesterday.

Thank you both. This looks good to me!

Copy link
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

LGTM - thank you!

@gman0
Copy link
Contributor Author

gman0 commented Jul 15, 2021

Thank you!

@gman0
Copy link
Contributor Author

gman0 commented Jul 22, 2021

Hi @jtopjian just a quick question: from the looks of things it seems gophercloud releases are cca 1 month apart. Are you planning to make July's release still, or is v0.19.0 coming out later? We'd like to use this feature already, so I'd like to know whether we should wait a bit more so we can update our dependencies then, or we should just pin our go.mod to this commit now.

@jtopjian
Copy link
Contributor

@gman0 I've just created v0.19.0. Let me know if you need anything else 🙂

@gman0
Copy link
Contributor Author

gman0 commented Jul 22, 2021

@jtopjian that's excellent news, thank you!

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.

None yet

4 participants