use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class VmDeviceCommonUtils method addCdDevice.
public static void addCdDevice(VmBase vmBase) {
VmDevice vmDevice = new VmDevice();
vmDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId()));
vmDevice.setType(VmDeviceGeneralType.DISK);
vmDevice.setDevice(VmDeviceType.CDROM.getName());
vmDevice.setManaged(true);
vmDevice.setPlugged(true);
vmDevice.setReadOnly(true);
vmDevice.setAddress("");
vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice);
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method setUpDiskVmElementExpectations.
private void setUpDiskVmElementExpectations() throws Exception {
DiskVmElement dve = new DiskVmElement(DISK_ID, VM_ID);
dve.setDiskInterface(DiskInterface.VirtIO);
dve.setBoot(false);
setUpGetEntityExpectations(QueryType.GetDiskVmElementById, VmDeviceIdQueryParameters.class, new String[] { "Id" }, new Object[] { new VmDeviceId(DISK_ID, VM_ID) }, dve);
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class ExportOvaCommand method buildCreateOvaParameters.
private CreateOvaParameters buildCreateOvaParameters() {
CreateOvaParameters parameters = new CreateOvaParameters();
parameters.setVm(vmDao.get(getParameters().getEntityId()));
getParameters().getDiskInfoDestinationMap().forEach((source, destination) -> {
// same as the disk<->vm element for the original disk
destination.setDiskVmElements(Collections.singleton(diskVmElementDao.get(new VmDeviceId(source.getId(), getParameters().getEntityId()))));
});
parameters.setDiskInfoDestinationMap(getParameters().getDiskInfoDestinationMap());
parameters.setProxyHostId(getParameters().getProxyHostId());
parameters.setDirectory(getParameters().getDirectory());
parameters.setName(getParameters().getName());
return parameters;
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class ImportUtils method getCompatibleGraphics.
private GraphicsDevice getCompatibleGraphics(VmDeviceType videoDeviceType, Version clusterVersion, VmBase vmBase) {
GraphicsDevice graphicsDevice = null;
GraphicsType compatibleType = null;
for (Pair<GraphicsType, DisplayType> graphicsDisplayPair : osRepository.getGraphicsAndDisplays(vmBase.getOsId(), clusterVersion)) {
if (graphicsDisplayPair.getSecond().getDefaultVmDeviceType() == videoDeviceType) {
compatibleType = graphicsDisplayPair.getFirst();
// previously to spice+vnc, QXL was only used by spice, so prefer spice if available
if (videoDeviceType == VmDeviceType.QXL && compatibleType == GraphicsType.SPICE) {
break;
}
}
}
if (compatibleType != null) {
graphicsDevice = new GraphicsDevice(compatibleType.getCorrespondingDeviceType());
graphicsDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId()));
}
return graphicsDevice;
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class VmHandler method updateDisksVmDataForVm.
public void updateDisksVmDataForVm(VM vm) {
for (Disk disk : vm.getDiskMap().values()) {
DiskVmElement dve = diskVmElementDao.get(new VmDeviceId(disk.getId(), vm.getId()));
disk.setDiskVmElements(Collections.singletonList(dve));
}
}
Aggregations