use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class VmDeviceUtils method addImportedDiskDevices.
/**
* Add disk devices to an imported VM or template.
*
* @param vmDevicesToUpdate list of devices to be updated in the DB
*/
private void addImportedDiskDevices(VmBase vmBase, List<VmDevice> vmDevicesToUpdate) {
final Guid vmId = vmBase.getId();
for (BaseDisk disk : getDisks(vmBase.getImages())) {
Guid deviceId = disk.getId();
VmDevice vmDevice = addDiskDevice(vmId, deviceId, getVmDeviceAddress(vmBase, vmId));
updateImportedVmDevice(vmBase, vmDevice, deviceId, vmDevicesToUpdate);
}
}
use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class StepDaoTest method diskStepProgress.
@Test
public void diskStepProgress() {
Guid entityId = FixturesTool.FLOATING_DISK_ID;
prepareProgressTest(entityId);
updateStepProgress(FixturesTool.STEP_ID, 10);
updateStepProgress(FixturesTool.STEP_ID_2, 80);
BaseDisk diskImage = getDiskDao().get(entityId);
assertProgress(43, diskImage);
}
use of org.ovirt.engine.core.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class StorageDomainDaoTest method testRemove.
/**
* 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 testRemove() {
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.remove(existingDomain.getId());
assertNull(dao.get(FixturesTool.STORAGE_DOMAIN_SCALE_SD5));
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 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.common.businessentities.storage.BaseDisk in project ovirt-engine by oVirt.
the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForDisk.
@Test
public void testGetEntityNameByIdAndTypeForDisk() {
BaseDisk disk = baseDiskDao.get(DISK_ID);
assertNotNull(disk);
String name = disk.getDiskAlias();
assertEquals(name, underTest.getEntityNameByIdAndType(DISK_ID, VdcObjectType.Disk));
}
Aggregations