private void setRngAvailability() { TModel model = getModel(); Set<VmRngDevice.Source> requiredRngSources = model.getSelectedCluster().getRequiredRngSources(); boolean requiredRngSourcesEmpty = requiredRngSources.isEmpty(); boolean randomSourceAvailable = requiredRngSources.contains(VmRngDevice.Source.RANDOM); boolean hwrngSourceAvailable = requiredRngSources.contains(VmRngDevice.Source.HWRNG); model.getIsRngEnabled().setIsChangable(!requiredRngSourcesEmpty); model.getRngPeriod().setIsChangable(!requiredRngSourcesEmpty); model.getRngBytes().setIsChangable(!requiredRngSourcesEmpty); if (requiredRngSourcesEmpty) { model.getIsRngEnabled().setMessage(constants.rngNotSupportedByCluster()); model.getRngPeriod().setMessage(constants.rngNotSupportedByCluster()); model.getRngBytes().setMessage(constants.rngNotSupportedByCluster()); } model.getRngSourceRandom().setIsChangable(randomSourceAvailable); if (!randomSourceAvailable) { model .getRngSourceRandom() .setChangeProhibitionReason( messages.rngSourceNotSupportedByCluster(VmRngDevice.Source.RANDOM.toString())); } model.getRngSourceHwrng().setIsChangable(hwrngSourceAvailable); if (!hwrngSourceAvailable) { model .getRngSourceHwrng() .setChangeProhibitionReason( messages.rngSourceNotSupportedByCluster(VmRngDevice.Source.HWRNG.toString())); } }
public void dataCenterWithClusterSelectedItemChanged() { DataCenterWithCluster dataCenterWithCluster = getModel().getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster == null) { return; } StoragePool dataCenter = dataCenterWithCluster.getDataCenter(); if (dataCenter == null) { return; } if (dataCenter.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED) { getModel().getQuota().setIsAvailable(true); } else { getModel().getQuota().setIsAvailable(false); } getModel().getIsRngEnabled().setIsChangable(isRngDeviceSupported(getModel())); getModel().getIsRngEnabled().setMessage(constants.rngNotSupportedByCluster()); setRngAvailability(); postDataCenterWithClusterSelectedItemChanged(); }