Hello Gustavo Frederico Temple Pedrosa, Leonardo Bianconi, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/29864 to review the following change. Change subject: core: Enable balloon by default - Patch 2 of 2 ...................................................................... core: Enable balloon by default - Patch 2 of 2 The "New VM"/"New Pool" dialogs in the frontend were changed to enable the balloon device in guest OSes where the "balloon.enabled" osinfo property is enabled. This way the system administrator will have an usable VM by default even in problematic guest OSes. Change-Id: I7803e45f07539090e5527ebc81bbc6c31df4e120 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1069858 Signed-off-by: Gustavo Pedrosa <gustavo.pedr...@eldorado.org.br> Signed-off-by: Leonardo Bianconi <leonardo.bianc...@eldorado.org.br> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java 2 files changed, 45 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/64/29864/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java index 0d73936..902fe62 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java @@ -198,6 +198,9 @@ // cached disk hotpluggable interfaces map private static Map<Pair<Integer, Version>, Set<String>> diskHotpluggableInterfacesMap; + // cached os's balloon enabled by default map (given compatibility version) + private static Map<Integer, Map<Version, Boolean>> balloonSupportMap; + // cached windows OS private static List<Integer> windowsOsIds; // cached OS Architecture @@ -257,6 +260,7 @@ initLinuxOsTypes(); initWindowsOsTypes(); initDisplayTypes(); + initBalloonSupportMap(); initNicHotplugSupportMap(); initDiskHotpluggableInterfacesMap(); initOsArchitecture(); @@ -417,6 +421,23 @@ return false; } + public static Boolean isBalloonEnabled(int osId, Version version) { + return balloonSupportMap.get(osId).get(version); + } + + public static void initBalloonSupportMap() { + AsyncQuery callback = new AsyncQuery(); + callback.asyncCallback = new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object returnValue) { + balloonSupportMap = (Map<Integer, Map<Version, Boolean>>) ((VdcQueryReturnValue) returnValue) + .getReturnValue(); + } + }; + Frontend.getInstance().runQuery(VdcQueryType.OsRepository, new OsQueryParameters( + OsRepositoryVerb.GetBalloonSupportMap), callback); + } + public static void initDiskHotpluggableInterfacesMap() { AsyncQuery callback = new AsyncQuery(); callback.asyncCallback = new INewAsyncCallback() { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java index f4b279a..21b6b81 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java @@ -1727,6 +1727,7 @@ { dataCenterWithClusterSelectedItemChanged(sender, args); updateDisplayProtocol(); + updateMemoryBalloonDevice(); initUsbPolicy(); } else if (sender == getTemplate()) @@ -1748,6 +1749,7 @@ getBehavior().oSType_SelectedItemChanged(); getVmInitModel().osTypeChanged(getOSType().getSelectedItem()); updateDisplayProtocol(); + updateMemoryBalloonDevice(); initUsbPolicy(); getBehavior().activateInstanceTypeManager(); @@ -2042,6 +2044,28 @@ } } + private void updateMemoryBalloonDevice() { + + VDSGroup cluster = getSelectedCluster(); + Integer osType = getOSType().getSelectedItem(); + + if (cluster == null || osType == null) { + return; + } + + boolean isBalloonEnabled = AsyncDataProvider.isBalloonEnabled(osType, + cluster.getcompatibility_version()); + + getMemoryBalloonDeviceEnabled().setIsChangable(isBalloonEnabled); + + getMemoryBalloonDeviceEnabled().setEntity(isBalloonEnabled); + if (!isBalloonEnabled) { + getBehavior().deactivateInstanceTypeManager(); + getMemoryBalloonDeviceEnabled().setEntity(isBalloonEnabled); + getBehavior().activateInstanceTypeManager(); + } + } + private void initFirstBootDevice() { EntityModel tempVar = new EntityModel(); -- To view, visit http://gerrit.ovirt.org/29864 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7803e45f07539090e5527ebc81bbc6c31df4e120 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com> Gerrit-Reviewer: Gustavo Frederico Temple Pedrosa <gustavo.pedr...@eldorado.org.br> Gerrit-Reviewer: Leonardo Bianconi <leonardo.bianc...@eldorado.org.br> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches