-
Notifications
You must be signed in to change notification settings - Fork 120
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
Updated requested method to fix vm_reconfigure via rest-api. #413
Updated requested method to fix vm_reconfigure via rest-api. #413
Conversation
@miq-bot add_label bug |
@@ -158,7 +158,7 @@ def requested_storage(args_hash) | |||
end | |||
if args_hash[:resource].options[:disk_remove] | |||
args_hash[:resource].options[:disk_remove].each do |disk| | |||
disk_num = disk[:disk_name].match(/_(\d).vmdk/) | |||
disk_num = disk['disk_name'].match(/_(\d).vmdk/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@billfitzgerald0120 Is this a symbol versus string issue, has it worked before with a symbol?
Do we have spec for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkanoor @tinaafitz I re-created on 5.8.4.5 using the rest-api. The UI worked with the original code but not when using the rest-api. I tested this on master with the same results. There is a requested_spec but it doesn't test the disk remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkanoor @tinaafitz I added a test in requested_spec for disk_remove, please review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@billfitzgerald0120 Is the spec file missing from this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkanoor I just added the spec file.
f3e61c8
to
e737e4a
Compare
…st-api. Issuing a vm_reconfigure disk_remove via rest-api was failing. Very minor change (:disk_name was changed to 'disk_name') disk_num = disk['disk_name'].match(/_(\d).vmdk/)" https://bugzilla.redhat.com/show_bug.cgi?id=1620161 Added a test for disk_remove
e737e4a
to
011643f
Compare
Checked commit billfitzgerald0120@011643f with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@mkanoor @gmcculloug @tinaafitz The requested method was asking for a symbol. The rest-api uses a hash which caused the requested method to fail and create an Error. I change the requested method to use a string and the requested method works for both the UI and the rest-api, but the rest-api fails while trying to delete the disk. We will need to fix this in a different PR. |
We tried to use get_option but that returned an array and we need a hash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@billfitzgerald0120 looks good.
@miq-bot add_label blocker |
@billfitzgerald0120 if this can be backported, can you add the gaprindashvili/yes label. |
@miq-bot add_label gaprindashvili/yes |
Updated requested method to fix vm_reconfigure via rest-api. (cherry picked from commit 758b168) https://bugzilla.redhat.com/show_bug.cgi?id=1629096
Gaprindashvili backport details:
|
Issuing a vm_reconfigure disk_remove via rest-api was failing.
Very minor change (:disk_name was changed to 'disk_name')
disk_num = disk['disk_name'].match(/_(\d).vmdk/)"
https://bugzilla.redhat.com/show_bug.cgi?id=1620161
The rest-api call for vm_reconfigure uses the
options[:disk_remove]
hash which contains a string key of'disk_name'
. The quota requested method failed since it was expecting disk_name as a symbol.The UI also uses the
options[:disk_remove]
hash with a string key of'disk_name'
, which doesn't fail the same way in quota because the hash type is HashWithIndifferentAccess. So, the method wasn't able to find the correct value (nil), but didn't fail. Although this ticket is specifically about quota, the actual vm_reconfigure works when initiated by the UI, but does not work properly when initiated by the rest-api.Will open a new ticket to track the vm_configure rest-api issue.