Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B96E7DFF8 for ; Mon, 11 Mar 2013 11:11:15 +0000 (UTC) Received: (qmail 77297 invoked by uid 500); 11 Mar 2013 11:11:15 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 77231 invoked by uid 500); 11 Mar 2013 11:11:14 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 77176 invoked by uid 99); 11 Mar 2013 11:11:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Mar 2013 11:11:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 476F35DB2; Mon, 11 Mar 2013 11:11:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nitin@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: refs/heads/master - 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 Message-Id: <20130311111113.476F35DB2@tyr.zones.apache.org> Date: Mon, 11 Mar 2013 11:11:13 +0000 (UTC) Updated Branches: refs/heads/master cccdbe630 -> 75261eb31 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 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/master Commit: 75261eb317a763114a6054664f4adf3f7a2c2709 Parents: cccdbe6 Author: Saksham Srivastava Authored: Mon Mar 11 16:38:02 2013 +0530 Committer: Nitin Mehta 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) {