Adds support for setting image metadata for a volume#1621
Adds support for setting image metadata for a volume#1621jtopjian merged 6 commits intogophercloud:masterfrom
Conversation
Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
|
Build succeeded.
|
|
@jtopjian I think this PR is ready. Can you take a look? Thanks! |
jtopjian
left a comment
There was a problem hiding this comment.
@psinghal20 Just one change with regard to the opts name. Otherwise, this is good to go - nice work.
I created some small code to verify this works, and it does. If you'd like to include an acceptance test for this, I'd be happy to help.
| } | ||
|
|
||
| // SetImageMetadataOpts contains options for setting image metadata to a volume. | ||
| type SetImageMetadataOpts struct { |
There was a problem hiding this comment.
Let's change this to ImageMetadataOpts.
|
|
||
| // SetImageMetdataOptsBuilder allows extensions to add additional parameters to the | ||
| // SetImageMetadataRequest request. | ||
| type SetImageMetdataOptsBuilder interface { |
| // SetImageMetdataOptsBuilder allows extensions to add additional parameters to the | ||
| // SetImageMetadataRequest request. | ||
| type SetImageMetdataOptsBuilder interface { | ||
| ToSetImageMetadataMap() (map[string]interface{}, error) |
|
|
||
| // ToSetImageMetadataMap assembles a request body based on the contents of a | ||
| // SetImageMetadataOpts. | ||
| func (opts SetImageMetadataOpts) ToSetImageMetadataMap() (map[string]interface{}, error) { |
There was a problem hiding this comment.
func (opts ImageMetadataOpts) ToImageMetadataMap() (map[string]interface{}, error) {| } | ||
|
|
||
| // SetImageMetadata will set image metadata on a volume based on the values in UploadImageOptsBuilder. | ||
| func SetImageMetadata(client *gophercloud.ServiceClient, id string, opts SetImageMetdataOptsBuilder) (r SetImageMetadataResult) { |
There was a problem hiding this comment.
func SetImageMetadata(client *gophercloud.ServiceClient, id string, opts ImageMetdataOptsBuilder) (r SetImageMetadataResult) {Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
|
@jtopjian Done with the name changes. I will try working on the acceptance test and ping you if I have any doubts! 🙂 |
Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
|
Build failed.
|
|
@jtopjian I tried adding an acceptance test but it looks like |
jtopjian
left a comment
There was a problem hiding this comment.
@psinghal20 I apologize - I wasn't clear with the request for the name change. Please see below and let me know if you have any questions.
As for the acceptance test, it's fine that the ironic test failed. The ironic test only runs ironic/baremetal tests, not the block storage tests. The cause for the failure was probably a temporary issue with OpenLab.
You can see that your new test passed in the gophercloud-acceptance-test suite: https://logs.openlabtesting.org/logs/21/1621/c031459a0aee3895e9b8277203e07cd62d56ff6c/check/gophercloud-acceptance-test/34342c3/test_results.html (search for TestVolumeActionsImageMetadata). Nice work :)
| } | ||
|
|
||
| // ImageMetadata will set image metadata on a volume based on the values in ImageMetadataOptsBuilder. | ||
| func ImageMetadata(client *gophercloud.ServiceClient, id string, opts ImageMetadataOptsBuilder) (r ImageMetadataResult) { |
There was a problem hiding this comment.
Sorry, I had meant for this to stay SetImageMetadata (#1621 (comment))
The idea is that the opts structure is a "thing" and the function is an "action". We're setting image metadata with the options defined in the image metadata struct, if that makes sense.
Same with the result - that can stay as SetImageMetadataResult because it's the result of the action.
Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
|
Hey @jtopjian, Thanks for clarification. Referred the styleguide and understood what you meant. Hopefully, this final change closes the deal! |
|
Build failed.
|
jtopjian
left a comment
There was a problem hiding this comment.
LGTM - thank you for working on this and for your patience.
For #1610
Adds support for setting image metadata for a volume in volumeactions.
Links to the line numbers/files in the OpenStack source code that support the
code in this PR: