use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class DiskValidatorTest method testIsUsingScsiReservationValidWhenSgioIsUnFiltered.
@Test
public void testIsUsingScsiReservationValidWhenSgioIsUnFiltered() {
setupForLun();
LunDisk lunDisk1 = createLunDisk(ScsiGenericIO.UNFILTERED);
assertThat(lunValidator.isUsingScsiReservationValid(createVM(), createDiskVmElementUsingScsiReserevation(), lunDisk1), isValid());
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class DiskValidatorTest method createLunDisk.
private static LunDisk createLunDisk() {
LunDisk disk = new LunDisk();
LUNs lun = new LUNs();
lun.setLUNId("lun_id");
lun.setLunType(StorageType.ISCSI);
disk.setLun(lun);
return disk;
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class DiskValidatorTest method testIsUsingScsiReservationValidWhenSgioIsFiltered.
@Test
public void testIsUsingScsiReservationValidWhenSgioIsFiltered() {
setupForLun();
LunDisk lunDisk1 = createLunDisk(ScsiGenericIO.FILTERED);
assertThat(lunValidator.isUsingScsiReservationValid(createVM(), createDiskVmElementUsingScsiReserevation(), lunDisk1), failsWith(EngineMessage.ACTION_TYPE_FAILED_SGIO_IS_FILTERED));
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class OvfHelper method buildMetadataDictionaryForVm.
/**
* Adds the given vm metadata to the given map
*/
private String buildMetadataDictionaryForVm(VM vm) {
List<DiskImage> allVmImages = new ArrayList<>();
List<DiskImage> filteredDisks = DisksFilter.filterImageDisks(vm.getDiskList(), ONLY_SNAPABLE, ONLY_ACTIVE);
List<LunDisk> lunDisks = DisksFilter.filterLunDisks(vm.getDiskMap().values());
List<AffinityGroup> affinityGroups = affinityGroupDao.getAllAffinityGroupsByVmId(vm.getId());
Set<DbUser> dbUsers = new HashSet<>(dbUserDao.getAllForVm(vm.getId()));
List<Label> affinityLabels = labelDao.getAllByEntityIds(Collections.singletonList(vm.getId()));
for (DiskImage diskImage : filteredDisks) {
List<DiskImage> images = diskImageDao.getAllSnapshotsForLeaf(diskImage.getImageId());
images.forEach(d -> d.setDiskVmElements(Collections.singletonList(diskImage.getDiskVmElementForVm(vm.getId()))));
allVmImages.addAll(images);
}
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm);
fullEntityOvfData.setDiskImages(allVmImages);
fullEntityOvfData.setLunDisks(lunDisks);
fullEntityOvfData.setAffinityGroups(affinityGroups);
fullEntityOvfData.setAffinityLabels(affinityLabels);
fullEntityOvfData.setDbUsers(dbUsers);
populateUserToRoles(fullEntityOvfData, vm.getId());
return ovfManager.exportVm(vm, fullEntityOvfData, clusterUtils.getCompatibilityVersion(vm));
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class VmInfoBuildUtilsTest method mockUnsortedDisksMap.
private Map<Guid, Disk> mockUnsortedDisksMap(VmDevice lunDiskVmDevice, VmDevice diskImageVmDevice) {
when(vmDeviceDao.get(lunDiskVmDevice.getId())).thenReturn(lunDiskVmDevice);
when(vmDeviceDao.get(diskImageVmDevice.getId())).thenReturn(diskImageVmDevice);
DiskVmElement nonBootDiskVmElement = new DiskVmElement(lunDiskVmDevice.getId());
nonBootDiskVmElement.setBoot(false);
nonBootDiskVmElement.setDiskInterface(DiskInterface.VirtIO_SCSI);
DiskVmElement bootDiskVmElement = new DiskVmElement(diskImageVmDevice.getId());
bootDiskVmElement.setBoot(true);
bootDiskVmElement.setDiskInterface(DiskInterface.VirtIO_SCSI);
LunDisk lunDisk = new LunDisk();
lunDisk.setId(LUN_DISK_ID);
lunDisk.setDiskVmElements(Collections.singleton(nonBootDiskVmElement));
DiskImage diskImage = new DiskImage();
diskImage.setId(DISK_IMAGE_ID);
diskImage.setDiskVmElements(Collections.singleton(bootDiskVmElement));
Map<Guid, Disk> map = new HashMap<>();
map.put(lunDisk.getId(), lunDisk);
map.put(diskImage.getId(), diskImage);
return map;
}
Aggregations