Vitor de Lima has uploaded a new change for review. Change subject: webadmin: Show only supported displays ......................................................................
webadmin: Show only supported displays This change uses the information from osinfo to avoid the selection of SPICE on operating systems that do not support it. This is also used to disable the SPICE protocol on POWER hosts, because the operating systems are architecture specific. Change-Id: I5c91524181a7fa1fc2961c85df9bb78f553aa1ef Signed-off-by: Vitor de Lima <vitor.l...@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(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/17885/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 d1b2769..8bfe6bc 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 @@ -159,6 +159,8 @@ // cached windows OS private static List<Integer> windowsOsIds; + private static HashMap<Version, HashMap<Integer, Boolean>> versionOsIdSpiceMap; + public static String getDefaultConfigurationVersion() { return _defaultConfigurationVersion; } @@ -195,6 +197,7 @@ initUniqueOsNames(); initLinuxOsTypes(); initWindowsOsTypes(); + initOsIdSpiceMap(); } public static void getDomainListViaPublic(AsyncQuery aQuery, boolean filterInternalDomain) { @@ -3064,6 +3067,20 @@ }); } + public static void initOsIdSpiceMap() { + AsyncQuery callback = new AsyncQuery(); + callback.asyncCallback = new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object returnValue) { + versionOsIdSpiceMap = + (HashMap<Version, HashMap<Integer, Boolean>>) ((VdcQueryReturnValue) returnValue).getReturnValue(); + } + }; + Frontend.RunQuery(VdcQueryType.OsRepository, + new OsQueryParameters(OsRepositoryVerb.GetSpiceSupportMap), + callback); + } + public static String getOsName(Integer osId) { // can be null as a consequence of setItems on ListModel if (osId == null) { @@ -3073,6 +3090,12 @@ return osNames.get(osId); } + public static boolean hasSpiceSupportCached(int osId, Version version) { + HashMap<Integer, Boolean> osIdSpiceMap = versionOsIdSpiceMap.get(version); + + return osIdSpiceMap.get(osId); + } + public static void hasSpiceSupport(int osId, Version version, AsyncQuery callback) { Frontend.RunQuery(VdcQueryType.OsRepository, new OsQueryParameters(OsRepositoryVerb.HasSpiceSupport, osId, version), 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 328acb2..ff6dc8d 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 @@ -1392,6 +1392,7 @@ else if (sender == getOSType()) { oSType_SelectedItemChanged(sender, args); + updateDisplayProtocol(); initUsbPolicy(); } else if (sender == getFirstBootDevice()) @@ -1632,20 +1633,34 @@ private void initDisplayProtocol() { ArrayList<EntityModel> displayProtocolOptions = new ArrayList<EntityModel>(); + getDisplayProtocol().setItems(displayProtocolOptions); + getDisplayProtocol().getSelectedItemChangedEvent().addListener(this); + } - EntityModel spiceProtocol = new EntityModel(); - spiceProtocol.setTitle(ConstantsManager.getInstance().getConstants().spiceTitle()); - spiceProtocol.setEntity(DisplayType.qxl); + private void updateDisplayProtocol() + { + VDSGroup cluster = getSelectedCluster(); + Integer osType = (Integer) getOSType().getSelectedItem(); + + if (cluster == null || osType == null) { + return; + } + + ArrayList<EntityModel> displayProtocolOptions = new ArrayList<EntityModel>(); EntityModel vncProtocol = new EntityModel(); vncProtocol.setTitle(ConstantsManager.getInstance().getConstants().VNCTitle()); vncProtocol.setEntity(DisplayType.vnc); - - displayProtocolOptions.add(spiceProtocol); displayProtocolOptions.add(vncProtocol); - getDisplayProtocol().setItems(displayProtocolOptions); - getDisplayProtocol().getSelectedItemChangedEvent().addListener(this); + if (AsyncDataProvider.hasSpiceSupportCached(osType, cluster.getcompatibility_version())) { + EntityModel spiceProtocol = new EntityModel(); + spiceProtocol.setTitle(ConstantsManager.getInstance().getConstants().spiceTitle()); + spiceProtocol.setEntity(DisplayType.qxl); + displayProtocolOptions.add(spiceProtocol); + } + + getDisplayProtocol().setItems(displayProtocolOptions); } private void initFirstBootDevice() -- To view, visit http://gerrit.ovirt.org/17885 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c91524181a7fa1fc2961c85df9bb78f553aa1ef Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vitor de Lima <vitor.l...@eldorado.org.br> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches