You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2014/11/13 06:02:22 UTC

git commit: updated refs/heads/4.5 to 8b7c1d7

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 980916465 -> 8b7c1d7c5


CLOUDSTACK-7898: Add properties file in same folder as template

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

Branch: refs/heads/4.5
Commit: 8b7c1d7c5e1d7b4396c57d4cf20b24217335bc8e
Parents: 9809164
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Wed Nov 12 21:03:03 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Wed Nov 12 21:03:03 2014 -0700

----------------------------------------------------------------------
 .../resource/Xenserver625StorageProcessor.java  | 25 +++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b7c1d7c/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
index 20baffd..eec01db 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
@@ -904,10 +904,29 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
             }
 
             destVdi = VDI.getByUuid(conn, destVdiUuid);
-            String templatePath = destDir + "/" + destVdiUuid + ".vhd";
-            templatePath = templatePath.replaceAll("//","/");
+
+            // scan makes XenServer pick up VDI physicalSize
+            destSr.scan(conn);
+
+            String templateUuid = destVdi.getUuid(conn);
+            String templateFilename = templateUuid + ".vhd";
+            long virtualSize = destVdi.getVirtualSize(conn);
+            long physicalSize = destVdi.getPhysicalUtilisation(conn);
+
+            String templatePath = destNfsPath + "/" + destDir;
+
+            templatePath = templatePath.replaceAll("//", "/");
+
+            result = hypervisorResource.postCreatePrivateTemplate(conn, templatePath, templateFilename, templateUuid, nameLabel, null,
+                    physicalSize, virtualSize, destObj.getId());
+
+            if (!result) {
+                throw new CloudRuntimeException("Could not create the template.properties file on secondary storage dir");
+            }
+
             TemplateObjectTO newTemplate = new TemplateObjectTO();
-            newTemplate.setPath(templatePath);
+
+            newTemplate.setPath(destDir + "/" + templateFilename);
             newTemplate.setFormat(Storage.ImageFormat.VHD);
             newTemplate.setSize(destVdi.getVirtualSize(conn));
             newTemplate.setPhysicalSize(destVdi.getPhysicalUtilisation(conn));