Пример #1
0
  @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();
  }
Пример #2
0
  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));
    }
  }