Roy Golan has uploaded a new change for review. Change subject: core: fix updating a Vm console type will update video devices ......................................................................
core: fix updating a Vm console type will update video devices if the console type has changed or the number of monitors, the video devices should be updated as well. Change-Id: I8c859b262b95bed476add0b8177dc89f3d25e063 Signed-off-by: Roy Golan <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java 1 file changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/7450/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 17cd32a..480f4dc 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 @@ -56,8 +56,25 @@ .getdefault_boot_sequence()) { updateBootOrderInVmDevice(entity); } - if (oldVmBase.getnum_of_monitors() != entity + + // if the console type has changed, recreate Video devices + if (oldVmBase.getdefault_display_type() != entity.getdefault_display_type()) { + // delete all video device + for (VmDevice device : dao.getVmDeviceByVmIdAndType(oldVmBase.getId(), VmDeviceType.VIDEO.getName())) { + dao.remove(device.getId()); + } + // add video device per each monitor + for (int i = 0; i<entity.getnum_of_monitors();i++) { + addManagedDevice(new VmDeviceId(Guid.NewGuid(), entity.getId()), + VmDeviceType.VIDEO, + entity.getdefault_display_type().getVmDeviceType(), + getMemExpr(entity.getnum_of_monitors()), + true, + false); + } + } else if (entity.getdefault_display_type() == DisplayType.qxl && oldVmBase.getnum_of_monitors() != entity .getnum_of_monitors()) { + // spice number of monitors has changed updateNumOfMonitorsInVmDevice(oldVmBase, entity); } updateUSBSlots(oldVmBase, entity); -- To view, visit http://gerrit.ovirt.org/7450 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8c859b262b95bed476add0b8177dc89f3d25e063 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
