cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [14/17] git commit: refs/heads/ui-multiple-nics - CLOUDSTACK-924 : Volumes created from snapshots misses the source template information.Fixed the issue with volumes now getting the template id. Signed Off by : - Nitin Mehta <nitin.mehta@citrix.com>
Date Mon, 11 Mar 2013 17:31:46 GMT
CLOUDSTACK-924 :
   Volumes created from snapshots misses the source template information.Fixed the issue with
volumes now getting the template id.
	Signed Off by : - Nitin Mehta <nitin.mehta@citrix.com>


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

Branch: refs/heads/ui-multiple-nics
Commit: 75261eb317a763114a6054664f4adf3f7a2c2709
Parents: cccdbe6
Author: Saksham Srivastava <saksham.srivastava@citrix.com>
Authored: Mon Mar 11 16:38:02 2013 +0530
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Mon Mar 11 16:40:12 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/VolumeManagerImpl.java   |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/75261eb3/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index f0e6028..4951975 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -813,6 +813,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager
{
         Long diskOfferingId = null;
         DiskOfferingVO diskOffering = null;
         Long size = null;
+        // Volume VO used for extracting the source template id
+        VolumeVO parentVolume = null;
 
         // validate input parameters before creating the volume
         if ((cmd.getSnapshotId() == null && cmd.getDiskOfferingId() == null)
@@ -891,6 +893,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager
{
                         + snapshotId + " is not in " + Snapshot.State.BackedUp
                         + " state yet and can't be used for volume creation");
             }
+            parentVolume = _volsDao.findByIdIncludingRemoved(snapshotCheck.getVolumeId());
 
             diskOfferingId = snapshotCheck.getDiskOfferingId();
             diskOffering = _diskOfferingDao.findById(diskOfferingId);
@@ -947,6 +950,11 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager
{
         volume.setUpdated(new Date());
         volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller
                 .getDomainId());
+        if (parentVolume != null) {
+            volume.setTemplateId(parentVolume.getTemplateId());
+        }  else {
+            volume.setTemplateId(null);
+        }
 
         volume = _volsDao.persist(volume);
         if (cmd.getSnapshotId() == null) {


Mime
View raw message