You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2014/01/02 12:00:51 UTC

git commit: updated refs/heads/4.3 to 10a6c4f

Updated Branches:
  refs/heads/4.3 bae5be7f4 -> 10a6c4f58


CLOUDSTACK-5704. OVA files exist for templates created from volumes.
Don't package the OVF and VMDK files into OVA after a template is created from volume.
Since packaging process contains reading and writing from the NFS mount, it doubles the amount of data that needs to be moved around


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

Branch: refs/heads/4.3
Commit: 10a6c4f582db565630309d4817e47598bf23f60c
Parents: bae5be7
Author: Likitha Shetty <li...@citrix.com>
Authored: Wed Jan 1 14:21:32 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Thu Jan 2 16:23:45 2014 +0530

----------------------------------------------------------------------
 .../storage/resource/VmwareStorageProcessor.java  | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/10a6c4f5/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 44703d7..07b8db0 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -635,9 +635,22 @@ public class VmwareStorageProcessor implements StorageProcessor {
                     VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
             clonedVm = cloneResult.first();
 
-            clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, true, false);
+            clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, false, false);
+
+            // Get VMDK filename
+            String templateVMDKName = "";
+            File[] files = new File(installFullPath).listFiles();
+            if(files != null) {
+                for(File file : files) {
+                    String fileName = file.getName();
+                    if(fileName.toLowerCase().startsWith(templateUniqueName) && fileName.toLowerCase().endsWith(".vmdk")) {
+                        templateVMDKName += fileName;
+                        break;
+                    }
+                }
+            }
 
-            long physicalSize = new File(installFullPath + "/" + templateUniqueName + ".ova").length();
+            long physicalSize = new File(installFullPath + "/" + templateVMDKName).length();
             VmdkProcessor processor = new VmdkProcessor();
             Map<String, Object> params = new HashMap<String, Object>();
             params.put(StorageLayer.InstanceConfigKey, _storage);
@@ -645,6 +658,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
             long virtualSize = processor.getTemplateVirtualSize(installFullPath, templateUniqueName);
 
             postCreatePrivateTemplate(installFullPath, templateId, templateUniqueName, physicalSize, virtualSize);
+            writeMetaOvaForTemplate(installFullPath, templateUniqueName + ".ovf", templateVMDKName, templateUniqueName, physicalSize);
             return new Ternary<String, Long, Long>(installPath + "/" + templateUniqueName + ".ova", physicalSize, virtualSize);
 
         } finally {