protected NetworkClusterModel createNetworkClusterModel(VDSGroup cluster) { NetworkClusterModel networkClusterModel = new NetworkClusterModel(cluster); networkClusterModel.setAttached(true); networkClusterModel.setRequired(!(Boolean) getExport().getEntity()); return networkClusterModel; }
@Override protected void onExportChanged() { boolean externalNetwork = getExport().getEntity(); getExternalProviders().setIsChangeable(externalNetwork); getIsVmNetwork() .setIsChangeable( !externalNetwork && isSupportBridgesReportByVDSM() && ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)); if (externalNetwork) { getIsVmNetwork().setEntity(true); } Iterable<NetworkClusterModel> networkClusters = getNetworkClusterList().getItems(); if (networkClusters != null) { for (NetworkClusterModel networkCluster : networkClusters) { if (!(Boolean) AsyncDataProvider.getInstance() .getConfigValuePreConverted( ConfigurationValues.SupportCustomDeviceProperties, networkCluster.getEntity().getCompatibilityVersion().getValue())) { networkCluster.setIsChangeable(!externalNetwork); networkCluster.setAttached(!externalNetwork); } networkCluster.setRequired(!externalNetwork); } } super.onExportChanged(); }
public ArrayList<NetworkClusterModel> getClustersToAttach() { ArrayList<NetworkClusterModel> clusterToAttach = new ArrayList<>(); for (NetworkClusterModel networkClusterModel : getNetworkClusterList().getItems()) { if (networkClusterModel.isAttached()) { clusterToAttach.add(networkClusterModel); } } return clusterToAttach; }
private void attachNetworkToClusters(Guid networkGuid) { final Guid networkId = getNetwork().getId() == null ? networkGuid : getNetwork().getId(); final List<NetworkCluster> networkAttachments = new ArrayList<>(); for (NetworkClusterModel networkClusterModel : getClustersToAttach()) { // Init default NetworkCluster values (required, display, status) NetworkCluster networkCluster = new NetworkCluster(); networkCluster.setNetworkId(networkId); networkCluster.setClusterId(networkClusterModel.getEntity().getId()); networkCluster.setRequired(networkClusterModel.isRequired()); networkAttachments.add(networkCluster); } if (!networkAttachments.isEmpty()) { Frontend.getInstance() .runAction( VdcActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments)); } }