vmware resource code needs to honor the timeout value send

(cherry picked from commit 15a2ea7c7ecde3d0ac692bbab668de2c589eb4a8)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0fd9c43e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0fd9c43e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0fd9c43e

Branch: refs/heads/4.5
Commit: 0fd9c43ea26799d952f0d4eb5cc6c00abf7ddc7b
Parents: 3b65a59
Author: Edison Su <[email protected]>
Authored: Thu Oct 9 16:28:20 2014 -0700
Committer: David Nalley <[email protected]>
Committed: Mon Oct 13 00:38:10 2014 -0400

----------------------------------------------------------------------
 .../resource/VmwareStorageProcessor.java        | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0fd9c43e/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index 8a4ba08..f5d2942 100644
--- 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -498,7 +498,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
         }
     }
 
-    private Pair<String, String> copyVolumeFromSecStorage(VmwareHypervisorHost 
hyperHost, String srcVolumePath, DatastoreMO dsMo, String secStorageUrl) throws 
Exception {
+    private Pair<String, String> copyVolumeFromSecStorage(VmwareHypervisorHost 
hyperHost, String srcVolumePath, DatastoreMO dsMo, String secStorageUrl, long 
wait) throws Exception {
 
         String volumeFolder = null;
         String volumeName = null;
@@ -513,7 +513,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
         }
 
         String newVolume = VmwareHelper.getVCenterSafeUuid();
-        restoreVolumeFromSecStorage(hyperHost, dsMo, newVolume, secStorageUrl, 
volumeFolder, volumeName);
+        restoreVolumeFromSecStorage(hyperHost, dsMo, newVolume, secStorageUrl, 
volumeFolder, volumeName, wait);
 
         return new Pair<String, String>(volumeFolder, newVolume);
     }
@@ -558,7 +558,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
                 }
             }
 
-            Pair<String, String> result = copyVolumeFromSecStorage(hyperHost, 
srcVolume.getPath(), new DatastoreMO(context, morDatastore), srcStore.getUrl());
+            Pair<String, String> result = copyVolumeFromSecStorage(hyperHost, 
srcVolume.getPath(), new DatastoreMO(context, morDatastore), srcStore.getUrl(), 
cmd.getWait() * 1000);
             deleteVolumeDirOnSecondaryStorage(result.first(), 
srcStore.getUrl());
             VolumeObjectTO newVolume = new VolumeObjectTO();
             newVolume.setPath(result.second());
@@ -865,7 +865,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
     }
 
     private Ternary<String, Long, Long> createTemplateFromSnapshot(String 
installPath, String templateUniqueName, String secStorageUrl, String 
snapshotPath,
-            Long templateId) throws Exception {
+            Long templateId, long wait) throws Exception {
         //Snapshot path is decoded in this form: 
/snapshots/account/volumeId/uuid/uuid
         String backupSSUuid;
         String snapshotFolder;
@@ -905,7 +905,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
 
         try {
             if (new File(snapshotFullOVAName).exists()) {
-                command = new Script(false, "cp", _timeout, s_logger);
+                command = new Script(false, "cp", wait, s_logger);
                 command.add(snapshotFullOVAName);
                 command.add(installFullOVAName);
                 result = command.execute();
@@ -916,7 +916,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
                 }
 
                 // untar OVA file at template directory
-                command = new Script("tar", 0, s_logger);
+                command = new Script("tar", wait, s_logger);
                 command.add("--no-same-owner");
                 command.add("-xf", installFullOVAName);
                 command.setWorkDir(installFullPath);
@@ -930,7 +930,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
 
             } else {  // there is no ova file, only ovf originally;
                 if (new File(snapshotFullOvfName).exists()) {
-                    command = new Script(false, "cp", _timeout, s_logger);
+                    command = new Script(false, "cp", wait, s_logger);
                     command.add(snapshotFullOvfName);
                     //command.add(installFullOvfName);
                     command.add(installFullPath);
@@ -960,7 +960,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
                         }
                     }
                     if (snapshotFullVMDKName != null) {
-                        command = new Script(false, "cp", _timeout, s_logger);
+                        command = new Script(false, "cp", wait, s_logger);
                         command.add(snapshotFullVMDKName);
                         command.add(installFullPath);
                         result = command.execute();
@@ -1009,7 +1009,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
             }
 
             NfsTO nfsSvr = (NfsTO)imageStore;
-            Ternary<String, Long, Long> result = 
createTemplateFromSnapshot(template.getPath(), uniqeName, nfsSvr.getUrl(), 
snapshot.getPath(), template.getId());
+            Ternary<String, Long, Long> result = 
createTemplateFromSnapshot(template.getPath(), uniqeName, nfsSvr.getUrl(), 
snapshot.getPath(), template.getId(), cmd.getWait() * 1000);
 
             TemplateObjectTO newTemplate = new TemplateObjectTO();
             newTemplate.setPath(result.first());
@@ -2079,7 +2079,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
     }
 
     private Long restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, 
DatastoreMO primaryDsMo, String newVolumeName, String secStorageUrl, String 
secStorageDir,
-            String backupName) throws Exception {
+            String backupName, long wait) throws Exception {
 
         String secondaryMountPoint = mountService.getMountPoint(secStorageUrl);
         String srcOVAFileName = null;
@@ -2100,7 +2100,7 @@ public class VmwareStorageProcessor implements 
StorageProcessor {
         if (!ovfFile.exists()) {
             srcOVFFileName = getOVFFilePath(srcOVAFileName);
             if (srcOVFFileName == null && ovafile.exists()) {  // volss: ova 
file exists; o/w can't do tar
-                Script command = new Script("tar", 0, s_logger);
+                Script command = new Script("tar", wait, s_logger);
                 command.add("--no-same-owner");
                 command.add("-xf", srcOVAFileName);
                 command.setWorkDir(secondaryMountPoint + "/" + secStorageDir + 
"/" + snapshotDir);

Reply via email to