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;
}
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);
}
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();
}
}
}
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);
}
}
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()));
}
Aggregations