CLOUDSTACK-7359. Make sure timeout value is set for the MigrateVolumeCommand. This will make sure the agent waits for the resource to complete (success/failure) migration of volume on the hypervisor.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f099732b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f099732b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f099732b Branch: refs/heads/saml2 Commit: f099732be70c8ffa6d69870cc4b57f1ac3142cc0 Parents: 1c688f4 Author: Devdeep Singh <devd...@gmail.com> Authored: Mon Aug 18 11:36:28 2014 +0530 Committer: Devdeep Singh <devd...@gmail.com> Committed: Mon Aug 18 11:38:29 2014 +0530 ---------------------------------------------------------------------- core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java | 6 ++++-- .../cloudstack/storage/motion/AncientDataMotionStrategy.java | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f099732b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java index 85f0bf4..e5ba211 100644 --- a/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java +++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java @@ -30,17 +30,19 @@ public class MigrateVolumeCommand extends Command { StorageFilerTO pool; String attachedVmName; - public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool) { + public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, int timeout) { this.volumeId = volumeId; this.volumePath = volumePath; this.pool = new StorageFilerTO(pool); + this.setWait(timeout); } - public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName) { + public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName, int timeout) { this.volumeId = volumeId; this.volumePath = volumePath; this.pool = new StorageFilerTO(pool); this.attachedVmName = attachedVmName; + this.setWait(timeout); } @Override http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f099732b/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 415a077..5b01f95 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 @@ -370,9 +370,12 @@ public class AncientDataMotionStrategy implements DataMotionStrategy { } protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) { + String value = configDao.getValue(Config.MigrateWait.key()); + int waitInterval = NumbersUtil.parseInt(value, Integer.parseInt(Config.MigrateWait.getDefaultValue())); + VolumeInfo volume = (VolumeInfo)srcData; StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(destData.getDataStore().getId(), DataStoreRole.Primary); - MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool, volume.getAttachedVmName()); + MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool, volume.getAttachedVmName(), waitInterval); EndPoint ep = selector.select(srcData, StorageAction.MIGRATEVOLUME); Answer answer = null; if (ep == null) {