Search in sources :

Example 1 with StorageDomainType

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

the class DisksTree method getNodeItem.

@Override
protected TreeItem getNodeItem(StorageDomain storage) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(1);
    // $NON-NLS-1$
    panel.setWidth("100%");
    // $NON-NLS-1$
    addItemToPanel(panel, new Image(resources.storageImage()), "25px");
    // $NON-NLS-1$
    addTextBoxToPanel(panel, new StringValueLabel(), storage.getStorageName(), "");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<StorageDomainType>(), storage.getStorageDomainType(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<StorageDomainSharedStatus>(), storage.getStorageDomainSharedStatus(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getAvailableDiskSize(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getUsedDiskSize(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getTotalDiskSize(), "120px");
    TreeItem treeItem = new TreeItem(panel);
    treeItem.setUserObject(storage.getId());
    return treeItem;
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) TreeItem(com.google.gwt.user.client.ui.TreeItem) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Image(com.google.gwt.user.client.ui.Image) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) StringValueLabel(org.ovirt.engine.ui.common.widget.label.StringValueLabel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)

Example 2 with StorageDomainType

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

the class StorageModel method updateCurrentStorageItem.

public void updateCurrentStorageItem() {
    StorageDomainType storageDomainType = getAvailableStorageDomainTypeItems().getSelectedItem();
    StorageType storageType = getAvailableStorageTypeItems().getSelectedItem();
    getStorageModels().stream().filter(model -> model.getType() == storageType && model.getRole() == storageDomainType).findFirst().ifPresent(this::setCurrentStorageItem);
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType)

Example 3 with StorageDomainType

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

the class StoragePopupView method revealStorageView.

@SuppressWarnings("unchecked")
private void revealStorageView(StorageModel object) {
    StorageType storageType = storageTypeListEditor.asEditor().getActualEditor().getValue();
    StorageDomainType storageDomainType = domainFunctionListEditor.asEditor().getActualEditor().getValue();
    if (storageType == null || storageDomainType == null) {
        return;
    }
    switch(storageType) {
        case NFS:
            storageView = new NfsStorageView();
            break;
        case LOCALFS:
            storageView = new LocalStorageView();
            break;
        case POSIXFS:
            storageView = new PosixStorageView();
            break;
        case GLUSTERFS:
            storageView = new GlusterStorageView();
            break;
        case FCP:
            if (!object.getBehavior().isImport()) {
                storageView = new FcpStorageView(true);
            } else {
                storageView = new ImportFcpStorageView();
            }
            break;
        case ISCSI:
            if (!object.getBehavior().isImport()) {
                storageView = new IscsiStorageView(true);
            } else {
                storageView = new ImportIscsiStorageView();
            }
            break;
        default:
            break;
    }
    updateStorageItem(object);
    IStorageModel model = object.getCurrentStorageItem();
    // Re-apply element IDs on 'storageView' change
    ViewIdHandler.idHandler.generateAndSetIds(this);
    // Clear the current storage view
    specificStorageTypePanel.clear();
    // Add the new storage view and call focus on it if needed
    if (storageView != null && model != null) {
        storageView.edit(model);
        specificStorageTypePanel.add(storageView);
        if (!nameEditor.isVisible()) {
            storageView.focus();
        }
    }
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) FcpStorageView(org.ovirt.engine.ui.common.widget.uicommon.storage.FcpStorageView) ImportFcpStorageView(org.ovirt.engine.ui.common.widget.uicommon.storage.ImportFcpStorageView) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) ImportIscsiStorageView(org.ovirt.engine.ui.common.widget.uicommon.storage.ImportIscsiStorageView) IscsiStorageView(org.ovirt.engine.ui.common.widget.uicommon.storage.IscsiStorageView) ImportIscsiStorageView(org.ovirt.engine.ui.common.widget.uicommon.storage.ImportIscsiStorageView) ImportFcpStorageView(org.ovirt.engine.ui.common.widget.uicommon.storage.ImportFcpStorageView)

Example 4 with StorageDomainType

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

the class StorageDomainToPoolRelationValidator method validateAmountOfIsoAndExportDomainsInDC.

/**
 * Check that we are not trying to attach more than one ISO or export
 * domain to the same data center.
 */
public ValidationResult validateAmountOfIsoAndExportDomainsInDC() {
    // Nothing to check if the storage domain is not an ISO or export:
    if (!isStorageDomainOfTypeIsoOrExport()) {
        return ValidationResult.VALID;
    }
    final StorageDomainType type = storageDomainStatic.getStorageDomainType();
    // Check if such a domain type is already present in the pool
    boolean hasSuchType = getStorageDomainDao().getAllForStoragePool(storagePool.getId()).stream().anyMatch(a -> a.getStorageDomainType() == type);
    // If it's the first domain of that type, we are okay, we can add a new one:
    if (!hasSuchType) {
        return ValidationResult.VALID;
    }
    // so when have to prepare a friendly message for the user (see #713160) and fail:
    if (type == StorageDomainType.ISO) {
        return new ValidationResult(EngineMessage.ERROR_CANNOT_ATTACH_MORE_THAN_ONE_ISO_DOMAIN);
    } else {
        return new ValidationResult(EngineMessage.ERROR_CANNOT_ATTACH_MORE_THAN_ONE_EXPORT_DOMAIN);
    }
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Example 5 with StorageDomainType

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

the class StorageDomainValidator method isStorageFormatCompatibleWithDomain.

public ValidationResult isStorageFormatCompatibleWithDomain() {
    StorageFormatType storageFormat = storageDomain.getStorageFormat();
    StorageType storageType = storageDomain.getStorageType();
    StorageDomainType storageDomainFunction = storageDomain.getStorageDomainType();
    boolean validationSucceeded = true;
    if (storageFormat == null) {
        validationSucceeded = false;
    }
    // V2 is applicable only for block data storage domains
    if (validationSucceeded && storageFormat == StorageFormatType.V2) {
        if (!(storageDomainFunction.isDataDomain() && storageType.isBlockDomain())) {
            validationSucceeded = false;
        }
    }
    if (validationSucceeded && storageFormat.compareTo(StorageFormatType.V3) >= 0) {
        // Above V3 is applicable only for data storage domains
        if (!storageDomainFunction.isDataDomain()) {
            validationSucceeded = false;
        }
    }
    return validationSucceeded ? ValidationResult.VALID : new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST, String.format("$storageFormat %1$s", storageDomain.getStorageFormat()));
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Aggregations

StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)13 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)4 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)4 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 StorageDomainSharedStatus (org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)3 StorageFormatType (org.ovirt.engine.core.common.businessentities.StorageFormatType)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Image (com.google.gwt.user.client.ui.Image)2 TreeItem (com.google.gwt.user.client.ui.TreeItem)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Guid (org.ovirt.engine.core.compat.Guid)2 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)2 Collection (java.util.Collection)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 ActionUtils (org.ovirt.engine.core.common.ActionUtils)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1