Search in sources :

Example 1 with StorageDomainDynamic

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

the class JsonObjectSerializationEntitiesTest method data.

@Parameterized.Parameters
public static Object[] data() {
    RandomUtils random = RandomUtils.instance();
    VdsStatic vdsStatic = new VdsStatic(random.nextString(10), random.nextString(10), random.nextInt(), random.nextInt(), random.nextString(10), Guid.newGuid(), Guid.newGuid(), random.nextString(10), random.nextBoolean(), random.nextEnum(VDSType.class), Guid.newGuid());
    return new Object[] { vdsStatic, randomVdsDynamic(), randomVdsStatistics(), new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt()), randomStorageDomainStatic(), new StorageDomainDynamic(random.nextInt(), Guid.newGuid(), random.nextInt()), randomStoragePool(), new StoragePoolIsoMap(Guid.newGuid(), Guid.newGuid(), random.nextEnum(StorageDomainStatus.class)), randomRole(), new IdContainerClass<>(new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt())), new IdContainerClass<>(Guid.newGuid()) };
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) RandomUtils(org.ovirt.engine.core.utils.RandomUtils) VDSType(org.ovirt.engine.core.common.businessentities.VDSType) StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) VdsSpmIdMap(org.ovirt.engine.core.common.businessentities.VdsSpmIdMap) StorageDomainDynamic(org.ovirt.engine.core.common.businessentities.StorageDomainDynamic) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus)

Example 2 with StorageDomainDynamic

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

the class StorageDomainValidator method isDomainWithinThresholds.

public ValidationResult isDomainWithinThresholds() {
    if (storageDomain.getStorageType().isCinderDomain()) {
        return ValidationResult.VALID;
    }
    StorageDomainDynamic dynamicData = storageDomain.getStorageDynamicData();
    StorageDomainStatic staticData = storageDomain.getStorageStaticData();
    if (dynamicData != null && staticData != null && dynamicData.getAvailableDiskSize() != null && staticData.getCriticalSpaceActionBlocker() != null && dynamicData.getAvailableDiskSize() < staticData.getCriticalSpaceActionBlocker()) {
        return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN, storageName());
    }
    return ValidationResult.VALID;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomainDynamic(org.ovirt.engine.core.common.businessentities.StorageDomainDynamic) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Example 3 with StorageDomainDynamic

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

the class UpdateStorageServerConnectionCommandTest method failUpdateConnectToStorage.

@Test
public void failUpdateConnectToStorage() {
    StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
    parameters.setStorageServerConnection(newNFSConnection);
    doReturn(false).when(command).connectToStorage();
    VDSReturnValue returnValueUpdate = new VDSReturnValue();
    returnValueUpdate.setSucceeded(true);
    StorageDomainDynamic domainDynamic = new StorageDomainDynamic();
    StorageDomain domain = createDomain();
    initDomainListForConnection(newNFSConnection.getId(), domain);
    StoragePoolIsoMap map = new StoragePoolIsoMap();
    doReturn(Collections.singletonList(map)).when(command).getStoragePoolIsoMap(domain);
    command.executeCommand();
    CommandAssertUtils.checkSucceeded(command, true);
    verify(storageDomainDynamicDao, never()).update(domainDynamic);
    verify(command, never()).disconnectFromStorage();
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) StorageDomainDynamic(org.ovirt.engine.core.common.businessentities.StorageDomainDynamic) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Test(org.junit.Test)

Example 4 with StorageDomainDynamic

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

the class StorageDomainDynamicDaoTest method testUpdateStorageDomainExternalStatus.

@Test
public void testUpdateStorageDomainExternalStatus() {
    existingEntity.setExternalStatus(ExternalStatus.Error);
    dao.updateExternalStatus(getExistingEntityId(), existingEntity.getExternalStatus());
    StorageDomainDynamic after = dao.get(existingEntity.getId());
    assertEquals(existingEntity.getExternalStatus(), after.getExternalStatus());
}
Also used : StorageDomainDynamic(org.ovirt.engine.core.common.businessentities.StorageDomainDynamic) Test(org.junit.Test)

Example 5 with StorageDomainDynamic

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

the class AddStorageDomainCommand method addStorageDomainInDb.

protected void addStorageDomainInDb() {
    TransactionSupport.executeInNewTransaction(() -> {
        StorageDomainStatic storageStaticData = getStorageDomain().getStorageStaticData();
        storageDomainStaticDao.save(storageStaticData);
        getCompensationContext().snapshotNewEntity(storageStaticData);
        StorageDomainDynamic newStorageDynamic = new StorageDomainDynamic(null, getStorageDomain().getId(), null);
        getReturnValue().setActionReturnValue(getStorageDomain().getId());
        storageDomainDynamicDao.save(newStorageDynamic);
        getCompensationContext().snapshotNewEntity(newStorageDynamic);
        getCompensationContext().stateChanged();
        return null;
    });
    if (getStorageDomain().getStorageDomainType().isDataDomain()) {
        createDefaultDiskProfile();
    }
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomainDynamic(org.ovirt.engine.core.common.businessentities.StorageDomainDynamic)

Aggregations

StorageDomainDynamic (org.ovirt.engine.core.common.businessentities.StorageDomainDynamic)8 Test (org.junit.Test)3 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)3 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)2 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)2 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)1 VDSType (org.ovirt.engine.core.common.businessentities.VDSType)1 VdsSpmIdMap (org.ovirt.engine.core.common.businessentities.VdsSpmIdMap)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 RandomUtils (org.ovirt.engine.core.utils.RandomUtils)1