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 2015/03/16 08:20:17 UTC

git commit: updated refs/heads/volume-upload to 3de5d9d

Repository: cloudstack
Updated Branches:
  refs/heads/volume-upload aad9b8a51 -> 3de5d9db5


volume upload: Restart of MS leads to loss of browser uploaded templates

on restart of management server, template sync runs. It checks for
templates in ssvm using the uniquename. If it doesnt find any, cleans
the directory. In case of uploaded templates, these are getting saved
using name instead on uniquename and hence template sync cant find them
and does cleanup. Using uniquename in template.properties now.


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

Branch: refs/heads/volume-upload
Commit: 3de5d9db5fa0b3196a00784ffc2c04b998f64de2
Parents: aad9b8a
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Mon Mar 16 12:41:58 2015 +0530
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Mon Mar 16 12:45:24 2015 +0530

----------------------------------------------------------------------
 .../command/TemplateOrVolumePostUploadCommand.java        | 10 ++++++++++
 .../src/com/cloud/template/HypervisorTemplateAdapter.java |  3 ++-
 .../storage/resource/NfsSecondaryStorageResource.java     |  7 ++++---
 .../apache/cloudstack/storage/template/UploadEntity.java  |  9 +++++++++
 4 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3de5d9db/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java b/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java
index cc9df71..0a5f1d6 100644
--- a/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java
@@ -47,6 +47,8 @@ public class TemplateOrVolumePostUploadCommand {
 
     String maxUploadSize;
 
+    String description;
+
     public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo,
             String dataToRole) {
         this.entityId = entityId;
@@ -166,4 +168,12 @@ public class TemplateOrVolumePostUploadCommand {
     public void setMaxUploadSize(String maxUploadSize) {
         this.maxUploadSize = maxUploadSize;
     }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3de5d9db/server/src/com/cloud/template/HypervisorTemplateAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
index 0cb48fc..1ad2135 100755
--- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java
+++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
@@ -258,12 +258,13 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
             }
 
             TemplateOrVolumePostUploadCommand payload = new TemplateOrVolumePostUploadCommand(template.getId(), template.getUuid(), tmpl.getInstallPath(), tmpl.getChecksum(), tmpl
-                    .getType().toString(), template.getName(), template.getFormat().toString(), templateOnStore.getDataStore().getUri(), templateOnStore.getDataStore().getRole()
+                    .getType().toString(), template.getUniqueName(), template.getFormat().toString(), templateOnStore.getDataStore().getUri(), templateOnStore.getDataStore().getRole()
                     .toString());
             //using the existing max template size configuration
             payload.setMaxUploadSize(_configDao.getValue(Config.MaxTemplateAndIsoSize.key()));
             payload.setRemoteEndPoint(ep.getPublicAddr());
             payload.setRequiresHvm(template.requiresHvm());
+            payload.setDescription(template.getDisplayText());
             payloads.add(payload);
         }
         _resourceLimitMgr.incrementResourceCount(profile.getAccountId(), ResourceType.template);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3de5d9db/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 236498c..d10242c 100755
--- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -2634,6 +2634,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
                 uploadEntity.setHvm(cmd.getRequiresHvm());
                 uploadEntity.setChksum(cmd.getChecksum());
                 uploadEntity.setMaxSizeInGB(maxSizeInGB);
+                uploadEntity.setDescription(cmd.getDescription());
                 // create a install dir
                 if (!_storage.exists(installPathPrefix)) {
                     _storage.mkdir(installPathPrefix);
@@ -2677,9 +2678,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
         Script scr = new Script(getScriptLocation(resourceType), timeout, s_logger);
         scr.add("-s", Integer.toString(imgSizeGigs));
         scr.add("-S", Long.toString(UploadEntity.s_maxTemplateSize));
-        //if (uploadEntity.getDescription() != null && dnld.getDescription().length() > 1) {
-        //    scr.add("-d", dnld.getDescription());
-        //}
+        if (uploadEntity.getDescription() != null && uploadEntity.getDescription().length() > 1) {
+            scr.add("-d", uploadEntity.getDescription());
+        }
         if (uploadEntity.isHvm()) {
             scr.add("-h");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3de5d9db/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadEntity.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadEntity.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadEntity.java
index 15a6ef2..e9444c2 100644
--- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadEntity.java
+++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadEntity.java
@@ -32,6 +32,7 @@ public class UploadEntity {
     private String chksum;
     private long physicalSize;
     private int maxSizeInGB;
+    private String description;
 
     public static enum ResourceType {
         VOLUME, TEMPLATE
@@ -180,4 +181,12 @@ public class UploadEntity {
     public void setMaxSizeInGB(int maxSizeInGB) {
         this.maxSizeInGB = maxSizeInGB;
     }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
 }