Change in constructors

This commit is contained in:
Harikrishna Patnala 2021-09-30 16:59:05 +05:30
parent cb3211ffa1
commit 9aadf0aaeb
8 changed files with 27 additions and 16 deletions

View File

@ -42,18 +42,25 @@ public class MigrateVolumeCommand extends Command {
private Map<String, String> srcDetails;
private Map<String, String> destDetails;
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, int timeout, String chainInfo) {
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, int timeout) {
this.volumeId = volumeId;
this.volumePath = volumePath;
this.pool = new StorageFilerTO(pool);
this.chainInfo = chainInfo;
this.setWait(timeout);
}
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName, Volume.Type volumeType, int timeout) {
this(volumeId, volumePath, pool, timeout);
this.attachedVmName = attachedVmName;
this.volumeType = volumeType;
this.setWait(timeout);
}
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName, Volume.Type volumeType, int timeout, String chainInfo) {
this(volumeId, volumePath, pool, timeout, chainInfo);
this(volumeId, volumePath, pool, timeout);
this.attachedVmName = attachedVmName;
this.volumeType = volumeType;
this.chainInfo = chainInfo;
this.setWait(timeout);
}

View File

@ -38,7 +38,7 @@ public class ResizeVolumeCommand extends Command {
protected ResizeVolumeCommand() {
}
public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance, String chainInfo) {
public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance) {
this.path = path;
this.pool = pool;
this.currentSize = currentSize;
@ -46,12 +46,16 @@ public class ResizeVolumeCommand extends Command {
this.shrinkOk = shrinkOk;
this.vmInstance = vmInstance;
this.managed = false;
}
public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance, String chainInfo) {
this(path, pool, currentSize, newSize, shrinkOk, vmInstance);
this.chainInfo = chainInfo;
}
public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance,
boolean isManaged, String iScsiName) {
this(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
this(path, pool, currentSize, newSize, shrinkOk, vmInstance);
this.iScsiName = iScsiName;
this.managed = isManaged;

View File

@ -209,7 +209,7 @@ public class CheckNetworkAnswerTest {
Long newSize = 4194304L;
Long currentSize = 1048576L;
ResizeVolumeCommand rv = new ResizeVolumeCommand("dummydiskpath", new StorageFilerTO(dummypool), currentSize, newSize, false, "vmName", null);
ResizeVolumeCommand rv = new ResizeVolumeCommand("dummydiskpath", new StorageFilerTO(dummypool), currentSize, newSize, false, "vmName");
@Test
public void testExecuteInSequence() {

View File

@ -740,7 +740,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(destVolumeInfo.getDataStore().getId(), DataStoreRole.Primary);
MigrateVolumeCommand command = new MigrateVolumeCommand(srcVolumeInfo.getId(), srcVolumeInfo.getPath(), destPool, srcVolumeInfo.getAttachedVmName(),
srcVolumeInfo.getVolumeType(), waitInterval, null);
srcVolumeInfo.getVolumeType(), waitInterval);
Map<String, String> details = new HashMap<>();

View File

@ -4836,7 +4836,7 @@ public class LibvirtComputingResourceTest {
final boolean shrinkOk = true;
final String vmInstance = "Test";
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance);
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
final KVMStoragePool storagePool = Mockito.mock(KVMStoragePool.class);
@ -4889,7 +4889,7 @@ public class LibvirtComputingResourceTest {
final boolean shrinkOk = false;
final String vmInstance = "Test";
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance);
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
final KVMStoragePool storagePool = Mockito.mock(KVMStoragePool.class);
@ -4929,7 +4929,7 @@ public class LibvirtComputingResourceTest {
final boolean shrinkOk = false;
final String vmInstance = "Test";
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
@ -4947,7 +4947,7 @@ public class LibvirtComputingResourceTest {
final boolean shrinkOk = true;
final String vmInstance = "Test";
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance);
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
final KVMStoragePool storagePool = Mockito.mock(KVMStoragePool.class);
@ -4976,7 +4976,7 @@ public class LibvirtComputingResourceTest {
final boolean shrinkOk = false;
final String vmInstance = "Test";
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance);
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
final KVMStoragePool storagePool = Mockito.mock(KVMStoragePool.class);
@ -5024,7 +5024,7 @@ public class LibvirtComputingResourceTest {
final boolean shrinkOk = false;
final String vmInstance = "Test";
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance, null);
final ResizeVolumeCommand command = new ResizeVolumeCommand(path, pool, currentSize, newSize, shrinkOk, vmInstance);
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
final KVMStoragePool storagePool = Mockito.mock(KVMStoragePool.class);

View File

@ -430,7 +430,7 @@ public class CitrixRequestWrapperTest {
public void testResizeVolumeCommand() {
final StorageFilerTO pool = Mockito.mock(StorageFilerTO.class);
final ResizeVolumeCommand resizeCommand = new ResizeVolumeCommand("Test", pool, 1l, 3l, false, "Tests-1", null);
final ResizeVolumeCommand resizeCommand = new ResizeVolumeCommand("Test", pool, 1l, 3l, false, "Tests-1");
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);

View File

@ -486,7 +486,7 @@ public class XenServer610WrapperTest {
final Map<String, String> other = new HashMap<String, String>();
other.put("live", "true");
final MigrateVolumeCommand createStorageCommand = new MigrateVolumeCommand(volumeId, volumePath, pool, timeout, null);
final MigrateVolumeCommand createStorageCommand = new MigrateVolumeCommand(volumeId, volumePath, pool, timeout);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);

View File

@ -617,7 +617,7 @@ public class LinstorPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
ResizeVolumeCommand resizeCmd =
new ResizeVolumeCommand(vol.getPath(), new StorageFilerTO(pool), oldSize, resizeParameter.newSize, resizeParameter.shrinkOk,
resizeParameter.instanceName, null);
resizeParameter.instanceName);
CreateCmdResult result = new CreateCmdResult(null, null);
try {
ResizeVolumeAnswer answer = (ResizeVolumeAnswer) _storageMgr.sendToPool(pool, resizeParameter.hosts, resizeCmd);