Search in sources :

Example 76 with StorageDomain

use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.

the class DataCenterGuideModel method updateOptionsNonLocalFS.

private void updateOptionsNonLocalFS() {
    if (clusters == null || allStorageDomains == null || attachedStorageDomains == null || isoStorageDomains == null || allHosts == null) {
        return;
    }
    updateAddClusterAvailability();
    Set<Guid> clusterIds = clusters.stream().map(Cluster::getId).collect(Collectors.toSet());
    List<VDS> hosts = allHosts.stream().filter(h -> clusterIds.contains(h.getClusterId())).collect(Collectors.toList());
    List<VDS> upHosts = hosts.stream().filter(v -> v.getStatus() == VDSStatus.Up).collect(Collectors.toList());
    List<VDS> availableHosts = allHosts.stream().filter(v -> v.getStatus() == VDSStatus.Maintenance || v.getStatus() == VDSStatus.PendingApproval).filter(v -> doesHostSupportAnyCluster(clusters, v)).collect(Collectors.toList());
    updateAddAndSelectHostAvailability(hosts, availableHosts);
    List<StorageDomain> unattachedStorages = getUnattachedStorages();
    List<StorageDomain> attachedDataStorages = new ArrayList<>();
    List<StorageDomain> attachedIsoStorages = new ArrayList<>();
    for (StorageDomain sd : attachedStorageDomains) {
        if (sd.getStorageDomainType().isDataDomain()) {
            attachedDataStorages.add(sd);
        } else if (sd.getStorageDomainType() == StorageDomainType.ISO) {
            attachedIsoStorages.add(sd);
        }
    }
    updateAddAndAttachDataDomainAvailability(upHosts, unattachedStorages, attachedDataStorages);
    updateAddAndAttachIsoDomainAvailability(upHosts, attachedDataStorages, attachedIsoStorages);
    stopProgress();
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) GuideModel(org.ovirt.engine.ui.uicommonweb.models.GuideModel) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) NewEditStorageModelBehavior(org.ovirt.engine.ui.uicommonweb.models.storage.NewEditStorageModelBehavior) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) MoveHost(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) ITaskTarget(org.ovirt.engine.ui.uicompat.ITaskTarget) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) TaskContext(org.ovirt.engine.ui.uicompat.TaskContext) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) FrontendMultipleActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult) Task(org.ovirt.engine.ui.uicompat.Task) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) MoveHostData(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) Timer(com.google.gwt.user.client.Timer) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid)

Example 77 with StorageDomain

use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.

the class DataCenterListModel method onSave.

public void onSave() {
    final DataCenterModel dcModel = (DataCenterModel) getWindow();
    if (!dcModel.validate()) {
        return;
    }
    if ((dcModel.getIsNew() || dcModel.getEntity() == null) && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
        promptNoQuotaInDCMessage();
    } else if (!dcModel.getIsNew() && getSelectedItem() != null && !dcModel.getVersion().getSelectedItem().equals(getSelectedItem().getCompatibilityVersion())) {
        final ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().changeDataCenterCompatibilityVersionTitle());
        confirmModel.setHelpTag(HelpTag.change_data_center_compatibility_version);
        // $NON-NLS-1$
        confirmModel.setHashName("change_data_center_compatibility_version");
        final StoragePool sp = getSelectedItem();
        startProgress();
        IdQueryParameters params = new IdQueryParameters(sp.getId());
        Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
            List<StorageDomain> storages = returnValue.getReturnValue();
            StorageDomain storage = null;
            for (StorageDomain sd : storages) {
                if (sd.getStorageDomainType().isDataDomain()) {
                    storage = sd;
                }
            }
            StorageFormatType newFormat = null;
            StorageFormatType oldFormat = null;
            if (storage != null) {
                newFormat = VersionStorageFormatUtil.getForVersion(dcModel.getVersion().getSelectedItem());
                oldFormat = VersionStorageFormatUtil.getForVersion(sp.getCompatibilityVersion());
            }
            if (newFormat == oldFormat) {
                confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutChangeDcCompatibilityVersionMsg());
            } else {
                Version v = VersionStorageFormatUtil.getEarliestVersionSupported(newFormat);
                confirmModel.setMessage(ConstantsManager.getInstance().getMessages().youAreAboutChangeDcCompatibilityVersionWithUpgradeMsg(v.getValue()));
            }
            stopProgress();
        }));
        // $NON-NLS-1$
        UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSaveInternal", this);
        confirmModel.getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
        confirmModel.getCommands().add(tempVar2);
    } else if (getSelectedItem() != null && getSelectedItem().getQuotaEnforcementType() != QuotaEnforcementTypeEnum.HARD_ENFORCEMENT && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
        checkForQuotaInDC(dcModel.getEntity(), this);
    } else if (dcModel.getIsNew()) {
        // New data center, check for name uniqueness.
        validateDataCenterName(dcModel);
    } else {
        onSaveInternal();
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Version(org.ovirt.engine.core.compat.Version) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 78 with StorageDomain

use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.

the class DataCenterListModel method recoveryStorage.

public void recoveryStorage() {
    final ConfirmationModel windowModel = new ConfirmationModel();
    setWindow(windowModel);
    windowModel.setTitle(ConstantsManager.getInstance().getConstants().dataCenterReInitializeTitle());
    windowModel.setHelpTag(HelpTag.data_center_re_initialize);
    // $NON-NLS-1$
    windowModel.setHashName("data_center_re-initialize");
    windowModel.getLatch().setIsAvailable(true);
    windowModel.getLatch().setIsChangeable(true);
    windowModel.startProgress();
    AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomainList -> {
        windowModel.stopProgress();
        List<EntityModel> models = new ArrayList<>();
        for (StorageDomain a : storageDomainList) {
            if (a.getStorageDomainType() == StorageDomainType.Data && (a.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Unattached)) {
                EntityModel tempVar = new EntityModel();
                tempVar.setEntity(a);
                models.add(tempVar);
            }
        }
        windowModel.setItems(models);
        if (models.size() > 0) {
            EntityModel entityModel = models.size() != 0 ? models.get(0) : null;
            if (entityModel != null) {
                entityModel.setIsSelected(true);
            }
        }
        if (models.isEmpty()) {
            windowModel.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoCompatibleStorageDomainsAttachThisDcMsg());
            windowModel.getLatch().setIsAvailable(false);
            // $NON-NLS-1$
            UICommand tempVar2 = new UICommand("Cancel", DataCenterListModel.this);
            tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
            tempVar2.setIsDefault(true);
            tempVar2.setIsCancel(true);
            windowModel.getCommands().add(tempVar2);
        } else {
            // $NON-NLS-1$
            UICommand tempVar3 = UICommand.createDefaultOkUiCommand("OnRecover", DataCenterListModel.this);
            windowModel.getCommands().add(tempVar3);
            // $NON-NLS-1$
            UICommand tempVar4 = UICommand.createCancelUiCommand("Cancel", DataCenterListModel.this);
            windowModel.getCommands().add(tempVar4);
        }
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters) List(java.util.List) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) ReconstructMasterParameters(org.ovirt.engine.core.common.action.ReconstructMasterParameters) DataCenterCpuQosListModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterCpuQosListModel) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) StoragePoolManagementParameter(org.ovirt.engine.core.common.action.StoragePoolManagementParameter) DataCenterHostNetworkQosListModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterHostNetworkQosListModel) Frontend(org.ovirt.engine.ui.frontend.Frontend) DataCenterStorageQosListModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterStorageQosListModel) ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) VersionStorageFormatUtil(org.ovirt.engine.core.common.utils.VersionStorageFormatUtil) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) Quota(org.ovirt.engine.core.common.businessentities.Quota) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) List(java.util.List) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 79 with StorageDomain

use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.

the class DataCenterStorageListModel method onAttach.

public void onAttach() {
    ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
    List<StorageDomain> selectedDataStorageDomains = new ArrayList<>();
    if (getEntity() == null) {
        cancel();
        return;
    }
    selectedStorageDomains = new ArrayList<>();
    for (EntityModel<StorageDomain> a : model.getItems()) {
        if (a.getIsSelected()) {
            StorageDomain storageDomain = a.getEntity();
            selectedStorageDomains.add(storageDomain);
            if (storageDomain.getStorageDomainType() == StorageDomainType.Data) {
                selectedDataStorageDomains.add(storageDomain);
            }
        }
    }
    if (selectedStorageDomains.isEmpty()) {
        cancel();
        return;
    }
    AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
        if (!attachedStorageDomains.isEmpty()) {
            ConfirmationModel confirmationModel = new ConfirmationModel();
            setWindow(null);
            setWindow(confirmationModel);
            List<String> stoageDomainNames = attachedStorageDomains.stream().map(StorageDomainStatic::getStorageName).collect(Collectors.toList());
            confirmationModel.setItems(stoageDomainNames);
            confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
            confirmationModel.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
            confirmationModel.setHelpTag(HelpTag.attach_storage_domain_confirmation);
            // $NON-NLS-1$
            confirmationModel.setHashName("attach_storage_domain_confirmation");
            confirmationModel.getLatch().setIsAvailable(true);
            confirmationModel.getLatch().setIsChangeable(true);
            // $NON-NLS-1$
            UICommand onApprove = new UICommand("OnAttachApprove", DataCenterStorageListModel.this);
            onApprove.setTitle(ConstantsManager.getInstance().getConstants().ok());
            onApprove.setIsDefault(true);
            confirmationModel.getCommands().add(onApprove);
            // $NON-NLS-1$
            UICommand cancel = new UICommand("Cancel", DataCenterStorageListModel.this);
            cancel.setTitle(ConstantsManager.getInstance().getConstants().cancel());
            cancel.setIsCancel(true);
            confirmationModel.getCommands().add(cancel);
        } else {
            executeAttachStorageDomains();
        }
    }), getEntity(), selectedDataStorageDomains);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) Model(org.ovirt.engine.ui.uicommonweb.models.Model) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) ActionUtils(org.ovirt.engine.core.common.ActionUtils) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) NotifyCollectionChangedEventArgs(org.ovirt.engine.ui.uicompat.NotifyCollectionChangedEventArgs) List(java.util.List) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) DeactivateStorageDomainWithOvfUpdateParameters(org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) List(java.util.List) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 80 with StorageDomain

use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.

the class DataCenterStorageListModel method detach.

public void detach() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle());
    model.setHelpTag(HelpTag.detach_storage);
    // $NON-NLS-1$
    model.setHashName("detach_storage");
    model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachFollowingStoragesMsg());
    List<String> list = new ArrayList<>();
    boolean shouldAddressWarnning = false;
    for (StorageDomain item : getSelectedItems()) {
        list.add(item.getStorageName());
        if (item.getStorageDomainType().isDataDomain()) {
            shouldAddressWarnning = true;
            break;
        }
    }
    model.setItems(list);
    if (containsLocalStorage(model)) {
        shouldAddressWarnning = false;
        model.getForce().setIsAvailable(true);
        model.getForce().setIsChangeable(true);
        model.setForceLabel(ConstantsManager.getInstance().getConstants().storageRemovePopupFormatLabel());
        model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString()));
    }
    if (shouldAddressWarnning) {
        model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote());
    }
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnDetach", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Aggregations

StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)345 ArrayList (java.util.ArrayList)108 Guid (org.ovirt.engine.core.compat.Guid)103 Test (org.junit.Test)91 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)75 List (java.util.List)58 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)58 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)49 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)47 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)46 QueryType (org.ovirt.engine.core.common.queries.QueryType)43 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)42 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)41 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)41 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)40 VDS (org.ovirt.engine.core.common.businessentities.VDS)39 Frontend (org.ovirt.engine.ui.frontend.Frontend)39 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)36 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)36 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)35