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()); } } })); } }
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()); }
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; }
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; } })); }
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; }
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(); } })); }
@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(); }
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); }
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); }
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); }
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()); }
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()); }
private int getWarningLowSpaceIndicatorValue() { if (isNewStorage()) { return (Integer) AsyncDataProvider.getInstance() .getConfigValuePreConverted(ConfigurationValues.WarningLowSpaceIndicator); } return getStorage().getWarningLowSpaceIndicator(); }
private int getCriticalSpaceThresholdValue() { if (isNewStorage()) { return (Integer) AsyncDataProvider.getInstance() .getConfigValuePreConverted(ConfigurationValues.CriticalSpaceActionBlocker); } return getStorage().getCriticalSpaceActionBlocker(); }
private boolean isRngDeviceSupported(UnitVmModel model) { Version clusterVersion = clusterVersionOrNull(model); return clusterVersion == null ? false : (Boolean) AsyncDataProvider.getInstance() .getConfigValuePreConverted( ConfigurationValues.VirtIoRngDeviceSupported, clusterVersion.getValue()); }
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); }
/** * 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()); } }
protected void updateVirtioScsiAvailability() { VDSGroup cluster = getModel().getSelectedCluster(); boolean isVirtioScsiEnabled = (Boolean) AsyncDataProvider.getInstance() .getConfigValuePreConverted( ConfigurationValues.VirtIoScsiEnabled, cluster.getcompatibility_version().getValue()); getModel().getIsVirtioScsiEnabled().setIsAvailable(isVirtioScsiEnabled); }
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()); } }
@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()); }
private void updateShareableDiskEnabled(StoragePool datacenter) { boolean isShareableDiskEnabled = (Boolean) AsyncDataProvider.getInstance() .getConfigValuePreConverted( ConfigurationValues.ShareableDiskEnabled, datacenter.getCompatibilityVersion().getValue()); getIsShareable().setChangeProhibitionReason(constants.shareableDiskNotSupported()); getIsShareable().setIsChangeable(isShareableDiskEnabled && isEditEnabled()); }
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); }
public PrivateAsyncCallback(SearchableListModel<E, T> model) { this.model = model; AsyncDataProvider.getInstance() .getSearchResultsLimit( model.asyncQuery( new AsyncCallback<Integer>() { @Override public void onSuccess(Integer result) { ApplySearchPageSize(result); } })); }
private void initManagement() { AsyncDataProvider.getInstance() .isManagementNetwork( new AsyncQuery<>( new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean returnValue) { management = returnValue; } }), getNetwork().getId()); }
protected void updateIsDiskHotPlugAvailable() { VM vm = getEntity(); Version clusterCompatibilityVersion = vm.getVdsGroupCompatibilityVersion(); if (clusterCompatibilityVersion == null) { setIsDiskHotPlugSupported(false); } else { setIsDiskHotPlugSupported( !AsyncDataProvider.getInstance() .getDiskHotpluggableInterfaces(getEntity().getOs(), clusterCompatibilityVersion) .isEmpty()); } }
protected void updateCpuPinningVisibility() { if (getModel().getSelectedCluster() != null) { VDSGroup cluster = getModel().getSelectedCluster(); String compatibilityVersion = cluster.getcompatibility_version().toString(); boolean isLocalSD = getModel().getSelectedDataCenter() != null && getModel().getSelectedDataCenter().isLocal(); // cpu pinning is available on Local SD with no consideration for auto assign value boolean hasCpuPinning = Boolean.FALSE.equals(getModel().getIsAutoAssign().getEntity()) || isLocalSD; if (Boolean.FALSE.equals( AsyncDataProvider.getInstance() .getConfigValuePreConverted( ConfigurationValues.CpuPinningEnabled, compatibilityVersion))) { hasCpuPinning = false; } else if (Boolean.FALSE.equals( AsyncDataProvider.getInstance() .getConfigValuePreConverted( ConfigurationValues.CpuPinMigrationEnabled, AsyncDataProvider.getInstance().getDefaultConfigurationVersion())) && isVmMigratable() && !isLocalSD) { hasCpuPinning = false; } if (!hasCpuPinning) { if (isLocalSD) { getModel() .getCpuPinning() .setChangeProhibitionReason(constants.cpuPinningUnavailableLocalStorage()); } else { getModel().getCpuPinning().setChangeProhibitionReason(constants.cpuPinningUnavailable()); } getModel().getCpuPinning().setEntity(""); } getModel().getCpuPinning().setIsChangable(hasCpuPinning); } }
protected void updateBootableDiskAvailable() { AsyncDataProvider.getInstance() .getVmDiskList( new AsyncQuery( this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ArrayList<Disk> disks = (ArrayList<Disk>) returnValue; updateBootableFrom(disks); } }), getVm().getId()); }
protected void updateDataCenterVersion() { AsyncQuery query = new AsyncQuery( this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmDiskListModel model = (VmDiskListModel) target; StoragePool storagePool = (StoragePool) returnValue; model.setDataCenterVersion(storagePool.getCompatibilityVersion()); } }); AsyncDataProvider.getInstance().getDataCenterById(query, getEntity().getStoragePoolId()); }
protected void updateStorageDomains(final StoragePool datacenter) { AsyncDataProvider.getInstance() .getPermittedStorageDomainsByStoragePoolId( new AsyncQuery( this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { DiskModel diskModel = (DiskModel) target; ArrayList<StorageDomain> storageDomains = (ArrayList<StorageDomain>) returnValue; ArrayList<StorageDomain> filteredStorageDomains = new ArrayList<>(); switch (getDiskStorageType().getEntity()) { case IMAGE: filteredStorageDomains.addAll( Linq.filterStorageDomainsByStorageDomainType( storageDomains, StorageDomainType.Master)); filteredStorageDomains.addAll( Linq.filterStorageDomainsByStorageDomainType( storageDomains, StorageDomainType.Data)); break; case CINDER: filteredStorageDomains.addAll( Linq.filterStorageDomainsByStorageType( storageDomains, StorageType.CINDER)); break; } filteredStorageDomains = (ArrayList<StorageDomain>) Linq.filterStorageDomainsByStorageStatus( filteredStorageDomains, StorageDomainStatus.Active); Collections.sort(filteredStorageDomains, new NameableComparator()); StorageDomain storage = Linq.firstOrNull(filteredStorageDomains); diskModel.getStorageDomain().setItems(filteredStorageDomains, storage); if (storage == null) { switch (getDiskStorageType().getEntity()) { case IMAGE: diskModel.setMessage(constants.noActiveStorageDomainsInDC()); break; case CINDER: diskModel.setMessage(constants.noCinderStorageDomainsInDC()); break; } } } }), datacenter.getId(), ActionGroup.CREATE_DISK); }
public void updataMaxVmsInPool() { AsyncDataProvider.getInstance() .getMaxVmsInPool( new AsyncQuery( this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmModelBehaviorBase behavior = (VmModelBehaviorBase) target; behavior.setMaxVmsInPool((Integer) returnValue); behavior.updateMaxNumOfVmCpus(); } })); }