-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CLOUDSTACK-9132: API createVolume takes empty string for name parameter #1273
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
Conversation
|
Reference(4.6) : #1206 |
46c23f1 to
a16d190
Compare
|
@nitin-maharana HypervisorUtilsTest test have failed, please do a force push again. |
|
Sure @koushik-das. Thanks. |
af6c0b7 to
de8e639
Compare
|
@nitin-maharana, thanks for the update, I will just call your attention to a few points: First of all, why did you open a new PR? I know you closed the other one, but IMHO it makes my job harder. The other PR had all of our conversions; you should have kept working there. It would be easier to track everything that was discussed if everything was at the same PR. Now please, keep with this one, no need to come back to the one you already closed or to open a new one after my suggestions. I noticed that you extract the code to a method as I suggested and created some test cases. You also add the “required = true” as Daan suggested; that is good. Now about the method “getVolumeNameFromCommand” you created. Please note that // is not the proper way to create a Java doc, please replace the // by the proper mark of Java docs About the Java doc I would also encourage you to detail a little bit more the method such as: I do not know the proper notation of java doc to make reference to java classes and methods, so you will need to google it. Now about the tests, please remove those comments over method names. I believe they are not needed as the test method name is self-explained. About the “docs.js”, please improve the sentence you wrote. Now, I draw your attention again to the idea of sticking to the same PR were we started reviewing and chatting. If another reviewer comes to help with this new PR, she/he would not know about the blank case I told you in the other PR. The reviewer might even give a LGTM without even noticing that this PR is incomplete. Having said that, could you add a test case to check the case in which users enter blank strings in the volume name? And of course, fix that in the code; otherwise, the test methods would not work. |
|
@rafaelweingartner : Thanks for reviewing the change. The reason to close the old PR is because it was merging with branch 4.6. I saw most of the recent PRs are created with merging request to master. So, I opened a new PR with master. But I have given a reference to my old PR. So that reviewers can see the conversation. About the code change, if we will make "required=true", there will be a mismatch in logic of UI and API. In UI, the field is optional. I will modify the comments section. Thanks for suggesting. |
de8e639 to
5dd0fb6
Compare
|
@nitin-maharana I did not notice that the other PR was to 4.6, I thought it was to master. At line 487, it is good your code, but we can improve it. The code you wrote is the same as using “org.apache.commons.lang.StringUtils.isBlank(str)”; therefore, I believe you should use the method from “StringUtils” from Apache commons lang. I also recommend you to remove the comments of lines: 362, 369, 376 and 383, those tests names are intuitive, so there is no need to add comment there. |
5dd0fb6 to
5ed7f29
Compare
|
@rafaelweingartner : I have updated the branch. Can you please review the change. Thanks. |
|
@nitin-maharana now almost everything is ok. |
5ed7f29 to
f6b44c6
Compare
|
@rafaelweingartner : Thats cool. I went through the detail of isBlank, but could not catch. Thank you. |
Added conditions to check if the name is empty or blank. If it is empty or blank, then it generates a random name. Made the name field as optional in UI as well as in API. Added required unit tests.
|
@nitin-maharana now the code is perfect. Sorry if I bothered you with a lot of changes. |
|
Thanks a lot @rafaelweingartner , I learned many things. |
|
LGTM |
|
@remibergsma : Shall I make this one against 4.7. I mean, should I make all pending PRs against 4.7? |
|
@nitin-maharana Any bug fix should be against 4.7, any new feature against master. Bug fixes will be forward merged to master after it is merged to 4.7. |
|
Daan Hoogland on dev@cloudstack.apache.org replies: |
|
@remibergsma : My new PRs are failing in 4.7. With the same change it was successful in master. I think there is some issue with the branch. |
|
@nitin-maharana See thread on dev-list: the errors are due to quota plugin failing since Jan 1st 2016. Once this is resolved, you can rebase. @DaanHoogland While that is true, there'll be no more 4.6 release so why bother. There really is no reason not to upgrade to 4.7 when people are on 4.6. It's a 5min task and doesn't require new systemvm template. |
|
@remibergsma There are internal political issues that people may face with certain upgrade, be they with or without reason. |
|
Closing this PR as made a new PR #1319 (Against 4.7 which will be merged in master later). |
Steps to Reproduce:
Create a volume using createVolume API where parameter name is empty.
It creates a volume with empty name.
But the name parameter is mandatory.(Issue)
Expected Behaviour:
It shouldn't create a volume with an empty name. Error should be returned.
Solution:
Added a condition to check in case of empty string. If the name is an empty string, it generates a random name for the volume. Made the name field optional in UI as well as in API.