Search in sources :

Example 6 with LunDisk

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

the class DiskValidatorTest method setupForLun.

private void setupForLun() {
    LunDisk lunDisk = createLunDisk();
    lunValidator = spy(new DiskValidator(lunDisk));
}
Also used : LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk)

Example 7 with LunDisk

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

the class DiskValidatorTest method createLunDisk.

private LunDisk createLunDisk(ScsiGenericIO sgio) {
    LunDisk lunDisk = createLunDisk();
    lunDisk.setSgio(sgio);
    return lunDisk;
}
Also used : LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk)

Example 8 with LunDisk

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

the class DiskVmElementDiscardSupportValidatorTest method data.

@Parameters
public static Object[][] data() {
    ValidationResult passDiscardNotSupportedByDiskInterface = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE, getDiskAliasVarReplacement());
    ValidationResult passDiscardNotSupportedForDirectLunByUnderlyingStorage = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_FOR_DIRECT_LUN_BY_UNDERLYING_STORAGE, getDiskAliasVarReplacement());
    ValidationResult passDiscardNotSupportedForDiskImageByUnderlyingStorage = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_FOR_DISK_IMAGE_BY_UNDERLYING_STORAGE, getDiskAliasVarReplacement(), getStorageDomainNameVarReplacement());
    ValidationResult passDiscardNotSupportedByCinder = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_STORAGE_TYPE, getDiskAliasVarReplacement(), String.format("$diskStorageType %s", DiskStorageType.CINDER));
    // sdSupportsDiscard, diskWipeAfterDelete, expectedResult.
    return new Object[][] { // isPassDiscard == false
    { new DiskImage(), false, null, null, null, null, null, ValidationResult.VALID }, // Unsupported interface
    { new DiskImage(), true, DiskInterface.VirtIO, null, null, null, null, passDiscardNotSupportedByDiskInterface }, { new DiskImage(), true, DiskInterface.SPAPR_VSCSI, null, null, null, null, passDiscardNotSupportedByDiskInterface }, // Direct lun without support from underlying storage (different interfaces)
    { new LunDisk(), true, DiskInterface.VirtIO_SCSI, 0L, null, null, null, passDiscardNotSupportedForDirectLunByUnderlyingStorage }, { new LunDisk(), true, DiskInterface.IDE, 0L, null, null, null, passDiscardNotSupportedForDirectLunByUnderlyingStorage }, // Direct lun with support from underlying storage (different interfaces)
    { new LunDisk(), true, DiskInterface.VirtIO_SCSI, 1024L, null, null, null, ValidationResult.VALID }, { new LunDisk(), true, DiskInterface.IDE, 1024L, null, null, null, ValidationResult.VALID }, /*
                Image on file storage domain:
                - with/without support from underlying storage
                - different interfaces
                - different file storage types
                 */
    { new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.NFS, true, null, ValidationResult.VALID }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.POSIXFS, false, null, ValidationResult.VALID }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.POSIXFS, null, null, ValidationResult.VALID }, /*
                Image on block storage domain without support from underlying storage:
                - different interfaces
                - different block storage types
                 */
    { new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.ISCSI, false, null, passDiscardNotSupportedForDiskImageByUnderlyingStorage }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.FCP, false, null, passDiscardNotSupportedForDiskImageByUnderlyingStorage }, /*
                Image on block storage domain with support from underlying storage:
                - different interfaces
                - different block storage types
                 */
    { new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.ISCSI, true, null, ValidationResult.VALID }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.FCP, true, null, ValidationResult.VALID }, /*
                Image on block storage domain with support from underlying storage and WAD enabled:
                - different interfaces
                - different block storage types
                 */
    { new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.ISCSI, true, true, new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_UNDERLYING_STORAGE_WHEN_WAD_IS_ENABLED, getStorageDomainNameVarReplacement(), getDiskAliasVarReplacement()) }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.FCP, true, true, new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_UNDERLYING_STORAGE_WHEN_WAD_IS_ENABLED, getStorageDomainNameVarReplacement(), getDiskAliasVarReplacement()) }, /*
                Image on non file or block storage domain:
                - different interfaces
                - different non file or block storage types
                 */
    { new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.UNKNOWN, null, null, createPassDiscardNotSupportedByStorageTypeValResult(StorageType.UNKNOWN) }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.CINDER, null, null, createPassDiscardNotSupportedByStorageTypeValResult(StorageType.CINDER) }, // Unsupported disk storage type (different interfaces)
    { new CinderDisk(), true, DiskInterface.VirtIO_SCSI, null, null, null, null, passDiscardNotSupportedByCinder }, { new CinderDisk(), true, DiskInterface.IDE, null, null, null, null, passDiscardNotSupportedByCinder } };
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Parameters(org.junit.runners.Parameterized.Parameters)

Example 9 with LunDisk

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

the class EditDiskModel method datacenter_SelectedItemChanged.

@Override
protected void datacenter_SelectedItemChanged() {
    super.datacenter_SelectedItemChanged();
    // this needs to be executed after the data center is loaded because the update quota needs both values
    if (getDisk().getDiskStorageType() == DiskStorageType.IMAGE) {
        Guid storageDomainId = ((DiskImage) getDisk()).getStorageIds().get(0);
        AsyncDataProvider.getInstance().getStorageDomainById(new AsyncQuery<>(storageDomain -> getStorageDomain().setSelectedItem(storageDomain)), storageDomainId);
    } else if (getDisk().getDiskStorageType() == DiskStorageType.LUN) {
        LunDisk lunDisk = (LunDisk) getDisk();
        getDiskStorageType().setEntity(DiskStorageType.LUN);
        getSize().setEntity(lunDisk.getLun().getDeviceSize());
        getSizeExtend().setIsAvailable(false);
    }
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation) Arrays(java.util.Arrays) ActionUtils(org.ovirt.engine.core.common.ActionUtils) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Guid(org.ovirt.engine.core.compat.Guid) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) NonNegativeLongNumberValidation(org.ovirt.engine.ui.uicommonweb.validation.NonNegativeLongNumberValidation) VmDiskOperationParameterBase(org.ovirt.engine.core.common.action.VmDiskOperationParameterBase) ScsiGenericIO(org.ovirt.engine.core.common.businessentities.storage.ScsiGenericIO) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Guid(org.ovirt.engine.core.compat.Guid) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk)

Example 10 with LunDisk

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

the class VmDiskAttachPopupWidget method initLunDisksTable.

private void initLunDisksTable() {
    lunDiskTable.enableColumnResizing();
    AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "60px");
    AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "85px");
    AbstractTextColumn<EntityModel> lunIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getLUNId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(lunIdColumn, constants.lunIdSanStorage(), "60px");
    AbstractTextColumn<EntityModel> idColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getId().toString();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(idColumn, constants.idVmDiskTable(), "60px");
    AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>(SizeConverter.SizeUnit.GiB) {

        @Override
        protected Long getRawValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return (long) disk.getLun().getDeviceSize();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(sizeColumn, constants.devSizeSanStorage(), "70px");
    AbstractTextColumn<EntityModel> pathColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return String.valueOf(disk.getLun().getPathCount());
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(pathColumn, constants.pathSanStorage(), "40px");
    AbstractTextColumn<EntityModel> vendorIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getVendorId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(vendorIdColumn, constants.vendorIdSanStorage(), "70px");
    AbstractTextColumn<EntityModel> productIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getProductId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(productIdColumn, constants.productIdSanStorage(), "70px");
    AbstractTextColumn<EntityModel> serialColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getSerial();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(serialColumn, constants.serialSanStorage(), "70px");
    // $NON-NLS-1$
    lunDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
    lunDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
    "30px");
    lunDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    lunDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {

        @Override
        public ImageResource getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.isShareable() ? resources.shareableDiskIcon() : null;
        }

        @Override
        public SafeHtml getTooltip(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            if (disk.isShareable()) {
                return SafeHtmlUtils.fromSafeConstant(constants.shareable());
            }
            return null;
        }
    }, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
    "30px");
    // $NON-NLS-1$
    lunDiskTable.setWidth("100%");
    lunDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Aggregations

LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)62 Test (org.junit.Test)29 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)21 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)18 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)16 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)13 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)13 VM (org.ovirt.engine.core.common.businessentities.VM)10 ArrayList (java.util.ArrayList)9 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)7 Guid (org.ovirt.engine.core.compat.Guid)7 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)6 HashMap (java.util.HashMap)5 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 StorageServerConnectionManagementVDSParameters (org.ovirt.engine.core.common.vdscommands.StorageServerConnectionManagementVDSParameters)5 HashSet (java.util.HashSet)3 FullEntityOvfData (org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData)3 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)3 ImageResource (com.google.gwt.resources.client.ImageResource)2 List (java.util.List)2