cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1602: CLOUDSTACK-9422: Granular 'vmware.create.full...
Date Fri, 05 Aug 2016 19:10:51 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1602#discussion_r73744970
  
    --- Diff: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
---
    @@ -537,15 +540,51 @@ public Answer executeRequest(Command cmd) {
         protected void checkStorageProcessorAndHandlerNfsVersionAttribute(StorageSubSystemCommand
cmd) {
             if (storageNfsVersion != null) return;
             if (cmd instanceof CopyCommand){
    -            examineStorageSubSystemCommandNfsVersion((CopyCommand) cmd);
    +            EnumMap<VmwareStorageProcessorConfigurableFields,Object> params = new
EnumMap<VmwareStorageProcessorConfigurableFields,Object>(VmwareStorageProcessorConfigurableFields.class);
    +            examineStorageSubSystemCommandNfsVersion((CopyCommand) cmd, params);
    +            examineStorageSubSystemCommandFullCloneFlagForVmware((CopyCommand) cmd, params);
    +            reconfigureProcessorByHandler(params);
    +        }
    +    }
    +
    +    /**
    +     * Reconfigure processor by handler
    +     * @param params params
    +     */
    +    protected void reconfigureProcessorByHandler(EnumMap<VmwareStorageProcessorConfigurableFields,Object>
params) {
    +        VmwareStorageSubsystemCommandHandler handler = (VmwareStorageSubsystemCommandHandler)
storageHandler;
    +        boolean success = handler.reconfigureStorageProcessor(params);
    +        if (success){
    +            s_logger.info("VmwareStorageProcessor and VmwareStorageSubsystemCommandHandler
successfully reconfigured");
    +        } else {
    +            s_logger.error("Error while reconfiguring VmwareStorageProcessor and VmwareStorageSubsystemCommandHandler");
    +        }
    +    }
    +
    +    /**
    +     * Examine StorageSubSystem command to get full clone flag, if provided
    +     * @param cmd command to execute
    +     * @param params params
    +     */
    +    protected void examineStorageSubSystemCommandFullCloneFlagForVmware(CopyCommand cmd,
EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) {
    +        HypervisorType hypervisor = cmd.getDestTO().getHypervisorType();
    +        if (hypervisor == null || (hypervisor != null && ! hypervisor.equals(HypervisorType.VMware)))
return;
    +
    +        DataStoreTO destDataStore = cmd.getDestTO().getDataStore();
    +        if (destDataStore instanceof PrimaryDataStoreTO){
    +            PrimaryDataStoreTO dest = (PrimaryDataStoreTO) destDataStore;
    +            if (dest.isFullCloneFlag() != null){
    +                params.put(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG,
dest.isFullCloneFlag().booleanValue());
    --- End diff --
    
    Modifying a passed parameter creates side-effects that increase coupling.  Consider refactoring
to return a copy of the ``params`` parameter than contains the new values.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message