cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [34/50] [abbrv] git commit: updated refs/heads/4.2 to a23322b
Date Mon, 26 Aug 2013 23:33:10 GMT
CLOUDSTACK-4468:template created from snapshot is destroyed once we
restart management server.


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

Branch: refs/heads/4.2
Commit: f0000814bdfd404749bd1cbf4209fedc9a9d0f22
Parents: 3c69710
Author: Min Chen <min.chen@citrix.com>
Authored: Mon Aug 26 11:53:40 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Mon Aug 26 11:54:05 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/storage/image/store/TemplateObject.java       | 4 ++++
 .../cloud/hypervisor/kvm/storage/KVMStorageProcessor.java    | 1 +
 .../com/cloud/storage/resource/VmwareStorageProcessor.java   | 1 +
 .../hypervisor/xen/resource/XenServerStorageProcessor.java   | 1 +
 .../storage/resource/NfsSecondaryStorageResource.java        | 8 +++++---
 5 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0000814/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
index 9c9c751..0a1836e 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
@@ -207,6 +207,10 @@ public class TemplateObject implements TemplateInfo {
                         if (newTemplate.getFormat() != null) {
                             templateVO.setFormat(newTemplate.getFormat());
                         }
+                        if (newTemplate.getName() != null ){
+                            // For template created from snapshot, template name is determine
by resource code.
+                            templateVO.setUniqueName(newTemplate.getName());
+                        }
                         templateVO.setSize(newTemplate.getSize());
                         this.imageDao.update(templateVO.getId(), templateVO);
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0000814/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 08d6052..fd5c9d9 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -512,6 +512,7 @@ public class KVMStorageProcessor implements StorageProcessor {
             newTemplate.setSize(info.virtualSize);
             newTemplate.setPhysicalSize(info.size);
             newTemplate.setFormat(ImageFormat.QCOW2);
+            newTemplate.setName(templateName);
             return new CopyCmdAnswer(newTemplate);
         } catch (Exception e) {
             s_logger.debug("Failed to create template from volume: " + e.toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0000814/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 c2e55fb..4a0b192 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -937,6 +937,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
             newTemplate.setPhysicalSize(result.second());
             newTemplate.setSize(result.third());
             newTemplate.setFormat(ImageFormat.OVA);
+            newTemplate.setName(uniqeName);
             return new CopyCmdAnswer(newTemplate);
         } catch (Throwable e) {
             if (e instanceof RemoteException) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0000814/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
index 4166d98..c0b04b8 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
@@ -1392,6 +1392,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
             newTemplate.setFormat(ImageFormat.VHD);
             newTemplate.setSize(virtualSize);
             newTemplate.setPhysicalSize(physicalSize);
+            newTemplate.setName(tmpltUUID);
             CopyCmdAnswer answer = new CopyCmdAnswer(newTemplate);
             return answer;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0000814/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 8b9de39..cf4369c 100755
--- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -375,7 +375,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
             FormatInfo info = processor.process(destPath, null, templateUuid);
 
             TemplateLocation loc = new TemplateLocation(_storage, destPath);
-            loc.create(1, true, templateName);
+            loc.create(1, true, templateUuid);
             loc.addFormat(info);
             loc.save();
             TemplateProp prop = loc.getTemplateInfo();
@@ -384,6 +384,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
             newTemplate.setFormat(ImageFormat.VHD);
             newTemplate.setSize(prop.getSize());
             newTemplate.setPhysicalSize(prop.getPhysicalSize());
+            newTemplate.setName(templateUuid);
             return new CopyCmdAnswer(newTemplate);
         } catch (ConfigurationException e) {
             s_logger.debug("Failed to create template from snapshot: " + e.toString());
@@ -424,6 +425,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
                 File metaFile = new File(metaFileName);
                 FileWriter writer = new FileWriter(metaFile);
                 BufferedWriter bufferWriter = new BufferedWriter(writer);
+                // KVM didn't change template unique name, just used the template name passed
from orchestration layer, so no need
+                // to send template name back.
                 bufferWriter.write("uniquename=" + destData.getName());
                 bufferWriter.write("\n");
                 bufferWriter.write("filename=" + fileName);
@@ -454,7 +457,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
 
                 FormatInfo info = processor.process(destPath, null, templateName);
                 TemplateLocation loc = new TemplateLocation(_storage, destPath);
-                loc.create(1, true, srcFile.getName());
+                loc.create(1, true, destData.getName());
                 loc.addFormat(info);
                 loc.save();
 
@@ -464,7 +467,6 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
                 newTemplate.setFormat(srcFormat);
                 newTemplate.setSize(prop.getSize());
                 newTemplate.setPhysicalSize(prop.getPhysicalSize());
-
                 return new CopyCmdAnswer(newTemplate);
             } catch (ConfigurationException e) {
                 s_logger.debug("Failed to create template:" + e.toString());


Mime
View raw message