コード例 #1
0
  private void updateDatacenters() {
    boolean isInVm = getVm() != null;
    getDataCenter().setIsAvailable(!isInVm);
    setMessage(""); // $NON-NLS-1$

    if (isInVm) {
      AsyncDataProvider.getInstance()
          .getDataCenterById(
              new AsyncQuery(
                  this,
                  new INewAsyncCallback() {
                    @Override
                    public void onSuccess(Object target, Object returnValue) {
                      AbstractDiskModel diskModel = (AbstractDiskModel) target;
                      StoragePool dataCenter = (StoragePool) returnValue;
                      ArrayList<StoragePool> dataCenters = new ArrayList<>();

                      if (isDatacenterAvailable(dataCenter)) {
                        dataCenters.add(dataCenter);
                      }

                      diskModel
                          .getDataCenter()
                          .setItems(dataCenters, Linq.firstOrNull(dataCenters));

                      if (dataCenters.isEmpty()) {
                        diskModel.setMessage(constants.relevantDCnotActive());
                      }
                    }
                  }),
              getVm().getStoragePoolId());
      updateBootableDiskAvailable();
    } else {
      AsyncDataProvider.getInstance()
          .getDataCenterList(
              new AsyncQuery(
                  this,
                  new INewAsyncCallback() {
                    @Override
                    public void onSuccess(Object target, Object returnValue) {
                      AbstractDiskModel diskModel = (AbstractDiskModel) target;
                      ArrayList<StoragePool> dataCenters = (ArrayList<StoragePool>) returnValue;
                      ArrayList<StoragePool> filteredDataCenters = new ArrayList<>();

                      for (StoragePool dataCenter : dataCenters) {
                        if (isDatacenterAvailable(dataCenter)) {
                          filteredDataCenters.add(dataCenter);
                        }
                      }

                      diskModel.getDataCenter().setItems(filteredDataCenters);

                      if (filteredDataCenters.isEmpty()) {
                        diskModel.setMessage(constants.noActiveDataCenters());
                      }
                    }
                  }));
    }
  }
コード例 #2
0
  protected void doLoadAttachableDisks(
      GetDisksCallback imageCallback,
      GetDisksCallback lunCallback,
      GetDisksCallback cinderCallback) {
    AsyncDataProvider.getInstance()
        .getAllAttachableDisks(
            new AsyncQuery(this, imageCallback), getVm().getStoragePoolId(), getVm().getId());

    AsyncDataProvider.getInstance()
        .getAllAttachableDisks(new AsyncQuery(this, lunCallback), null, getVm().getId());

    AsyncDataProvider.getInstance()
        .getAllAttachableDisks(
            new AsyncQuery(this, cinderCallback), getVm().getStoragePoolId(), getVm().getId());
  }
コード例 #3
0
  private void fetchDcClusters(final Guid dcId, final Network network, final boolean publicUse) {
    if (dcClusters.containsKey(dcId)) {
      attachNetworkToClusters(network, dcClusters.get(dcId), publicUse);
    } else {
      AsyncDataProvider.getClusterList(
          new AsyncQuery(
              this,
              new INewAsyncCallback() {

                @Override
                public void onSuccess(Object model, Object returnValue) {
                  Collection<VDSGroup> clusters =
                      Linq.where(
                          (Collection<VDSGroup>) returnValue,
                          new IPredicate<VDSGroup>() {

                            @Override
                            public boolean match(VDSGroup source) {
                              return (Boolean)
                                  AsyncDataProvider.getConfigValuePreConverted(
                                      ConfigurationValues.SupportCustomDeviceProperties,
                                      source.getcompatibility_version().getValue());
                            }
                          });
                  dcClusters.put(dcId, clusters);
                  attachNetworkToClusters(network, clusters, publicUse);
                }
              }),
          dcId);
    }
  }
コード例 #4
0
  private void Edit() {
    if (getWindow() != null) {
      return;
    }

    VmInterfaceModel model = new VmInterfaceModel();
    setWindow(model);
    model.setTitle("Edit Network Interface");

    AsyncDataProvider.GetClusterNetworkList(
        new AsyncQuery(
            this,
            new INewAsyncCallback() {
              @Override
              public void OnSuccess(Object target, Object returnValue) {

                TemplateInterfaceListModel vmInterfaceListModel =
                    (TemplateInterfaceListModel) target;
                java.util.ArrayList<network> network_list =
                    returnValue != null
                        ? (java.util.ArrayList<network>) returnValue
                        : new java.util.ArrayList<network>();
                vmInterfaceListModel.PostGetClusterNetworkList_Edit(network_list);
              }
            }),
        getEntityStronglyTyped().getvds_group_id());
  }
コード例 #5
0
  // Create a list of ActionGroups associated with the user by retrieving each role's ActionGroups
  // (and proceed to Step4).
  // Use only as 'Step3' of 'UpdateIsENGINEUser'
  public void UpdateUserActionGroups(Object targetObject, java.util.ArrayList<Guid> roleIdList) {
    for (Guid roleID : roleIdList) {
      AsyncDataProvider.GetRoleActionGroupsByRoleId(
          new AsyncQuery(
              targetObject,
              new INewAsyncCallback() {
                @Override
                public void OnSuccess(Object target, Object returnValue) {

                  UserPortalLoginModel loginModel = (UserPortalLoginModel) target;
                  java.util.ArrayList<ActionGroup> roleActionGroupList =
                      (java.util.ArrayList<ActionGroup>) returnValue;
                  for (ActionGroup actionGroup : roleActionGroupList) {
                    if (!loginModel.getLoggedUserActionGroupList().contains(actionGroup)) {
                      loginModel.getLoggedUserActionGroupList().add(actionGroup);
                    }
                  }
                  loginModel.setRolesCounter(loginModel.getRolesCounter() - 1);
                  if (loginModel.getRolesCounter() == 0) {
                    CheckIsENGINEUser(loginModel);
                  }
                }
              }),
          roleID);
    }
  }
コード例 #6
0
 public TimeZoneType getTimeZoneType() {
   // can be null as a consequence of setItems on ListModel
   Integer vmOsType = getModel().getOSType().getSelectedItem();
   return AsyncDataProvider.getInstance().isWindowsOsType(vmOsType)
       ? TimeZoneType.WINDOWS_TIMEZONE
       : TimeZoneType.GENERAL_TIMEZONE;
 }
コード例 #7
0
  public void Manage() {
    if (getWindow() != null) {
      return;
    }

    Guid storagePoolId =
        (getEntity().getstorage_pool_id() != null)
            ? getEntity().getstorage_pool_id().getValue()
            : Guid.Empty;

    AsyncQuery _asyncQuery = new AsyncQuery();
    _asyncQuery.setModel(this);
    _asyncQuery.asyncCallback =
        new INewAsyncCallback() {
          public void OnSuccess(Object model, Object result) {
            ClusterNetworkListModel clusterNetworkListModel = (ClusterNetworkListModel) model;
            java.util.ArrayList<network> networkList = (java.util.ArrayList<network>) result;
            ListModel listModel = new ListModel();
            clusterNetworkListModel.setWindow(listModel);
            listModel.setTitle("Assign/Detach Networks");
            listModel.setHashName("assign_networks");
            clusterNetworkListModel.PostManage(networkList, listModel);
          }
        };
    AsyncDataProvider.GetNetworkList(_asyncQuery, storagePoolId);
  }
コード例 #8
0
ファイル: StorageModel.java プロジェクト: nirs/ovirt-engine
  void updateHost() {
    if (getDataCenter().getItems() == null) {
      return;
    }

    if (getCurrentStorageItem() == null) {
      return;
    }

    StoragePool dataCenter = getDataCenter().getSelectedItem();

    boolean localFsOnly = getCurrentStorageItem() instanceof LocalStorageModel;
    Guid dataCenterId = dataCenter == null ? null : dataCenter.getId();

    AsyncDataProvider.getInstance()
        .getHostsForStorageOperation(
            new AsyncQuery(
                this,
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object model, Object returnValue) {
                    StorageModel storageModel = (StorageModel) model;
                    Collection<VDS> hosts = (Collection<VDS>) returnValue;
                    storageModel.postUpdateHost(hosts);
                  }
                }),
            dataCenterId,
            localFsOnly);
  }
コード例 #9
0
ファイル: StorageModel.java プロジェクト: nirs/ovirt-engine
  public StorageModel(StorageModelBehavior behavior) {
    this.behavior = behavior;
    this.behavior.setModel(this);

    setName(new EntityModel<String>());
    setDescription(new EntityModel<String>());
    setComment(new EntityModel<String>());
    setDataCenterAlert(new EntityModel<String>());
    setDataCenter(new ListModel<StoragePool>());
    getDataCenter().getSelectedItemChangedEvent().addListener(this);
    setHost(new ListModel<VDS>());
    getHost().getSelectedItemChangedEvent().addListener(this);
    setFormat(new ListModel<StorageFormatType>());
    setAvailableStorageTypeItems(new ListModel<StorageType>());
    getAvailableStorageTypeItems().getSelectedItemChangedEvent().addListener(this);
    getAvailableStorageTypeItems().getItemsChangedEvent().addListener(this);
    setAvailableStorageDomainTypeItems(new ListModel<StorageDomainType>());
    getAvailableStorageDomainTypeItems().getSelectedItemChangedEvent().addListener(this);
    setWarningLowSpaceIndicator(new EntityModel<Integer>());
    getWarningLowSpaceIndicator().setEntity(getWarningLowSpaceIndicatorValue());
    setWarningLowSpaceSize(new EntityModel<String>());
    getWarningLowSpaceSize().setIsAvailable(false);
    setCriticalSpaceActionBlocker(new EntityModel<Integer>());
    getCriticalSpaceActionBlocker().setEntity(getCriticalSpaceThresholdValue());
    setActivateDomain(new EntityModel<Boolean>(true));
    getActivateDomain().setIsAvailable(false);
    setWipeAfterDelete(new EntityModel<>(false));

    localFSPath =
        (String)
            AsyncDataProvider.getInstance()
                .getConfigValuePreConverted(ConfigurationValues.RhevhLocalFSPath);
  }
コード例 #10
0
  protected void setupTemplate(Guid templateId, final boolean useLatest) {
    AsyncDataProvider.getInstance()
        .getTemplateById(
            new AsyncQuery(
                getModel(),
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object target, Object returnValue) {

                    UnitVmModel model = (UnitVmModel) target;
                    VmTemplate template = (VmTemplate) returnValue;

                    if (useLatest) {
                      template = createLatestTemplate(template);
                    }

                    setupBaseTemplate(template.getBaseTemplateId());

                    model.getTemplate().setItems(Collections.singletonList(template));
                    model.getTemplate().setSelectedItem(template);
                    model.getTemplate().setIsChangable(false);
                    if (!template.getId().equals(Guid.Empty)) {
                      getModel().getVmInitModel().init(template);
                    }
                  }
                },
                getModel().getHash()),
            templateId);
  }
コード例 #11
0
ファイル: ProviderModel.java プロジェクト: nirs/ovirt-engine
  protected void updateDatacentersForVmwareProvider() {
    AsyncDataProvider.getInstance()
        .getDataCenterList(
            new AsyncQuery(
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object model, Object returnValue) {
                    final List<StoragePool> dataCenters = (List<StoragePool>) returnValue;
                    StoragePool prevDataCenter = getPreviousDataCenter(dataCenters);
                    Collections.sort(dataCenters, new NameableComparator());
                    dataCenters.add(0, null); // any data center
                    getDataCenter().setItems(dataCenters);
                    getDataCenter().setSelectedItem(prevDataCenter);
                    if (getDataCenter().getSelectedItem() == null) {
                      getVmwarePropertiesModel().disableProxyHost();
                    }
                  }

                  private StoragePool getPreviousDataCenter(List<StoragePool> dataCenters) {
                    Guid previousDataCenterId = getVmwarePropertiesModel().getLastStoragePoolId();
                    for (StoragePool dataCenter : dataCenters) {
                      if (dataCenter.getId().equals(previousDataCenterId)) {
                        return dataCenter;
                      }
                    }
                    return null;
                  }
                }));
  }
コード例 #12
0
ファイル: PublicKeyModel.java プロジェクト: nirs/ovirt-engine
  public void editConsoleKey(ICommandTarget target) {
    setTitle(ConstantsManager.getInstance().getConstants().consolePublicKeyTitle());
    setHashName("edit_public_key"); // $NON-NLS-1$
    setHelpTag(HelpTag.edit_public_key);

    getCommands().add(UICommand.createDefaultOkUiCommand("OnSetConsoleKey", target)); // $NON-NLS-1$
    getCommands().add(UICommand.createCancelUiCommand("Cancel", target)); // $NON-NLS-1$

    startProgress();

    AsyncDataProvider.getInstance()
        .getUserProfile(
            new AsyncQuery(
                target,
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object target, Object returnValue) {
                    UserProfile profile = ((VdcQueryReturnValue) returnValue).getReturnValue();
                    if (profile != null) {
                      getTextInput().setEntity(profile.getSshPublicKey());
                    }
                    stopProgress();
                  }
                }));
  }
コード例 #13
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();
  }
コード例 #14
0
  private boolean isPlugAvailableByDisks(boolean plug) {
    ArrayList<Disk> disks =
        getSelectedItems() != null ? Linq.<Disk>cast(getSelectedItems()) : new ArrayList<Disk>();

    for (Disk disk : disks) {
      boolean isLocked =
          disk.getDiskStorageType() == DiskStorageType.IMAGE
              && ((DiskImage) disk).getImageStatus() == ImageStatus.LOCKED;

      boolean isDiskHotpluggableInterface = false;
      if (getEntity() != null) {
        isDiskHotpluggableInterface =
            AsyncDataProvider.getInstance()
                .getDiskHotpluggableInterfaces(
                    getEntity().getOs(), getEntity().getVdsGroupCompatibilityVersion())
                .contains(disk.getDiskInterface());
      }

      if (disk.getPlugged() == plug || isLocked || (!isDiskHotpluggableInterface && !isVmDown())) {
        return false;
      }
    }

    return true;
  }
コード例 #15
0
  protected void updateCinderVolumeTypes() {
    StorageDomain storageDomain = getStorageDomain().getSelectedItem();
    if (storageDomain == null || storageDomain.getStorageType() != StorageType.CINDER) {
      return;
    }

    AsyncDataProvider.getInstance()
        .getCinderVolumeTypesList(
            new AsyncQuery(
                this,
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object target, Object returnValue) {
                    AbstractDiskModel diskModel = (AbstractDiskModel) target;
                    List<CinderVolumeType> cinderVolumeTypes =
                        (ArrayList<CinderVolumeType>) returnValue;
                    List<String> volumeTypesNames = new ArrayList<>();
                    for (CinderVolumeType cinderVolumeType : cinderVolumeTypes) {
                      volumeTypesNames.add(cinderVolumeType.getName());
                    }
                    diskModel.getCinderVolumeType().setItems(volumeTypesNames);
                  }
                }),
            storageDomain.getId());
  }
コード例 #16
0
  public void New() {
    if (getWindow() != null) {
      return;
    }

    ClusterNetworkModel clusterModel = new ClusterNetworkModel();
    setWindow(clusterModel);
    clusterModel.setTitle("New Logical Network");
    clusterModel.setHashName("new_logical_network");
    clusterModel.setIsNew(true);
    if (getEntity().getstorage_pool_id() != null) {
      AsyncQuery _asyncQuery = new AsyncQuery();
      _asyncQuery.setModel(clusterModel);
      _asyncQuery.asyncCallback =
          new INewAsyncCallback() {
            public void OnSuccess(Object model, Object result) {
              ClusterNetworkModel clusterNetworkModel = (ClusterNetworkModel) model;
              storage_pool dataCenter = (storage_pool) result;
              clusterNetworkModel.setDataCenterName(dataCenter.getname());
            }
          };
      AsyncDataProvider.GetDataCenterById(_asyncQuery, getEntity().getstorage_pool_id().getValue());
    }
    UICommand tempVar = new UICommand("OnSave", this);
    tempVar.setTitle("OK");
    tempVar.setIsDefault(true);
    clusterModel.getCommands().add(tempVar);

    UICommand tempVar2 = new UICommand("Cancel", this);
    tempVar2.setTitle("Cancel");
    tempVar2.setIsCancel(true);
    clusterModel.getCommands().add(tempVar2);
  }
コード例 #17
0
ファイル: VmItemBehavior.java プロジェクト: jtux270/translate
  private void updateActionAvailability() {
    VM entity = (VM) getItem().getEntity();

    getItem().getTakeVmCommand().setIsAvailable(false);

    ArrayList<VM> entities = new ArrayList<VM>();
    entities.add(entity);

    getItem()
        .getRunCommand()
        .setIsExecutionAllowed(VdcActionUtils.canExecute(entities, VM.class, VdcActionType.RunVm));
    getItem()
        .getPauseCommand()
        .setIsExecutionAllowed(
            VdcActionUtils.canExecute(entities, VM.class, VdcActionType.HibernateVm)
                && AsyncDataProvider.canVmsBePaused(entities));
    getItem()
        .getShutdownCommand()
        .setIsExecutionAllowed(
            VdcActionUtils.canExecute(entities, VM.class, VdcActionType.ShutdownVm));
    getItem()
        .getStopCommand()
        .setIsExecutionAllowed(VdcActionUtils.canExecute(entities, VM.class, VdcActionType.StopVm));
    getItem()
        .getRebootCommand()
        .setIsExecutionAllowed(AsyncDataProvider.isRebootCommandExecutionAllowed(entities));

    // Check whether a VM is from the manual pool.
    if (entity.getVmPoolId() != null) {
      AsyncDataProvider.getPoolById(
          new AsyncQuery(
              this,
              new INewAsyncCallback() {
                @Override
                public void onSuccess(Object target, Object returnValue) {

                  VmItemBehavior behavior = (VmItemBehavior) target;
                  VmPool pool = (VmPool) returnValue;
                  boolean isManualPool = pool.getVmPoolType() == VmPoolType.Manual;
                  behavior.updateCommandsAccordingToPoolType(isManualPool);
                }
              }),
          entity.getVmPoolId());
    } else {
      updateCommandsAccordingToPoolType(true);
    }
  }
コード例 #18
0
  private void addParameter() {
    if (getWindow() != null) {
      return;
    }

    GlusterVolumeEntity volume = getEntity();
    if (volume == null) {
      return;
    }

    VolumeParameterModel volumeParameterModel = new VolumeParameterModel();
    volumeParameterModel.setTitle(ConstantsManager.getInstance().getConstants().addOptionVolume());
    volumeParameterModel.setHelpTag(HelpTag.add_option);
    volumeParameterModel.setHashName("add_option"); // $NON-NLS-1$
    setWindow(volumeParameterModel);
    volumeParameterModel.startProgress();

    AsyncQuery _asyncQuery = new AsyncQuery();
    _asyncQuery.setModel(this);
    _asyncQuery.setHandleFailure(true);
    _asyncQuery.asyncCallback =
        new INewAsyncCallback() {
          @Override
          public void onSuccess(Object model, Object result) {
            VolumeParameterListModel volumeParameterListModel = (VolumeParameterListModel) model;
            VolumeParameterModel innerParameterModel = (VolumeParameterModel) getWindow();

            ArrayList<GlusterVolumeOptionInfo> optionInfoList =
                new ArrayList<GlusterVolumeOptionInfo>();

            VdcQueryReturnValue returnValue = (VdcQueryReturnValue) result;

            if (!returnValue.getSucceeded()) {
              innerParameterModel.setMessage(
                  ConstantsManager.getInstance().getConstants().errorInFetchingVolumeOptionList());
            } else {
              optionInfoList =
                  new ArrayList<GlusterVolumeOptionInfo>(
                      (Set<GlusterVolumeOptionInfo>) returnValue.getReturnValue());
              optionInfoList.add(getCifsVolumeOption());
            }

            innerParameterModel.getKeyList().setItems(optionInfoList);
            innerParameterModel.stopProgress();

            UICommand command =
                UICommand.createDefaultOkUiCommand(
                    "OnSetParameter", volumeParameterListModel); // $NON-NLS-1$
            innerParameterModel.getCommands().add(command);
            innerParameterModel
                .getCommands()
                .add(
                    UICommand.createCancelUiCommand(
                        "OnCancel", volumeParameterListModel)); // $NON-NLS-1$
          }
        };
    AsyncDataProvider.getInstance()
        .getGlusterVolumeOptionInfoList(_asyncQuery, volume.getClusterId());
  }
コード例 #19
0
ファイル: StorageModel.java プロジェクト: nirs/ovirt-engine
 private int getCriticalSpaceThresholdValue() {
   if (isNewStorage()) {
     return (Integer)
         AsyncDataProvider.getInstance()
             .getConfigValuePreConverted(ConfigurationValues.CriticalSpaceActionBlocker);
   }
   return getStorage().getCriticalSpaceActionBlocker();
 }
コード例 #20
0
ファイル: StorageModel.java プロジェクト: nirs/ovirt-engine
 private int getWarningLowSpaceIndicatorValue() {
   if (isNewStorage()) {
     return (Integer)
         AsyncDataProvider.getInstance()
             .getConfigValuePreConverted(ConfigurationValues.WarningLowSpaceIndicator);
   }
   return getStorage().getWarningLowSpaceIndicator();
 }
コード例 #21
0
 private boolean isRngDeviceSupported(UnitVmModel model) {
   Version clusterVersion = clusterVersionOrNull(model);
   return clusterVersion == null
       ? false
       : (Boolean)
           AsyncDataProvider.getInstance()
               .getConfigValuePreConverted(
                   ConfigurationValues.VirtIoRngDeviceSupported, clusterVersion.getValue());
 }
コード例 #22
0
  protected void postInitStorageDomains() {
    if (getModel().getDisks() == null) {
      return;
    }

    ActionGroup actionGroup =
        getModel().isCreateInstanceOnly() ? ActionGroup.CREATE_INSTANCE : ActionGroup.CREATE_VM;
    StoragePool dataCenter = getModel().getSelectedDataCenter();
    AsyncDataProvider.getInstance()
        .getPermittedStorageDomainsByStoragePoolId(
            new AsyncQuery(
                this,
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object target, Object returnValue) {
                    VmModelBehaviorBase behavior = (VmModelBehaviorBase) target;
                    ArrayList<StorageDomain> storageDomains =
                        (ArrayList<StorageDomain>) returnValue;
                    ArrayList<StorageDomain> activeStorageDomains =
                        filterStorageDomains(storageDomains);

                    boolean provisioning = behavior.getModel().getProvisioning().getEntity();
                    ArrayList<DiskModel> disks =
                        (ArrayList<DiskModel>) behavior.getModel().getDisks();
                    Collections.sort(activeStorageDomains, new NameableComparator());

                    for (DiskModel diskModel : disks) {
                      ArrayList<StorageDomain> availableDiskStorageDomains;
                      diskModel.getQuota().setItems(behavior.getModel().getQuota().getItems());
                      ArrayList<Guid> storageIds =
                          ((DiskImage) diskModel.getDisk()).getStorageIds();

                      // Active storage domains that the disk resides on
                      ArrayList<StorageDomain> activeDiskStorageDomains =
                          Linq.getStorageDomainsByIds(storageIds, activeStorageDomains);

                      // Set target storage domains
                      availableDiskStorageDomains =
                          provisioning ? activeStorageDomains : activeDiskStorageDomains;
                      Collections.sort(availableDiskStorageDomains, new NameableComparator());
                      diskModel.getStorageDomain().setItems(availableDiskStorageDomains);

                      diskModel
                          .getStorageDomain()
                          .setChangeProhibitionReason(
                              constants.noActiveTargetStorageDomainAvailableMsg());
                      diskModel
                          .getStorageDomain()
                          .setIsChangable(!availableDiskStorageDomains.isEmpty());
                    }
                  }
                },
                getModel().getHash()),
            dataCenter.getId(),
            actionGroup);
  }
コード例 #23
0
 protected void updateVirtioScsiAvailability() {
   VDSGroup cluster = getModel().getSelectedCluster();
   boolean isVirtioScsiEnabled =
       (Boolean)
           AsyncDataProvider.getInstance()
               .getConfigValuePreConverted(
                   ConfigurationValues.VirtIoScsiEnabled,
                   cluster.getcompatibility_version().getValue());
   getModel().getIsVirtioScsiEnabled().setIsAvailable(isVirtioScsiEnabled);
 }
コード例 #24
0
 /**
  * In case of a blank template, use the proper value for the default OS.
  *
  * @param VmBase
  * @param ArchitectureType
  */
 protected void setSelectedOSType(VmBase vmBase, ArchitectureType architectureType) {
   if (vmBase.getId().equals(Guid.Empty)) {
     Integer osId = AsyncDataProvider.getInstance().getDefaultOs(architectureType);
     if (osId != null) {
       setSelectedOSTypeById(osId.intValue());
     }
   } else {
     setSelectedOSTypeById(vmBase.getOsId());
   }
 }
コード例 #25
0
  public void updateInterface(final Version clusterVersion) {
    if (getVm() != null) {
      AsyncDataProvider.getInstance()
          .isVirtioScsiEnabledForVm(
              new AsyncQuery(
                  this,
                  new INewAsyncCallback() {
                    @Override
                    public void onSuccess(Object model, Object returnValue1) {
                      getIsVirtioScsiEnabled().setEntity(Boolean.TRUE.equals(returnValue1));

                      updateInterfaceList(clusterVersion);
                    }
                  }),
              getVm().getId());
    } else {
      setInterfaces(AsyncDataProvider.getInstance().getDiskInterfaceList());
    }
  }
コード例 #26
0
 @Override
 protected void build(UnitVmModel model, VmBase vm) {
   super.build(model, vm);
   vm.setAllowConsoleReconnect(model.getAllowConsoleReconnect().getEntity());
   vm.setVmType(model.getVmType().getSelectedItem());
   vm.setVdsGroupId(
       model.getSelectedCluster() != null ? model.getSelectedCluster().getId() : null);
   vm.setTimeZone(
       model.getTimeZone().getIsAvailable() && model.getTimeZone().getSelectedItem() != null
           ? model.getTimeZone().getSelectedItem().getTimeZoneKey()
           : ""); //$NON-NLS-1$
   vm.setIsoPath(
       model.getCdImage().getIsChangable()
           ? model.getCdImage().getSelectedItem()
           : ""); //$NON-NLS-1$
   vm.setDeleteProtected(model.getIsDeleteProtected().getEntity());
   vm.setOsId(model.getOSType().getSelectedItem());
   Guid largeIconId = IconCache.getInstance().getId(model.getIcon().getEntity().getIcon());
   vm.setLargeIconId(largeIconId);
   vm.setSmallIconId(
       model.getIcon().getEntity().getSmallIconId() != null
           ? model.getIcon().getEntity().getSmallIconId()
           : AsyncDataProvider.getInstance().isCustomIconId(largeIconId)
               ? null
               : AsyncDataProvider.getInstance().getSmallByLargeOsDefaultIconId(largeIconId));
   vm.setVncKeyboardLayout(model.getVncKeyboardLayout().getSelectedItem());
   vm.setSerialNumberPolicy(model.getSerialNumberPolicy().getSelectedSerialNumberPolicy());
   vm.setCustomSerialNumber(model.getSerialNumberPolicy().getCustomSerialNumber().getEntity());
   vm.setBootMenuEnabled(model.getBootMenuEnabled().getEntity());
   vm.setSpiceFileTransferEnabled(
       Boolean.TRUE.equals(model.getSpiceFileTransferEnabled().getEntity()));
   vm.setSpiceCopyPasteEnabled(Boolean.TRUE.equals(model.getSpiceCopyPasteEnabled().getEntity()));
   vm.setAutoConverge(model.getAutoConverge().getSelectedItem());
   vm.setMigrateCompressed(model.getMigrateCompressed().getSelectedItem());
   vm.setCustomProperties(model.getCustomPropertySheet().serialize());
   vm.setConsoleDisconnectAction(model.getConsoleDisconnectAction().getSelectedItem());
   if (model.getCpuSharesAmount().getIsAvailable()
       && model.getCpuSharesAmount().getEntity() != null) {
     vm.setCpuShares(model.getCpuSharesAmount().getEntity());
   }
   vm.setCustomCompatibilityVersion(model.getCustomCompatibilityVersion().getSelectedItem());
 }
コード例 #27
0
  private void viewHook() {
    if (getWindow() != null) {
      return;
    }

    GlusterHookEntity hookEntity = getSelectedItem();

    if (hookEntity == null) {
      return;
    }

    GlusterHookContentModel contentModel = new GlusterHookContentModel();
    contentModel.setTitle(
        ConstantsManager.getInstance().getConstants().viewContentGlusterHookTitle());
    contentModel.setHelpTag(HelpTag.view_gluster_hook);
    contentModel.setHashName("view_gluster_hook"); // $NON-NLS-1$
    setWindow(contentModel);

    contentModel.startProgress();

    AsyncDataProvider.getInstance()
        .getGlusterHookContent(
            new AsyncQuery(
                contentModel,
                new INewAsyncCallback() {
                  @Override
                  public void onSuccess(Object model, Object returnValue) {
                    String content = (String) returnValue;
                    GlusterHookContentModel localModel = (GlusterHookContentModel) model;
                    localModel.getContent().setEntity(content);
                    if (content == null) {
                      localModel.getContent().setIsAvailable(false);
                      localModel.setMessage(
                          ConstantsManager.getInstance()
                              .getConstants()
                              .viewContentErrorGlusterHook());
                    } else if (content.length() == 0) {
                      localModel.getContent().setIsAvailable(false);
                      localModel.setMessage(
                          ConstantsManager.getInstance()
                              .getConstants()
                              .viewContentEmptyGlusterHook());
                    }
                    localModel.stopProgress();
                  }
                }),
            hookEntity.getId(),
            null);

    UICommand command = new UICommand("Cancel", this); // $NON-NLS-1$
    command.setTitle(ConstantsManager.getInstance().getConstants().close());
    command.setIsCancel(true);
    contentModel.getCommands().add(command);
  }
コード例 #28
0
  private void updateShareableDiskEnabled(StoragePool datacenter) {
    boolean isShareableDiskEnabled =
        (Boolean)
            AsyncDataProvider.getInstance()
                .getConfigValuePreConverted(
                    ConfigurationValues.ShareableDiskEnabled,
                    datacenter.getCompatibilityVersion().getValue());

    getIsShareable().setChangeProhibitionReason(constants.shareableDiskNotSupported());
    getIsShareable().setIsChangeable(isShareableDiskEnabled && isEditEnabled());
  }
コード例 #29
0
 protected void updateIsDiskHotPlugAvailable() {
   VM vm = getEntity();
   Version clusterCompatibilityVersion = vm.getVdsGroupCompatibilityVersion();
   if (clusterCompatibilityVersion == null) {
     setIsDiskHotPlugSupported(false);
   } else {
     setIsDiskHotPlugSupported(
         !AsyncDataProvider.getInstance()
             .getDiskHotpluggableInterfaces(getEntity().getOs(), clusterCompatibilityVersion)
             .isEmpty());
   }
 }
コード例 #30
0
 private void initManagement() {
   AsyncDataProvider.getInstance()
       .isManagementNetwork(
           new AsyncQuery<>(
               new AsyncCallback<Boolean>() {
                 @Override
                 public void onSuccess(Boolean returnValue) {
                   management = returnValue;
                 }
               }),
           getNetwork().getId());
 }