diff --git a/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java b/core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java index cc9df7146a3..0a5f1d68951 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; + } } diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java index 0cb48fc07c5..1ad2135a695 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); 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 236498c4535..d10242c9e04 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"); } 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 15a6ef28c66..e9444c23d7b 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; + } }