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()) };
}
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;
}
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();
}
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());
}
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();
}
}
Aggregations