Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1602#discussion_r74271023
  
    --- Diff: 
plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
 ---
    @@ -66,19 +68,28 @@ public 
VmwareStorageSubsystemCommandHandler(StorageProcessor processor, Integer
             this._nfsVersion = nfsVersion;
         }
     
    -    /**
    -     * Reconfigure NFS version for storage operations
    -     * @param nfsVersion NFS version to set
    -     * @return true if NFS version could be configured, false in other case
    -     */
    -    public boolean reconfigureNfsVersion(Integer nfsVersion){
    +    public boolean 
reconfigureStorageProcessor(EnumMap<VmwareStorageProcessorConfigurableFields,Object>
 params) {
    +        VmwareStorageProcessor processor = (VmwareStorageProcessor) 
this.processor;
             try {
    -            VmwareStorageProcessor processor = (VmwareStorageProcessor) 
this.processor;
    -            processor.setNfsVersion(nfsVersion);
    -            this._nfsVersion = nfsVersion;
    +            for (VmwareStorageProcessorConfigurableFields key : 
params.keySet()){
    +                switch (key){
    +                case NFS_VERSION:
    +                    Integer nfsVersion = (Integer) params.get(key);
    +                    processor.setNfsVersion(nfsVersion);
    +                    this._nfsVersion = nfsVersion;
    +                    break;
    +                case FULL_CLONE_FLAG:
    +                    boolean fullClone = (boolean) params.get(key);
    +                    processor.setFullCloneFlag(fullClone);
    +                    break;
    +                default:
    +                    String msg = "Unknown reconfigurable field " + 
key.getName() + " for VmwareStorageProcessor";
    +                    throw new IllegalStateException(msg);
    +                }
    +            }
                 return true;
    -        } catch (Exception e){
    -            s_logger.error("Error while reconfiguring NFS version " + 
nfsVersion);
    +        } catch (IllegalStateException e){
    --- End diff --
    
    Per my previous comment, why are we throwing an exception on line 86 and 
catching it here?  Why not log the error and return ``false`` in the 
``default`` case?  Using exceptions flow control is both expensive and an bad 
code smell.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to