Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F362D10850 for ; Tue, 4 Feb 2014 18:47:55 +0000 (UTC) Received: (qmail 45678 invoked by uid 500); 4 Feb 2014 18:47:55 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 45652 invoked by uid 500); 4 Feb 2014 18:47:55 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 45645 invoked by uid 99); 4 Feb 2014 18:47:54 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Feb 2014 18:47:54 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9B928824366; Tue, 4 Feb 2014 18:47:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Message-Id: <2f039e222bbf4449832031db5bd5a3a5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.3-forward to a3caea7 Date: Tue, 4 Feb 2014 18:47:54 +0000 (UTC) Updated Branches: refs/heads/4.3-forward b11c13d4a -> a3caea7e0 CLOUDSTACK-6025:CreateTemplate from snapshot in NFS is failing , after migarting to S3 datastore. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a3caea7e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a3caea7e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a3caea7e Branch: refs/heads/4.3-forward Commit: a3caea7e0aca15c74362bbe8469070228177c96f Parents: b11c13d Author: Min Chen Authored: Tue Feb 4 10:46:30 2014 -0800 Committer: Min Chen Committed: Tue Feb 4 10:46:30 2014 -0800 ---------------------------------------------------------------------- .../storage/snapshot/SnapshotServiceImpl.java | 6 +-- .../VmwareStorageSubsystemCommandHandler.java | 44 ++++++++++---------- 2 files changed, 26 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3caea7e/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java index 3b456ce..e967b06 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java @@ -463,9 +463,6 @@ public class SnapshotServiceImpl implements SnapshotService { // push one individual snapshots currently on cache store to region store if it is not there already private void syncSnapshotToRegionStore(long snapshotId, DataStore store){ - if (s_logger.isDebugEnabled()) { - s_logger.debug("sync snapshot " + snapshotId + " from cache to object store..."); - } // if snapshot is already on region wide object store, check if it is really downloaded there (by checking install_path). Sync snapshot to region // wide store if it is not there physically. SnapshotInfo snapOnStore = _snapshotFactory.getSnapshot(snapshotId, store); @@ -473,6 +470,9 @@ public class SnapshotServiceImpl implements SnapshotService { throw new CloudRuntimeException("Cannot find an entry in snapshot_store_ref for snapshot " + snapshotId + " on region store: " + store.getName()); } if (snapOnStore.getPath() == null || snapOnStore.getPath().length() == 0) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("sync snapshot " + snapshotId + " from cache to object store..."); + } // snapshot is not on region store yet, sync to region store SnapshotInfo srcSnapshot = _snapshotFactory.getReadySnapshotOnCache(snapshotId); if (srcSnapshot == null) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3caea7e/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java index 5eccc3c..a708add 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java @@ -95,7 +95,8 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman } else if (srcData.getObjectType() == DataObjectType.TEMPLATE) { // sync template from NFS cache to S3 in NFS migration to S3 case storageManager.createOvaForTemplate((TemplateObjectTO)srcData); - } else if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.SNAPSHOT) { + } else if (srcData.getObjectType() == DataObjectType.SNAPSHOT) { + // pack ova first // sync snapshot from NFS cache to S3 in NFS migration to S3 case String parentPath = storageResource.getRootDir(srcDataStore.getUrl()); SnapshotObjectTO snap = (SnapshotObjectTO)srcData; @@ -104,27 +105,28 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman String name = path.substring(index + 1); String snapDir = path.substring(0, index); storageManager.createOva(parentPath + File.separator + snapDir, name); - } else if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) { - //create template from snapshot on src at first, then copy it to s3 - TemplateObjectTO cacheTemplate = (TemplateObjectTO)destData; - cacheTemplate.setDataStore(srcDataStore); - CopyCmdAnswer answer = (CopyCmdAnswer)processor.createTemplateFromSnapshot(cmd); - if (!answer.getResult()) { - return answer; + if (destData.getObjectType() == DataObjectType.TEMPLATE) { + //create template from snapshot on src at first, then copy it to s3 + TemplateObjectTO cacheTemplate = (TemplateObjectTO)destData; + cacheTemplate.setDataStore(srcDataStore); + CopyCmdAnswer answer = (CopyCmdAnswer)processor.createTemplateFromSnapshot(cmd); + if (!answer.getResult()) { + return answer; + } + cacheTemplate.setDataStore(destDataStore); + TemplateObjectTO template = (TemplateObjectTO)answer.getNewData(); + template.setDataStore(srcDataStore); + CopyCommand newCmd = new CopyCommand(template, destData, cmd.getWait(), cmd.executeInSequence()); + Answer result = storageResource.defaultAction(newCmd); + //clean up template data on staging area + try { + DeleteCommand deleteCommand = new DeleteCommand(template); + storageResource.defaultAction(deleteCommand); + } catch (Exception e) { + s_logger.debug("Failed to clean up staging area:", e); + } + return result; } - cacheTemplate.setDataStore(destDataStore); - TemplateObjectTO template = (TemplateObjectTO)answer.getNewData(); - template.setDataStore(srcDataStore); - CopyCommand newCmd = new CopyCommand(template, destData, cmd.getWait(), cmd.executeInSequence()); - Answer result = storageResource.defaultAction(newCmd); - //clean up template data on staging area - try { - DeleteCommand deleteCommand = new DeleteCommand(template); - storageResource.defaultAction(deleteCommand); - } catch (Exception e) { - s_logger.debug("Failed to clean up staging area:", e); - } - return result; } needDelegation = true; }