mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
1c688f40e1
commit
f099732be7
@ -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
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user