This is an automated email from the ASF dual-hosted git repository.

andrijapanic pushed a commit to branch 4.13
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.13 by this push:
     new c1570b9  Volume migration (#4043)
c1570b9 is described below

commit c1570b9c9125f030b5040996b88928acacb92226
Author: dahn <[email protected]>
AuthorDate: Thu Apr 23 19:56:27 2020 +0200

    Volume migration (#4043)
    
    * Update AncientDataMotionStrategy.java
    
    fix When secondary storage usage is> 90%, VOLUME migration across primary 
storage will cause the migration to fail and lose VOLUME
    
    * Update AncientDataMotionStrategy.java
    
    Volume is migrated across Primary storage. If no secondary storage is 
available(Or used capacity> 90% ), the migration is canceled.
    Before modification, if secondary storage cannot be found, 
copyVolumeBetweenPools return NUll
    
    copyAsync considers answer = null to be a sign of successful task 
execution, so it deletes the VOLUME on the old primary storage. This is the 
root cause of data loss, because VOLUME did not perform the migration at all.
    
    * code in comment removed
    
    Co-authored-by: div8cn <[email protected]>
    Co-authored-by: Daan Hoogland <[email protected]>
---
 .../apache/cloudstack/storage/motion/AncientDataMotionStrategy.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
 
b/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index bc49a53..a5b01c7 100644
--- 
a/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ 
b/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -330,8 +330,9 @@ public class AncientDataMotionStrategy implements 
DataMotionStrategy {
             // directly to s3
             ImageStoreEntity imageStore = 
(ImageStoreEntity)dataStoreMgr.getImageStoreWithFreeCapacity(destScope.getScopeId());
             if (imageStore == null || 
!imageStore.getProtocol().equalsIgnoreCase("nfs") && 
!imageStore.getProtocol().equalsIgnoreCase("cifs")) {
-                s_logger.debug("can't find a nfs (or cifs) image store to 
satisfy the need for a staging store");
-                return null;
+                String errMsg = "can't find a nfs (or cifs) image store to 
satisfy the need for a staging store";
+                Answer answer = new Answer(null, false, errMsg);
+                return answer;
             }
 
             DataObject objOnImageStore = imageStore.create(srcData);

Reply via email to