cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rodrigo93 <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8830 CLONE - VM snapshot fails...
Date Tue, 16 Feb 2016 17:46:30 GMT
Github user rodrigo93 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/798#discussion_r53048362
  
    --- Diff: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
---
    @@ -1464,4 +1440,45 @@ private String deleteDir(String dir) {
         private static String getVolumeRelativeDirInSecStroage(long volumeId) {
             return "volumes/" + volumeId;
         }
    +
    +    /**
    +     * This method is to check if a given TaskInfo Object is valid( and has name and
entity name assigned).It return true if TaskInfo Object is valid and false otherwise.
    +     *
    +     * @param TaskInfo
    +     *        info
    +     * @return boolean(true or false)
    +     **/
    +    private boolean isvalidTaskInfoObj(TaskInfo info){
    +        return !(info == null || info.getEntityName() == null || info.getName() == null);
    +    }
    +
    +    private boolean waitForRunningTaskOnVM(String vmName, String taskName, VmwareContext
context) throws Exception {
    +        try {
    +            ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
    +            List<ManagedObjectReference> tasks = context.getVimClient().getDynamicProperty(taskmgr,
"recentTask");
    +
    +            for (ManagedObjectReference taskMor : tasks) {
    +                TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor,
"info"));
    +
    +                if (!isvalidTaskInfoObj(info)) {
    --- End diff --
    
    Can't this if's statements be merged into one? This would reduce the complexity of this
part of the code.


---
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