You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2014/11/27 12:34:18 UTC

git commit: updated refs/heads/4.3 to 0e0827f

Repository: cloudstack
Updated Branches:
  refs/heads/4.3 0a935a336 -> 0e0827f07


CLOUDSTACK-7412: Can't create proper template from VM on S3 secondary storage environment

Signed-off-by: Rajani Karuturi <ra...@gmail.com>


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

Branch: refs/heads/4.3
Commit: 0e0827f07c47289dc210dd50551c4c6df26d0573
Parents: 0a935a3
Author: Hiroki Ohashi <hi...@aist.go.jp>
Authored: Thu Nov 27 19:13:36 2014 +0900
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Thu Nov 27 17:03:25 2014 +0530

----------------------------------------------------------------------
 .../storage/motion/AncientDataMotionStrategy.java | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e0827f0/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index d6759cb..cd20f81 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -176,15 +176,29 @@ AncientDataMotionStrategy implements DataMotionStrategy {
             }
 
             if (cacheData != null) {
-                if (srcData.getType() == DataObjectType.VOLUME && destData.getType() == DataObjectType.VOLUME) {
-                    // volume transfer from primary to secondary or vice versa. Volume transfer between primary pools are already handled by copyVolumeBetweenPools
+                final Long cacheId = cacheData.getId();
+                final String cacheType = cacheData.getType().toString();
+                final String cacheUuid = cacheData.getUuid().toString();
+
+                if (srcData.getType() == DataObjectType.VOLUME &&
+                    (destData.getType() == DataObjectType.VOLUME ||
+                     destData.getType() == DataObjectType.TEMPLATE)) {
+                    // volume transfer from primary to secondary. Volume transfer between primary pools are already handled by copyVolumeBetweenPools
+                    // Delete cache in order to certainly transfer a latest image.
+                    s_logger.debug("Delete " + cacheType + " cache(id: " + cacheId +
+                                   ", uuid: " + cacheUuid + ")");
                     cacheMgr.deleteCacheObject(srcForCopy);
                 } else {
                     // for template, we want to leave it on cache for performance reason
                     if ((answer == null || !answer.getResult()) && srcForCopy.getRefCount() < 2) {
                         // cache object created by this copy, not already there
+                        s_logger.warn("Copy may not be handled correctly by agent(id: " + ep.getId() + ")." +
+                                      " Delete " + cacheType + " cache(id: " + cacheId +
+                                      ", uuid: " + cacheUuid + ")");
                         cacheMgr.deleteCacheObject(srcForCopy);
                     } else {
+                        s_logger.debug("Decrease reference count of " + cacheType +
+                                       " cache(id: " + cacheId + ", uuid: " + cacheUuid + ")");
                         cacheMgr.releaseCacheObject(srcForCopy);
                     }
                 }