use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class UpdateVmDiskCommandTest method mockToUpdateDiskVm.
private void mockToUpdateDiskVm(VM vm) {
when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm);
when(diskVmElementDao.get(new VmDeviceId(command.getParameters().getDiskInfo().getId(), vm.getId()))).thenReturn(new DiskVmElement());
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class DiskVmElementDaoTest method testVmElementDiskUnpluggedStatus.
@Test
public void testVmElementDiskUnpluggedStatus() {
DiskVmElement dveUnplugged = dao.get(new VmDeviceId(UNPLUGGED_DISK_ID, FixturesTool.VM_RHEL5_POOL_57));
assertFalse(dveUnplugged.isPlugged());
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class DiskVmElementDaoTest method testVmElementDiskPluggedStatus.
@Test
public void testVmElementDiskPluggedStatus() {
DiskVmElement dvePlugged = dao.get(new VmDeviceId(PLUGGED_DISK_ID, FixturesTool.VM_RHEL5_POOL_57));
assertTrue(dvePlugged.isPlugged());
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class DiskVmElementDaoTest method testVmElementDiskLogicalName.
@Test
public void testVmElementDiskLogicalName() {
DiskVmElement dveWithLogicalName = dao.get(new VmDeviceId(PLUGGED_DISK_ID, FixturesTool.VM_RHEL5_POOL_57));
assertEquals("logical_name", dveWithLogicalName.getLogicalName());
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class VmInfoBuildUtils method createGraphicsDevices.
public List<VmDevice> createGraphicsDevices(Map<GraphicsType, GraphicsInfo> graphicsInfos, Map<String, Object> extraSpecParams, Guid vmId) {
final Comparator<GraphicsType> spiceLastComparator = ComparatorUtils.sortLast(GraphicsType.SPICE);
final List<Entry<GraphicsType, GraphicsInfo>> sortedGraphicsInfos = graphicsInfos.entrySet().stream().sorted(Comparator.comparing(Entry::getKey, spiceLastComparator)).collect(Collectors.toList());
List<VmDevice> result = new ArrayList<>();
for (Entry<GraphicsType, GraphicsInfo> graphicsInfo : sortedGraphicsInfos) {
VmDevice device = new VmDevice();
device.setId(new VmDeviceId(Guid.newGuid(), vmId));
device.setType(VmDeviceGeneralType.GRAPHICS);
device.setDevice(graphicsInfo.getKey().name().toLowerCase());
device.setPlugged(true);
device.setAddress("");
if (extraSpecParams != null) {
device.setSpecParams(extraSpecParams);
}
result.add(device);
}
return result;
}
Aggregations