use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class DiskValidatorTest method prepareForCheckingIfDiskPluggedToVmsThatAreNotDown.
public List<Pair<VM, VmDevice>> prepareForCheckingIfDiskPluggedToVmsThatAreNotDown() {
VM vm1 = createVM();
VM vm2 = createVM();
VmDevice device1 = createVmDeviceForDisk(vm1, disk);
VmDevice device2 = createVmDeviceForDisk(vm1, disk);
List<Pair<VM, VmDevice>> vmsInfo = new LinkedList<>();
vmsInfo.add(new Pair<>(vm1, device1));
vmsInfo.add(new Pair<>(vm2, device2));
return vmsInfo;
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class OvfManagerTest method testVmOvfCreationDefaultGraphicsDeviceFallbackToSupported.
@Test
public void testVmOvfCreationDefaultGraphicsDeviceFallbackToSupported() throws Exception {
VM vm = createVM();
vm.setDefaultDisplayType(DisplayType.cirrus);
vm.setVmOs(EXISTING_OS_ID);
String xml = manager.exportVm(vm, new FullEntityOvfData(vm), Version.getLast());
assertNotNull(xml);
final VM newVm = new VM();
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(newVm);
manager.importVm(xml, newVm, fullEntityOvfData);
int graphicsDeviceCount = 0;
for (VmDevice device : newVm.getManagedVmDeviceMap().values()) {
if (device.getType() == VmDeviceGeneralType.GRAPHICS) {
graphicsDeviceCount++;
assertEquals(device.getDevice(), VmDeviceType.SPICE.getName());
}
}
assertEquals(1, graphicsDeviceCount);
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class VmDevicesMonitoringTest method testIgnoreOutdatedUpdateDevice.
@Test
public void testIgnoreOutdatedUpdateDevice() {
initDevices();
initDumpXmls();
vmDevicesMonitoring.initDevicesStatuses(1L);
VmDevicesMonitoring.Change change = vmDevicesMonitoring.createChange(3L);
VmDevice device = getVmDevice(CDROM_DEVICE_ID, VM_ID, VmDeviceGeneralType.DISK, "cdrom", true);
change.updateDevice(device);
change.flush();
initDevices(device);
change = vmDevicesMonitoring.createChange(2L);
change.updateDevice(device);
change.flush();
verify(resourceManager, never()).runVdsCommand(eq(VDSCommandType.DumpXmls), any());
verify(vmDeviceDao, never()).updateAllInBatch(any());
verify(vmDeviceDao, never()).removeAll(any());
verify(vmDeviceDao, times(1)).saveAll(any());
verify(vmDynamicDao, never()).updateDevicesHashes(any());
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class VmInfoBuildUtilsTest method setUp.
@Before
public void setUp() {
injectorRule.bind(AuditLogDirector.class, auditLogDirector);
diskImage.setDiskProfileId(Guid.newGuid());
qos = new StorageQos();
qos.setId(Guid.newGuid());
vmDevice = new VmDevice();
VnicProfile vnicProfile = new VnicProfile();
vnicProfile.setNetworkFilterId(NETWORK_FILTER_ID);
when(vnicProfileDao.get(VNIC_PROFILE_ID)).thenReturn(vnicProfile);
NetworkFilter networkFilter = new NetworkFilter();
networkFilter.setName(NETWORK_FILTER_NAME);
when(networkFilterDao.getNetworkFilterById(NETWORK_FILTER_ID)).thenReturn(networkFilter);
when(vmNicFilterParameterDao.getAllForVmNic(VM_NIC_ID)).thenReturn(createVmNicFilterParameters());
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class VmInfoBuilderImpl method buildCloudInitVmPayload.
@Override
public void buildCloudInitVmPayload(Map<String, byte[]> cloudInitContent) {
VmDevice vmDevice = vmInfoBuildUtils.createCloudInitPayloadDevice(cloudInitContent, vm);
Map<String, Object> struct = vmInfoBuildUtils.buildCdDetails(vmDevice, vm);
addDevice(struct, vmDevice, "");
}
Aggregations