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.
This commit is contained in:
Devdeep Singh 2014-08-18 11:36:28 +05:30
parent 1c688f40e1
commit f099732be7
2 changed files with 8 additions and 3 deletions

View File

@ -30,17 +30,19 @@ public class MigrateVolumeCommand extends Command {
StorageFilerTO pool; StorageFilerTO pool;
String attachedVmName; String attachedVmName;
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool) { public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, int timeout) {
this.volumeId = volumeId; this.volumeId = volumeId;
this.volumePath = volumePath; this.volumePath = volumePath;
this.pool = new StorageFilerTO(pool); 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.volumeId = volumeId;
this.volumePath = volumePath; this.volumePath = volumePath;
this.pool = new StorageFilerTO(pool); this.pool = new StorageFilerTO(pool);
this.attachedVmName = attachedVmName; this.attachedVmName = attachedVmName;
this.setWait(timeout);
} }
@Override @Override

View File

@ -370,9 +370,12 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
} }
protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) { 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; VolumeInfo volume = (VolumeInfo)srcData;
StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(destData.getDataStore().getId(), DataStoreRole.Primary); 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); EndPoint ep = selector.select(srcData, StorageAction.MIGRATEVOLUME);
Answer answer = null; Answer answer = null;
if (ep == null) { if (ep == null) {