You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2017/04/06 06:42:36 UTC

[1/2] git commit: updated refs/heads/master to 4db186e

Repository: cloudstack
Updated Branches:
  refs/heads/master 5c0979fff -> 4db186ef6


CLOUDSTACK-9720: [VMware] template_spool_ref table is not getting updated with correct template physical size in template_size column.


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

Branch: refs/heads/master
Commit: 8676b202767d8e8d94e6891a23e0261b07afd2af
Parents: 850c07c
Author: Suresh Kumar Anaparti <su...@accelerite.com>
Authored: Fri Dec 30 03:01:12 2016 +0530
Committer: Suresh Kumar Anaparti <su...@accelerite.com>
Committed: Mon Mar 13 00:48:49 2017 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8676b202/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 1d33b16..8026575 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -182,7 +182,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
         return null;
     }
 
-    private VirtualMachineMO copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl,
+    private Pair<VirtualMachineMO, Long> copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl,
             String templatePathAtSecondaryStorage, String templateName, String templateUuid, boolean createSnapshot, Integer nfsVersion) throws Exception {
 
         s_logger.info("Executing copyTemplateFromSecondaryToPrimary. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " +
@@ -229,6 +229,12 @@ public class VmwareStorageProcessor implements StorageProcessor {
             throw new Exception(msg);
         }
 
+        OVAProcessor processor = new OVAProcessor();
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put(StorageLayer.InstanceConfigKey, _storage);
+        processor.configure("OVA Processor", params);
+        long virtualSize = processor.getTemplateVirtualSize(secondaryMountPoint + "/" + templatePathAtSecondaryStorage, templateName);
+
         if (createSnapshot) {
             if (vmMo.createSnapshot("cloud.template.base", "Base snapshot", false, false)) {
                 // the same template may be deployed with multiple copies at per-datastore per-host basis,
@@ -246,7 +252,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
             }
         }
 
-        return vmMo;
+        return new Pair<VirtualMachineMO, Long>(vmMo, new Long(virtualSize));
     }
 
     @Override
@@ -322,6 +328,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
             DatacenterMO dcMo = new DatacenterMO(context, hyperHost.getHyperHostDatacenter());
             VirtualMachineMO templateMo = VmwareHelper.pickOneVmOnRunningHost(dcMo.findVmByNameAndLabel(templateUuidName), true);
             DatastoreMO dsMo = null;
+            Pair<VirtualMachineMO, Long> vmInfo = null;
 
             if (templateMo == null) {
                 if (s_logger.isInfoEnabled()) {
@@ -343,9 +350,10 @@ public class VmwareStorageProcessor implements StorageProcessor {
                 dsMo = new DatastoreMO(context, morDs);
 
                 if (managed) {
-                    VirtualMachineMO vmMo = copyTemplateFromSecondaryToPrimary(hyperHost, dsMo, secondaryStorageUrl, templateInfo.first(), templateInfo.second(),
+                    vmInfo = copyTemplateFromSecondaryToPrimary(hyperHost, dsMo, secondaryStorageUrl, templateInfo.first(), templateInfo.second(),
                             managedStoragePoolRootVolumeName, false, _nfsVersion);
 
+                    VirtualMachineMO vmMo = vmInfo.first();
                     vmMo.unregisterVm();
 
                     String[] vmwareLayoutFilePair = VmwareStorageLayoutHelper.getVmdkFilePairDatastorePath(dsMo, managedStoragePoolRootVolumeName,
@@ -360,7 +368,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
                     dsMo.deleteFolder(folderToDelete, dcMo.getMor());
                 }
                 else {
-                    copyTemplateFromSecondaryToPrimary(hyperHost, dsMo, secondaryStorageUrl, templateInfo.first(), templateInfo.second(),
+                    vmInfo = copyTemplateFromSecondaryToPrimary(hyperHost, dsMo, secondaryStorageUrl, templateInfo.first(), templateInfo.second(),
                             templateUuidName, true, _nfsVersion);
                 }
             } else {
@@ -378,7 +386,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
             else {
                 newTemplate.setPath(templateUuidName);
             }
-            newTemplate.setSize(new Long(0)); // TODO: replace 0 with correct template physical_size.
+            newTemplate.setSize((vmInfo != null)? vmInfo.second() : new Long(0));
 
             return new CopyCmdAnswer(newTemplate);
         } catch (Throwable e) {


[2/2] git commit: updated refs/heads/master to 4db186e

Posted by ra...@apache.org.
Merge pull request #1880 from Accelerite/CLOUDSTACK-9720

CLOUDSTACK-9720: [VMware] template_spool_ref table is not getting updated with correct template physical size in template_size column.Updated the template_spool_ref table with the correct template (VMware - OVA file) size.

* pr/1880:
  CLOUDSTACK-9720: [VMware] template_spool_ref table is not getting updated with correct template physical size in template_size column.

Signed-off-by: Rajani Karuturi <ra...@accelerite.com>


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

Branch: refs/heads/master
Commit: 4db186ef6ff31574486d2aee4908be9ee022c22a
Parents: 5c0979f 8676b20
Author: Rajani Karuturi <ra...@accelerite.com>
Authored: Thu Apr 6 12:11:22 2017 +0530
Committer: Rajani Karuturi <ra...@accelerite.com>
Committed: Thu Apr 6 12:11:22 2017 +0530

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