Uh oh!
There was an error while loading. Please reload this page.
CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts - #1518
Conversation
wido
commented
Apr 26, 2016
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? |
nvazquez
commented
Apr 26, 2016
You're right, I just wanted to avoid parsing but I can change it to an Integer |
wido
commented
Apr 26, 2016
@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 :) |
nvazquez
commented
Apr 26, 2016
Cool, I changed it and pushed again |
wido
commented
Apr 26, 2016
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. |
nvazquez
commented
Apr 26, 2016
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 |
rafaelweingartner
commented
Apr 27, 2016
@nvazquez I believe so. |
nvazquez
commented
Apr 29, 2016
@rafaelweingartner I added test cases and the new hierarchy |
| public abstract class StorageNfsVersionCommand extends Command { | ||
| protected StorageNfsVersionCommand(){ |
There was a problem hiding this comment.
are you using this constructor?
There was a problem hiding this comment.
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.
sure I do, I had forgotten that in the child class they were invoking the super (). I am sorry for that.
nvazquez
commented
May 2, 2016
@rafaelweingartner@cristofolini I refactored unit tests based on your comments, I also removed |
| // --------------------------------------------------------------------------------------------------- | ||
| @Test | ||
| public void checkStorageProcessorAndHandlerNfsVersionAttributeVersionNotSet(){ |
There was a problem hiding this comment.
@nvazquez if the version is not set, should not we check if the method "examineStorageSubSystemCommandNfsVersion" was called?
rafaelweingartner
commented
May 2, 2016
@nvazquez, that is great. |
rafaelweingartner
commented
May 2, 2016
Just an update, |
nvazquez
commented
May 2, 2016
@rafaelweingartner I squashed them, thanks for your comments and reviews! |
7ef25aa to
9e44ab9Compareserg38
commented
May 3, 2016
All checks passed. @rhtyd, @wido or @GabrielBrascher can you review and give second OK. |
serg38
commented
May 10, 2016
@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.
Please move the nfs version conversion from string to int to a separate method, saw the same pattern at multiple places.
koushik-das
commented
May 10, 2016
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? |
nvazquez
commented
May 13, 2016
@koushik-das I only use Vmware hypervisor so I couldn't test it for Xen or KVM. However, I reviewed code and found |
swill
commented
May 13, 2016
I will run this through my KVM CI right now... |
swill
commented
May 13, 2016
I have tried to CI this PR a couple times. I get the following during Deploy DC. I can't find anything in the |
serg38
commented
May 13, 2016
This doesn't seem to be related to this PR.Can you post managment-server.log extract around the failure time? |
swill
commented
May 13, 2016
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.
@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. |
nvazquez
commented
May 16, 2016
@GabrielBrascher thanks for your review! I pushed changes fixing issues you've found. |
koushik-das
commented
May 17, 2016
@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. |
swill
commented
May 17, 2016
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 |
nvazquez
commented
May 19, 2016
@koushik-das I pushed new changes including an intermediate class as you suggested |
| @@ -0,0 +1,30 @@ | |||
| package org.apache.cloudstack.storage.image; | |||
koushik-das
commented
May 20, 2016
@nvazquez Thanks for the fix. As @DaanHoogland mentioned please add license header to the newly added file. |
swill
commented
May 20, 2016
CI RESULTSSummary of the problem(s): Associated Uploads
Uploads will be available until Comment created by |
swill
commented
May 20, 2016
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... |
nvazquez
commented
May 20, 2016
Thanks @swill@koushik-das! Sorry I was missing a license header, I pushed it now. |
koushik-das
commented
May 20, 2016
@swill nothing outstanding on this |
swill
commented
May 20, 2016
For some reason Travis is unhappy. Would you mind trying again. Sorry for the inconvenience... |
serg38
commented
May 20, 2016
@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 <williamstevens@gmail.com>
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.