use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class ImportHostedEngineStorageDomainCommandTest method createSdLuns.
protected ArrayList<LUNs> createSdLuns() {
LUNs lun = new LUNs();
lun.setVolumeGroupId(VG_ID.toString());
lun.setStorageDomainId(HE_SD_ID);
ArrayList<StorageServerConnections> connections = new ArrayList<>();
StorageServerConnections connection = new StorageServerConnections();
connection.setUserName(ISCSIUSER);
connection.setPassword(ISCSIPASS);
connections.add(connection);
lun.setLunConnections(connections);
ArrayList<LUNs> luns = new ArrayList<>();
luns.add(lun);
return luns;
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class StorageDomainCommandBaseTest method lunAlreadyPartOfStorageDomains.
@Test
public void lunAlreadyPartOfStorageDomains() {
LUNs lun1 = new LUNs();
lun1.setLUNId(GUIDS[0].toString());
lun1.setStorageDomainId(Guid.newGuid());
LUNs lun2 = new LUNs();
lun2.setLUNId(GUIDS[1].toString());
lun2.setStorageDomainId(Guid.newGuid());
when(lunDao.getAll()).thenReturn(Arrays.asList(lun1, lun2));
Set<String> specifiedLunIds = Collections.singleton(GUIDS[0].toString());
assertTrue(cmd.isLunsAlreadyInUse(specifiedLunIds));
List<String> messages = cmd.getReturnValue().getValidationMessages();
assertEquals(2, messages.size());
assertEquals(messages.get(0), EngineMessage.ACTION_TYPE_FAILED_LUNS_ALREADY_PART_OF_STORAGE_DOMAINS.toString());
assertEquals(messages.get(1), String.format("$lunIds %1$s", String.format("%1$s (%2$s)", lun1.getLUNId(), lun1.getStorageDomainName())));
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RemoveStorageServerConnectionCommandTest method checkRemoveIscsiConnectionDisksExist.
@Test
public void checkRemoveIscsiConnectionDisksExist() {
parameters.setStorageServerConnection(iSCSIConnection);
when(storageServerConnectionDao.get(iSCSIConnection.getId())).thenReturn(iSCSIConnection);
List<LUNs> luns = new ArrayList<>();
LUNs lun1 = new LUNs();
lun1.setLUNId("3600144f09dbd05000000517e730b1212");
lun1.setStorageDomainName("storagedomain1");
lun1.setVolumeGroupId("");
lun1.setDiskAlias("disk1");
luns.add(lun1);
LUNs lun2 = new LUNs();
lun2.setLUNId("3600144f09dbd05000000517e730b1212");
lun2.setStorageDomainName("storagedomain4");
lun2.setVolumeGroupId("");
lun2.setDiskAlias("disk2");
luns.add(lun2);
when(lunDao.getAllForStorageServerConnection(iSCSIConnection.getId())).thenReturn(luns);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_DISKS);
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RemoveStorageServerConnectionCommandTest method checkRemoveIscsiConnectionDomainsAndDisksExist.
@Test
public void checkRemoveIscsiConnectionDomainsAndDisksExist() {
parameters.setStorageServerConnection(iSCSIConnection);
when(storageServerConnectionDao.get(iSCSIConnection.getId())).thenReturn(iSCSIConnection);
List<LUNs> luns = new ArrayList<>();
LUNs lun1 = new LUNs();
lun1.setLUNId("3600144f09dbd05000000517e730b1212");
lun1.setStorageDomainName("storagedomain1");
lun1.setVolumeGroupId("G95OWd-Wvck-vftu-pMq9-9SAC-NF3E-ulDPsQ");
luns.add(lun1);
LUNs lun2 = new LUNs();
lun2.setLUNId("3600144f09dbd05000000517e730b1212");
lun2.setStorageDomainName("");
lun2.setVolumeGroupId("");
lun2.setDiskAlias("disk2");
luns.add(lun2);
when(lunDao.getAllForStorageServerConnection(iSCSIConnection.getId())).thenReturn(luns);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS_AND_DISKS);
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToUpdateInDbLunExistsInDbButNotInVgInfo.
@Test
public void testGetLunsToUpdateInDbLunExistsInDbButNotInVgInfo() {
Guid lunFromDbId = Guid.newGuid();
Map<LunHandler, List<LUNs>> lunsToUpdateInDb = getLunsToUpdateInDb(Guid.newGuid(), lunFromDbId, Guid.newGuid(), Guid.newGuid());
List<LUNs> lunsToRemoveFromDb = lunsToUpdateInDb.get(command.removeLunsHandler);
assertEquals(Stream.of(command.saveLunsHandler, command.removeLunsHandler).collect(Collectors.toSet()), lunsToUpdateInDb.keySet());
assertLunIdInList(lunsToRemoveFromDb, lunFromDbId);
}
Aggregations