Search in sources :

Example 6 with VdsSpmIdMap

use of org.ovirt.engine.core.common.businessentities.VdsSpmIdMap in project ovirt-engine by oVirt.

the class VdsSpmIdMapDaoTest method testDeleteByPoolVdsSpmIdMap.

@Test
public void testDeleteByPoolVdsSpmIdMap() {
    dao.removeByVdsAndStoragePool(existingEntity.getId(), existingEntity.getStoragePoolId());
    VdsSpmIdMap result = dao.get(existingEntity.getId());
    assertNull(result);
}
Also used : VdsSpmIdMap(org.ovirt.engine.core.common.businessentities.VdsSpmIdMap) Test(org.junit.Test)

Example 7 with VdsSpmIdMap

use of org.ovirt.engine.core.common.businessentities.VdsSpmIdMap in project ovirt-engine by oVirt.

the class AddVdsSpmIdCommand method insertSpmIdToDb.

protected void insertSpmIdToDb(List<VdsSpmIdMap> vdsSpmIdMapList) {
    int selectedId = 1;
    List<Integer> list = vdsSpmIdMapList.stream().map(VdsSpmIdMap::getVdsSpmId).sorted().collect(Collectors.toList());
    for (int id : list) {
        if (selectedId == id) {
            selectedId++;
        } else {
            break;
        }
    }
    VdsSpmIdMap newMap = new VdsSpmIdMap(getDcId(), getVdsId(), selectedId);
    vdsSpmIdMapDao.save(newMap);
    if (getParameters().isCompensationEnabled()) {
        getCompensationContext().snapshotNewEntity(newMap);
        getCompensationContext().stateChanged();
    }
}
Also used : VdsSpmIdMap(org.ovirt.engine.core.common.businessentities.VdsSpmIdMap)

Aggregations

VdsSpmIdMap (org.ovirt.engine.core.common.businessentities.VdsSpmIdMap)7 Test (org.junit.Test)4 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 Guid (org.ovirt.engine.core.compat.Guid)2 Arrays (java.util.Arrays)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Before (org.junit.Before)1 InjectMocks (org.mockito.InjectMocks)1 Mock (org.mockito.Mock)1 Mockito.verify (org.mockito.Mockito.verify)1 VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)1 SpmStatusResult (org.ovirt.engine.core.common.businessentities.SpmStatusResult)1 StorageDomainDynamic (org.ovirt.engine.core.common.businessentities.StorageDomainDynamic)1 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)1 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)1 VDSType (org.ovirt.engine.core.common.businessentities.VDSType)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 SpmStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SpmStatusVDSCommandParameters)1 SpmStopVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SpmStopVDSCommandParameters)1