Shahar Havivi has uploaded a new change for review. Change subject: engine: add support for ram/vram on QXL device ......................................................................
engine: add support for ram/vram on QXL device setting support for qxl device with proper ram/vram attributes: 1 Monitor, Single PCI checked 64MB 32MB 2 Monitors, Single PCI checked 132MB 32MB 4 Monitors, Single PCI checked 256MB 32MB Change-Id: I0d380901daea93c3d6dbdfee48addf190e15ed5a Bug-Url: https://bugzilla.redhat.com/787578 Signed-off-by: Shahar Havivi <shah...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java 3 files changed, 23 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/60/19360/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java index 0507ee1..5095b64 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java @@ -42,6 +42,7 @@ public class VmDeviceUtils { private static VmDeviceDAO dao = DbFacade.getInstance().getVmDeviceDao(); + private final static String RAM = "ram"; private final static String VRAM = "vram"; private final static String HEADS = "heads"; private final static String EHCI_MODEL = "ich9-ehci"; @@ -797,16 +798,12 @@ */ private static Map<String, Object> getMemExpr(int numOfMonitors, boolean singleQxlPci) { int heads = singleQxlPci ? numOfMonitors : 1; - String mem; - if (singleQxlPci) { - mem = String.valueOf(VmDeviceCommonUtils.LOW_VIDEO_MEM * heads); - } else { - mem = (numOfMonitors < 2 ? String.valueOf(VmDeviceCommonUtils.LOW_VIDEO_MEM) : - String.valueOf(VmDeviceCommonUtils.HIGH_VIDEO_MEM)); - } Map<String, Object> specParams = new HashMap<String, Object>(); - specParams.put(VRAM, mem); - specParams.put(HEADS, String.valueOf(heads)); + if (singleQxlPci) { + specParams.put(RAM, VmDeviceCommonUtils.singlePciRamByHeads(heads)); + specParams.put(VRAM, VmDeviceCommonUtils.singlePciVRamByHeads(heads)); + specParams.put(HEADS, String.valueOf(heads)); + } return specParams; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java index c766b9f..133ec59 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java @@ -24,6 +24,15 @@ public final static String CDROM_IMAGE_ID = "11111111-1111-1111-1111-111111111111"; + public static String singlePciRamByHeads(int heads) { + return String.valueOf(HIGH_VIDEO_MEM * heads); + } + + public static String singlePciVRamByHeads(int heads) { + // for now we return the low memory for vram + return String.valueOf(LOW_VIDEO_MEM); + } + public static boolean isNetwork(VmDevice device) { return device.getType() == VmDeviceGeneralType.INTERFACE; } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java index d67fe6e..6ed8e9f 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java @@ -66,7 +66,7 @@ // the requested display type might be different than the default display of // the VM in Run Once scenario, in that case we need to add proper video device. if (vm.getDisplayType() != vm.getDefaultDisplayType()) { - addVideoCardByDisplayType(vm.getDisplayType(), vm.getNumOfMonitors()); + addVideoCardByDisplayType(vm.getDisplayType(), vm.getNumOfMonitors(), vm.getSingleQxlPci()); } else { addVideoCardsDefinedForVmInDB(vm.getId()); @@ -76,12 +76,12 @@ /** * Add video device according to the given display type */ - private void addVideoCardByDisplayType(DisplayType displayType, int numOfMonitors) { + private void addVideoCardByDisplayType(DisplayType displayType, int numOfMonitors, boolean singleQxlPci) { Map<String, Object> struct = new HashMap<String, Object>(); // create a monitor as an unmanaged device struct.put(VdsProperties.Type, VmDeviceGeneralType.VIDEO.getValue()); struct.put(VdsProperties.Device, displayType.getVmDeviceType().getName()); - struct.put(VdsProperties.SpecParams, getNewMonitorSpecParams(displayType, numOfMonitors)); + struct.put(VdsProperties.SpecParams, getNewMonitorSpecParams(displayType, numOfMonitors, singleQxlPci)); struct.put(VdsProperties.DeviceId, String.valueOf(Guid.newGuid())); devices.add(struct); } @@ -685,11 +685,13 @@ } } - private static HashMap<String, Object> getNewMonitorSpecParams(DisplayType displayType, int numOfMonitors) { + private static HashMap<String, Object> getNewMonitorSpecParams(DisplayType displayType, int numOfMonitors, boolean singleQxlPci) { HashMap<String, Object> specParams = new HashMap<String, Object>(); - specParams.put("vram", String.valueOf(VmDeviceCommonUtils.HIGH_VIDEO_MEM)); - if (displayType == DisplayType.qxl) { + specParams.put("vram", String.valueOf(VmDeviceCommonUtils.LOW_VIDEO_MEM)); + if (displayType == DisplayType.qxl && singleQxlPci) { specParams.put("heads", numOfMonitors); + specParams.put("ram", VmDeviceCommonUtils.singlePciRamByHeads(numOfMonitors)); + specParams.put("vram", VmDeviceCommonUtils.singlePciVRamByHeads(numOfMonitors)); } return specParams; } -- To view, visit http://gerrit.ovirt.org/19360 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0d380901daea93c3d6dbdfee48addf190e15ed5a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <shav...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches