GabrielBrascher commented on a change in pull request #2983: KVM live storage 
migration intra cluster from NFS source and destination
URL: https://github.com/apache/cloudstack/pull/2983#discussion_r252502914
 
 

 ##########
 File path: 
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
 ##########
 @@ -2022,10 +2153,40 @@ private ModifyTargetsCommand 
getModifyTargetsCommand(long storagePoolId, String
         return modifyTargetsAnswer.getConnectedPaths();
     }
 
+    /**
+     * Update reference on template_spool_ref table of copied template to 
destination storage
+     */
+    protected void updateCopiedTemplateReference(VolumeInfo srcVolumeInfo, 
VolumeInfo destVolumeInfo) {
+        VMTemplateStoragePoolVO ref = 
templatePoolDao.findByPoolTemplate(srcVolumeInfo.getPoolId(), 
srcVolumeInfo.getTemplateId());
+        VMTemplateStoragePoolVO newRef = new 
VMTemplateStoragePoolVO(destVolumeInfo.getPoolId(), ref.getTemplateId());
+        newRef.setDownloadPercent(100);
+        
newRef.setDownloadState(VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
+        newRef.setState(ObjectInDataStoreStateMachine.State.Ready);
+        newRef.setTemplateSize(ref.getTemplateSize());
+        newRef.setLocalDownloadPath(ref.getLocalDownloadPath());
+        newRef.setInstallPath(ref.getInstallPath());
+        templatePoolDao.persist(newRef);
+    }
+
+    /**
+     * Handle post destination volume creation actions depending on the 
migrating volume type: full clone or linked clone
+     */
+    protected void postVolumeCreationActions(VolumeInfo srcVolumeInfo, 
VolumeInfo destVolumeInfo, VirtualMachineTO vmTO, Host srcHost) {
+        MigrationOptions migrationOptions = 
destVolumeInfo.getMigrationOptions();
+        if (migrationOptions != null) {
+            if (migrationOptions.getType() == 
MigrationOptions.Type.LinkedClone && migrationOptions.isCopySrcTemplate()) {
+                updateCopiedTemplateReference(srcVolumeInfo, destVolumeInfo);
+            }
+        }
+    }
+
     /*
-    * At a high level: The source storage cannot be managed and the 
destination storage must be managed.
+    * At a high level: The source storage cannot be managed and
+    *                  the destination storages can be all managed or all not 
managed, not mixed.
     */
-    private void verifyLiveMigrationMapForKVM(Map<VolumeInfo, DataStore> 
volumeDataStoreMap) {
+    protected void verifyLiveMigrationForKVM(Map<VolumeInfo, DataStore> 
volumeDataStoreMap, Host destHost) {
 
 Review comment:
   What about implementing such verification implemented on the canHandle?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to