nvazquez 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_r252791057
##########
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:
It could be. I think it does not harm to keep a detailed verification and
get a proper error in case the requirements are not met. In the case of
`canHandle` it would be harder to track as in case the requirements are not met
then the strategy will not handle the migration and would need to log the
issue. Both ways are valid but I decided the first one. What do you think?
@GabrielBrascher @rhtyd
----------------------------------------------------------------
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