Search in sources :

Example 26 with LUNs

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;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 27 with 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())));
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 28 with LUNs

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);
}
Also used : ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 29 with LUNs

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);
}
Also used : ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 30 with LUNs

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);
}
Also used : List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) LunHandler(org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)105 ArrayList (java.util.ArrayList)40 Test (org.junit.Test)33 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)26 Guid (org.ovirt.engine.core.compat.Guid)18 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)17 List (java.util.List)16 HashMap (java.util.HashMap)14 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)13 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 VM (org.ovirt.engine.core.common.businessentities.VM)7 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)7 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)7 Map (java.util.Map)6 LUNStorageServerConnectionMap (org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)6 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)5 Pair (org.ovirt.engine.core.common.utils.Pair)5 GetDeviceListVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters)5 HashSet (java.util.HashSet)4