use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class StepDaoTest method diskNullStepProgress.
@Test
public void diskNullStepProgress() {
Guid entityId = FixturesTool.FLOATING_DISK_ID;
prepareProgressTest(entityId);
updateStepProgress(FixturesTool.STEP_ID, null);
updateStepProgress(FixturesTool.STEP_ID_2, null);
BaseDisk diskImage = getDiskDao().get(entityId);
assertProgress(0, diskImage);
}
use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class StepDaoTest method diskNullFinishedStepProgress.
@Test
public void diskNullFinishedStepProgress() {
Guid entityId = FixturesTool.FLOATING_DISK_ID;
prepareProgressTest(entityId);
List<Guid> stepIds = Arrays.asList(FixturesTool.STEP_ID, FixturesTool.STEP_ID_2);
stepIds.forEach(x -> {
Step s = dao.get(x);
s.setProgress(null);
s.setStatus(JobExecutionStatus.FINISHED);
dao.update(s);
});
BaseDisk diskImage = getDiskDao().get(entityId);
assertProgress(80, diskImage);
}
use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class StepDaoTest method prepareProgressTest.
private void prepareProgressTest(Guid entityId) {
VdcObjectType type = VdcObjectType.Disk;
BaseDisk diskImage = getDiskDao().get(entityId);
assertProgress(null, diskImage);
getStepSubjectEntityDao().saveAll(Arrays.asList(new StepSubjectEntity(FixturesTool.STEP_ID, type, entityId, 30), new StepSubjectEntity(FixturesTool.STEP_ID_2, type, entityId, 50)));
}
use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class StorageDomainDaoTest method testRemoveEntitesFromStorageDomain.
/**
* Asserts that the existing Storage Domain exists and has VMs and VM Templates, the after remove asserts
* that the existing domain is removed along with the VM and VM Templates
*/
@Test
public void testRemoveEntitesFromStorageDomain() {
List<VM> vms = getDbFacade().getVmDao().getAllForStorageDomain(FixturesTool.STORAGE_DOMAIN_SCALE_SD5);
List<VmTemplate> templates = getDbFacade().getVmTemplateDao().getAllForStorageDomain(FixturesTool.STORAGE_DOMAIN_SCALE_SD5);
BaseDisk diskImage = getDbFacade().getBaseDiskDao().get(FixturesTool.DISK_ID);
assertNotNull(diskImage);
assertFalse(vms.isEmpty());
assertFalse(templates.isEmpty());
assertNotNull(dao.get(FixturesTool.STORAGE_DOMAIN_SCALE_SD5));
dao.removeEntitesFromStorageDomain(existingDomain.getId());
for (VM vm : vms) {
assertNull(getDbFacade().getVmDao().get(vm.getId()));
}
for (VmTemplate template : templates) {
assertNull(getDbFacade().getVmTemplateDao().get(template.getId()));
}
assertNull(getDbFacade().getBaseDiskDao().get(FixturesTool.DISK_ID));
}
use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class SnapshotModel method onSave.
public void onSave() {
if (getProgress() != null || !validate()) {
return;
}
startProgress();
VM vm = getVm();
ArrayList<ActionParametersBase> params = new ArrayList<>();
Set<Guid> snapshotDisksIds = null;
if (getSnapshotDisks().getSelectedItems() != null) {
snapshotDisksIds = getSnapshotDisks().getSelectedItems().stream().map(BaseDisk::getId).collect(Collectors.toSet());
}
CreateSnapshotForVmParameters param = new CreateSnapshotForVmParameters(vm.getId(), getDescription().getEntity(), getMemory().getEntity(), snapshotDisksIds);
param.setQuotaId(vm.getQuotaId());
params.add(param);
Frontend.getInstance().runMultipleAction(ActionType.CreateSnapshotForVm, params, result -> {
SnapshotModel localModel = (SnapshotModel) result.getState();
localModel.stopProgress();
getCancelCommand().execute();
}, this);
}
Aggregations