You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/02/04 20:10:48 UTC
git commit: updated refs/heads/master to 9b21da6
Updated Branches:
refs/heads/master 0839fbce6 -> 9b21da65d
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/9b21da65
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9b21da65
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9b21da65
Branch: refs/heads/master
Commit: 9b21da65d10757db29fa0ba779f424bd15c400df
Parents: 0839fbc
Author: Min Chen <mi...@citrix.com>
Authored: Tue Feb 4 11:01:51 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Feb 4 11:01:51 2014 -0800
----------------------------------------------------------------------
.../storage/snapshot/SnapshotServiceImpl.java | 8 ++--
.../VmwareStorageSubsystemCommandHandler.java | 44 ++++++++++----------
2 files changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b21da65/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 d482e70..8331012 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
@@ -442,10 +442,7 @@ 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...");
- }
+ private void syncSnapshotToRegionStore(long snapshotId, DataStore 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);
@@ -453,6 +450,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/9b21da65/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 a5ebe2e..4312862 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
@@ -92,7 +92,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;
@@ -101,27 +102,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;
}