Search in sources :

Example 1 with StorageType

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

the class ImportVmCommand method addVmExternalLuns.

protected void addVmExternalLuns() {
    if (getParameters().getVm().getDiskMap() != null) {
        List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getParameters().getVm().getDiskMap().values());
        for (LunDisk lun : lunDisks) {
            StorageType storageType = StorageType.UNKNOWN;
            if (lun.getLun().getLunConnections() != null && !lun.getLun().getLunConnections().isEmpty()) {
                // We set the storage type based on the first connection since connections should be with the same
                // storage type
                storageType = lun.getLun().getLunConnections().get(0).getStorageType();
            }
            lunHelper.proceedDirectLUNInDb(lun.getLun(), storageType);
            // Only if the LUN disk does not exists in the setup add it.
            if (baseDiskDao.get(lun.getId()) == null) {
                baseDiskDao.save(lun);
            }
            if (diskLunMapDao.get(new DiskLunMapId(lun.getId(), lun.getLun().getLUNId())) == null) {
                diskLunMapDao.save(new DiskLunMap(lun.getId(), lun.getLun().getLUNId()));
            }
            // Add disk VM element to attach the disk to the VM.
            DiskVmElement diskVmElement = lun.getDiskVmElementForVm(getVmId());
            diskVmElementDao.save(diskVmElement);
            getVmDeviceUtils().addDiskDevice(getVmId(), lun.getId(), diskVmElement.isPlugged(), diskVmElement.isReadOnly());
        }
    }
}
Also used : StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) DiskLunMapId(org.ovirt.engine.core.common.businessentities.storage.DiskLunMapId) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) DiskLunMap(org.ovirt.engine.core.common.businessentities.storage.DiskLunMap)

Example 2 with StorageType

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

the class ConnectHostToStoragePoolServersCommand method connectStorageServer.

private boolean connectStorageServer(Map<StorageType, List<StorageServerConnections>> connectionsByType) {
    boolean connectSucceeded = true;
    for (Map.Entry<StorageType, List<StorageServerConnections>> connectionToType : connectionsByType.entrySet()) {
        StorageType connectionsType = connectionToType.getKey();
        List<StorageServerConnections> connections = connectionToType.getValue();
        connectSucceeded = connectStorageServersByType(connectionsType, connections) && connectSucceeded;
    }
    if (cinderStorageHelper.isActiveCinderDomainAvailable(getStoragePool().getId())) {
        connectSucceeded &= cinderStorageHelper.prepareConnectHostToStoragePoolServers(getContext(), getParameters(), null);
    }
    log.info("Host '{}' storage connection was {} ", getVds().getName(), connectSucceeded ? "succeeded" : "failed");
    return connectSucceeded;
}
Also used : StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) List(java.util.List) Map(java.util.Map)

Example 3 with StorageType

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

the class StorageDomainValidatorFreeSpaceTest method createParams.

@Parameterized.Parameters
public static Collection<Object[]> createParams() {
    List<Object[]> params = new ArrayList<>();
    for (StorageType storageType : StorageType.values()) {
        if (storageType.isConcreteStorageType() && !storageType.isCinderDomain()) {
            List<VolumeType> volumeTypes = storageType.isFileDomain() ? Arrays.asList(VolumeType.Preallocated, VolumeType.Sparse) : Collections.singletonList(VolumeType.Preallocated);
            for (VolumeType volumeType : volumeTypes) {
                for (VolumeFormat volumeFormat : new VolumeFormat[] { VolumeFormat.COW, VolumeFormat.RAW }) {
                    DiskImage disk = new DiskImage();
                    disk.setVolumeFormat(volumeFormat);
                    disk.setVolumeType(volumeType);
                    disk.getSnapshots().add(disk);
                    disk.setSizeInGigabytes(200);
                    // GB
                    disk.setActualSize(100);
                    StorageDomain sd = new StorageDomain();
                    sd.setStorageType(storageType);
                    // GB
                    sd.setAvailableDiskSize(107);
                    params.add(new Object[] { disk, sd, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.COW || volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse });
                }
            }
        }
    }
    return params;
}
Also used : VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 4 with StorageType

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

the class AbstractDiskModel method volumeType_SelectedItemChanged.

protected void volumeType_SelectedItemChanged() {
    if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) {
        return;
    }
    VolumeType volumeType = getVolumeType().getSelectedItem();
    StorageType storageType = getStorageDomain().getSelectedItem().getStorageType();
    updateShareable(volumeType, storageType);
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) CinderVolumeType(org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)

Example 5 with StorageType

use of org.ovirt.engine.core.common.businessentities.storage.StorageType 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)

Aggregations

StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)26 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)8 ArrayList (java.util.ArrayList)7 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)7 List (java.util.List)6 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)6 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)5 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)5 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)5 Guid (org.ovirt.engine.core.compat.Guid)5 ActionType (org.ovirt.engine.core.common.action.ActionType)3 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)3 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 AttachStorageDomainToPoolParameters (org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)2 RemoveStorageDomainParameters (org.ovirt.engine.core.common.action.RemoveStorageDomainParameters)2 StorageDomainSharedStatus (org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)2