use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommandTest method validate.
@Test
public void validate() {
LUNs lun1 = new LUNs();
lun1.setLUNId("1");
lun1.setStorageDomainId(sdId);
LUNs lun2 = new LUNs();
lun2.setLUNId("2");
lun2.setStorageDomainId(sdId);
when(lunsDao.getAllForVolumeGroup(STORAGE)).thenReturn(Arrays.asList(lun1, lun2));
ValidateTestUtils.runAndAssertValidateSuccess(cmd);
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommandTest method setUp.
@Before
public void setUp() {
StorageDomainStatic sdStatic = createStorageDomain();
spId = Guid.newGuid();
sd = new StorageDomain();
sd.setStorageStaticData(sdStatic);
sd.setStatus(StorageDomainStatus.Active);
sd.setStoragePoolId(spId);
StoragePool sp = new StoragePool();
sp.setId(spId);
sp.setStatus(StoragePoolStatus.Up);
sp.setIsLocal(false);
sp.setCompatibilityVersion(Version.v3_6);
doReturn(sd).when(cmd).getStorageDomain();
doReturn(sp).when(cmd).getStoragePool();
when(sdsDao.get(sdId)).thenReturn(sdStatic);
LUNs lun1 = new LUNs();
lun1.setLUNId("1");
lun1.setStorageDomainId(sdId);
LUNs lun2 = new LUNs();
lun2.setLUNId("2");
lun2.setStorageDomainId(sdId);
when(lunsDao.getAll()).thenReturn(Arrays.asList(lun1, lun2));
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommandTest method validateLunsNotPartOfStorageDomain.
@Test
public void validateLunsNotPartOfStorageDomain() {
LUNs lun1 = new LUNs();
lun1.setLUNId("111");
lun1.setStorageDomainId(sdId);
LUNs lun2 = new LUNs();
lun2.setLUNId("222");
lun2.setStorageDomainId(sdId);
when(lunsDao.getAllForVolumeGroup(STORAGE)).thenReturn(Arrays.asList(lun1, lun2));
ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_LUNS_NOT_PART_OF_STORAGE_DOMAIN);
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommandTest method createLunMap.
private Map<String, List<Pair<VDS, LUNs>>> createLunMap(boolean sameLunSizesPerHost) {
RandomUtils rnd = RandomUtils.instance();
String lunId = rnd.nextString(34);
int lunSize = rnd.nextInt();
List<Pair<VDS, LUNs>> lunList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
LUNs lun = new LUNs();
if (!sameLunSizesPerHost) {
lunSize++;
}
lun.setDeviceSize(lunSize);
lunList.add(new Pair<>(new VDS(), lun));
}
return Collections.singletonMap(lunId, lunList);
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToUpdateInDbSameLunIdDiffPvId.
@Test
public void testGetLunsToUpdateInDbSameLunIdDiffPvId() {
Guid lunId = Guid.newGuid();
Map<LunHandler, List<LUNs>> lunsToUpdateInDb = getLunsToUpdateInDb(lunId, lunId, Guid.newGuid(), Guid.newGuid());
List<LUNs> existingLunsToUpdateInDb = lunsToUpdateInDb.get(command.updateLunsHandler);
assertEquals(Collections.singleton(command.updateLunsHandler), lunsToUpdateInDb.keySet());
assertLunIdInList(existingLunsToUpdateInDb, lunId);
}
Aggregations