use of org.ovirt.engine.core.bll.context.CompensationContext in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommand method changeStorageDomainStatusInTransaction.
protected void changeStorageDomainStatusInTransaction(final StorageDomainStatus status) {
executeInNewTransaction(() -> {
CompensationContext context = getCompensationContext();
for (StorageDomain domain : domains) {
for (StoragePoolIsoMap map : getStoragePoolIsoMap(domain)) {
context.snapshotEntityStatus(map);
updateStatus(map, status);
}
}
getCompensationContext().stateChanged();
return null;
});
}
use of org.ovirt.engine.core.bll.context.CompensationContext in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommand method updateStorageDomain.
protected void updateStorageDomain(final List<StorageDomain> storageDomainsToUpdate) {
executeInNewTransaction(() -> {
for (StorageDomain domainToUpdate : storageDomainsToUpdate) {
CompensationContext context = getCompensationContext();
context.snapshotEntity(domainToUpdate.getStorageDynamicData());
storageDomainDynamicDao.update(domainToUpdate.getStorageDynamicData());
getCompensationContext().stateChanged();
}
return null;
});
}
use of org.ovirt.engine.core.bll.context.CompensationContext in project ovirt-engine by oVirt.
the class ImportHostedEngineStorageDomainCommandTest method prepareCommand.
protected void prepareCommand() {
parameters.setStoragePoolId(HE_SP_ID);
parameters.setVdsId(HE_VDS_ID);
parameters.setStorageDomainId(HE_SD_ID);
// vds
VDS vds = new VDS();
vds.setId(Guid.Empty);
vds.setStoragePoolId(HE_SP_ID);
when(vdsDao.get(any())).thenReturn(vds);
List<BaseDisk> baseDisks = Collections.singletonList(new BaseDisk());
when(baseDiskDao.getDisksByAlias(any())).thenReturn(baseDisks);
// Data center
StoragePool pool = new StoragePool();
pool.setStatus(StoragePoolStatus.Up);
pool.setId(HE_SP_ID);
when(storagePoolDao.get(HE_SP_ID)).thenReturn(pool);
// compensation
CompensationContext compensationContext = mock(CompensationContext.class);
when(cmd.getCompensationContext()).thenReturn(compensationContext);
when(cmd.getContext()).thenReturn(new CommandContext(new EngineContext()));
}
use of org.ovirt.engine.core.bll.context.CompensationContext in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommand method updateLunsInDb.
private void updateLunsInDb(List<LUNs> lunsToUpdateInDb) {
TransactionSupport.executeInNewTransaction(() -> {
CompensationContext context = getCompensationContext();
context.snapshotEntities(getParameters().getLunsList());
lunDao.updateAllInBatch(lunsToUpdateInDb);
context.stateChanged();
return null;
});
log.debug("LUNs with IDs: [" + lunsToUpdateInDb.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")) + "] were updated in the DB.");
}
use of org.ovirt.engine.core.bll.context.CompensationContext in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommand method updateStorageDomain.
protected void updateStorageDomain(final StorageDomain storageDomainToUpdate) {
executeInNewTransaction(() -> {
CompensationContext context = getCompensationContext();
context.snapshotEntity(getStorageDomain().getStorageDynamicData());
storageDomainDynamicDao.update(storageDomainToUpdate.getStorageDynamicData());
getCompensationContext().stateChanged();
return null;
});
}
Aggregations