-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts #1518
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
|
A version is a number, eg 3 or 4. Shouldn't the version be passed as a integer through the code instead of a String? |
|
You're right, I just wanted to avoid parsing but I can change it to an Integer |
|
@nvazquez If you know it's a number, pass it as an int. That way you will never have a garbage string ending up somewhere. We have types for a reason :) |
|
Cool, I changed it and pushed again |
|
Thanks! I'm not familiar with the VMWare code in CloudStack, so I won't give a LGTM. But passing a version as a Int seems a lot better. |
|
Thanks @wido! |
|
@nvazquez , what about extracting that “private Integer nfsVersion” to a common superclass to all of those command class? I have created a hierarchy to help you. The classes with an * are the ones that you did not touch directly, they are there just to build the hierarchy. I found a little odd that the “ListTemplateCommand” received those values too, are they being used there? Maybe you cannot write a single super class to attend all of those cases, but you could easily write on to be the super class for (CopyVolumeCommand, SecStorageSetupCommand, GetStorageStatsCommand, SnapshotCommand, BackupSnapshotCommand , CreatePrivateTemplateFromSnapshotCommand, CreatePrivateTemplateFromVolumeCommand, CreateVolumeFromSnapshotCommand) Here is the hierachy: I missing the test cases for “checkStorageProcessorAndHandlerNfsVersionAttribute”, “examineStorageSubSystemCommandNfsVersion”, “setCurrentNfsVersionInProcessorAndHandler” , “getStorageNfsVersionFromNfsTO” and “reconfigureNfsVersion” methods. They are very good coded, clean, short, well documented. To improve them further the writing of test cases is very welcome. |
|
Thanks @rafaelweingartner, I like the idea, I think the best way would be leave hierarchy like this: This way it can be avoided |
|
@nvazquez I believe so. |
|
@rafaelweingartner I added test cases and the new hierarchy |
|
|
||
| public abstract class StorageNfsVersionCommand extends Command { | ||
|
|
||
| protected StorageNfsVersionCommand(){ |
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.
are you using this constructor?
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.
Actually, I kept it for the hierarchy. Classes extending StorageNfsVersionCommand will not compile if I remove it, in their constructors the error will be:
Implicit super constructor StorageNfsVersionCommand() is undefined. Must explicitly invoke another constructor
Do you agree about keeping it?
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.
sure I do, I had forgotten that in the child class they were invoking the super (). I am sorry for that.
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.
No problem ;)
|
@rafaelweingartner @cristofolini I refactored unit tests based on your comments, I also removed |
| // --------------------------------------------------------------------------------------------------- | ||
|
|
||
| @Test | ||
| public void checkStorageProcessorAndHandlerNfsVersionAttributeVersionNotSet(){ |
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.
@nvazquez if the version is not set, should not we check if the method "examineStorageSubSystemCommandNfsVersion" was called?
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.
Sounds good
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.
I added it
|
@nvazquez, that is great. |
|
Just an update, |
|
@rafaelweingartner I squashed them, thanks for your comments and reviews! |
7ef25aa to
9e44ab9
Compare
|
All checks passed. @rhtyd, @wido or @GabrielBrascher can you review and give second OK. |
|
@koushik-das Will you be able to review this PR? It has been waiting for 2d LGTM for a while now. |
| private Map<String, TemplateProp> listTemplate(DataStore ssStore) { | ||
| ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), imageStoreDetailsUtil.getNfsVersion(ssStore.getId())); | ||
| String nfsVersionParam = imageStoreDetailsUtil.getNfsVersion(ssStore.getId()); | ||
| Integer nfsVersion = (nfsVersionParam != null ? Integer.valueOf(nfsVersionParam) : null); |
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.
Please move the nfs version conversion from string to int to a separate method, saw the same pattern at multiple places.
|
Looks like nfs version is only supported for VMware. If XS or KVM clusters are added to the zone (having nfs version set on image store) will there be any side effects? @sateesh-chodapuneedi can you review the VMware code? |
|
@koushik-das I only use Vmware hypervisor so I couldn't test it for Xen or KVM. However, I reviewed code and found |
|
I will run this through my KVM CI right now... |
|
I have tried to CI this PR a couple times. I get the following during Deploy DC. I can't find anything in the |
|
This doesn't seem to be related to this PR.Can you post managment-server.log extract around the failure time? |
|
I am running into this on a couple PRs I need to figure out what is going on... |
|
|
||
| /** | ||
| * Get storage NFS version from NfsTO | ||
| * @param nfsTO nfsTO |
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.
@nvazquez just a small typo, change "true if NFS version if found" to "true if NFS version was found".
Good job with the code documentation, thanks.
|
@nvazquez sorry for the late review, I could point just 2 typos on Javadoc and some variables with the underscore (would be nice to change those variables names, but they are nothing serious). Great work, I can't see anything wrong, the code LGTM. Note: I am just giving my feedback, I don't want to run over the @koushik-das review, it would be nice to check his comment about NFS_VERSION_DETAILS_KEY at the "BaseImageStoreDriverImpl" class. Thanks. |
|
@GabrielBrascher thanks for your review! I pushed changes fixing issues you've found. |
|
@nvazquez I am not too familiar with the VMware specific code, rest of the code looks ok. Also a comment on #1361 when this feature was initially added. NFS version is stored in image_store_details table and needs to be manually added using some sql script. A better way would be to use ConfigKey to expose the configuration. There will be some work involved to include image store as a scope for specifying configuration. May be you can fix it in subsequent PR. |
|
I am having a hard time testing this because I can't seem to get the templates to become ready using this PR. My CI ran all night last night and this morning it was still waiting for the templates to be ready. I just did another run and I am stuck at the same place. I am not seeing any errors in the |
|
@koushik-das I pushed new changes including an intermediate class as you suggested |
| @@ -0,0 +1,30 @@ | |||
| package org.apache.cloudstack.storage.image; | |||
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.
license missing
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.
Done, thanks!
|
@nvazquez Thanks for the fix. As @DaanHoogland mentioned please add license header to the newly added file. |
CI RESULTSSummary of the problem(s): Associated Uploads
Uploads will be available until Comment created by |
|
This is a passing CI now. @koushik-das do you have anything outstanding with this PR? @nvazquez can you close and reopen or do a force push to kick off a Jenkins run to see if we can get this green? Thanks for the work on this to get it ready... |
|
Thanks @swill @koushik-das! Sorry I was missing a license header, I pushed it now. |
|
@swill nothing outstanding on this |
|
For some reason Travis is unhappy. Would you mind trying again. Sorry for the inconvenience... |
…ry Storage mounts
|
@swill Travis passed. Looks like it is ready to merge. |
CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts## Description JIRA TICKET: https://issues.apache.org/jira/browse/CLOUDSTACK-9368 This pull request address a problem introduced in #1361 in which NFS version couldn't be changed after hosts resources were configured on startup (for hosts using `VmwareResource`), and as host parameters didn't include `nfs.version` key, it was set `null`. ## Proposed solution In this proposed solution `nfsVersion` would be passed in `NfsTO` through `CopyCommand` to `VmwareResource`, who will check if NFS version is still configured or not. If not, it will use the one sent in the command and will set it to its storage processor and storage handler. After those setups, it will proceed executing command. * pr/1518: CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts Signed-off-by: Will Stevens <[email protected]>
Description
JIRA TICKET: https://issues.apache.org/jira/browse/CLOUDSTACK-9368
This pull request address a problem introduced in #1361 in which NFS version couldn't be changed after hosts resources were configured on startup (for hosts using
VmwareResource), and as host parameters didn't includenfs.versionkey, it was setnull.Proposed solution
In this proposed solution
nfsVersionwould be passed inNfsTOthroughCopyCommandtoVmwareResource, who will check if NFS version is still configured or not. If not, it will use the one sent in the command and will set it to its storage processor and storage handler. After those setups, it will proceed executing command.