Search in sources :

Example 36 with StorageDomain

use of org.ovirt.engine.core.common.businessentities.StorageDomain 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 37 with StorageDomain

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

the class StorageDomainValidatorTest method mockStorageDomain.

private static StorageDomain mockStorageDomain(int availableSize, int usedSize, StorageType storageType) {
    StorageDomain sd = new StorageDomain();
    sd.setAvailableDiskSize(availableSize);
    sd.setUsedDiskSize(usedSize);
    sd.setStatus(StorageDomainStatus.Active);
    sd.setStorageType(storageType);
    sd.setCriticalSpaceActionBlocker(CRITICAL_SPACE_THRESHOLD);
    return sd;
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain)

Example 38 with StorageDomain

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

the class RunVmValidatorTest method testNoIsoDomainIsoOnDataDomain.

@Test
public void testNoIsoDomainIsoOnDataDomain() {
    VM vm = new VM();
    vm.setStoragePoolId(Guid.newGuid());
    vm.setBootSequence(BootSequence.CD);
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(Guid.newGuid());
    DiskImage diskImage = new DiskImage();
    diskImage.setStorageIds(Collections.singletonList(storageDomain.getId()));
    diskImage.setContentType(DiskContentType.ISO);
    when(diskDao.get(any(Guid.class))).thenReturn(diskImage);
    when(storagePoolIsoMapDao.get(new StoragePoolIsoMapId(storageDomain.getId(), vm.getStoragePoolId()))).thenReturn(null);
    validateResult(runVmValidator.validateIsoPath(vm, Guid.newGuid().toString(), null, null), false, EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VM(org.ovirt.engine.core.common.businessentities.VM) StoragePoolIsoMapId(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 39 with StorageDomain

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

the class AbstractSyncStorageDomainsLunsCommandTest method setUp.

@Before
public void setUp() {
    blockSd1Id = Guid.newGuid();
    String sd1Name = "vg1";
    blockSd1 = new StorageDomain();
    blockSd1.setId(blockSd1Id);
    blockSd1.setStorageType(StorageType.ISCSI);
    blockSd1.setStatus(StorageDomainStatus.Active);
    blockSd1.setStorage(sd1Name);
    blockSd1Lun1 = new LUNs();
    blockSd1Lun1.setId("blockSd1Lun1");
    blockSd1Lun1.setVolumeGroupId(sd1Name);
    blockSd1Lun1.setStorageDomainId(blockSd1Id);
    blockSd2Id = Guid.newGuid();
    String sd2Name = "vg2";
    blockSd2 = new StorageDomain();
    blockSd2.setId(blockSd2Id);
    blockSd2.setStorageType(StorageType.FCP);
    blockSd2.setStatus(StorageDomainStatus.Active);
    blockSd2.setStorage(sd2Name);
    blockSd2Lun1 = new LUNs();
    blockSd2Lun1.setId("blockSd2Lun1");
    blockSd2Lun2 = new LUNs();
    blockSd2Lun2.setId("blockSd2Lun2");
    blockSd2Lun1.setVolumeGroupId(sd2Name);
    blockSd2Lun1.setStorageDomainId(blockSd2Id);
    blockSd2Lun2.setVolumeGroupId(sd2Name);
    blockSd2Lun2.setStorageDomainId(blockSd2Id);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Before(org.junit.Before)

Example 40 with StorageDomain

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

the class SyncAllStorageDomainsLunsCommandTest method getStorageDomainsToSync.

@Test
public void getStorageDomainsToSync() {
    StorageDomain validSd = new StorageDomain();
    validSd.setId(Guid.newGuid());
    validSd.setStorageType(StorageType.ISCSI);
    validSd.setStatus(StorageDomainStatus.Active);
    StorageDomain nfsSd = new StorageDomain();
    nfsSd.setId(Guid.newGuid());
    nfsSd.setStorageType(StorageType.NFS);
    StorageDomain inactiveIscsiSd = new StorageDomain();
    inactiveIscsiSd.setId(Guid.newGuid());
    inactiveIscsiSd.setStorageType(StorageType.ISCSI);
    inactiveIscsiSd.setStatus(StorageDomainStatus.Inactive);
    List<StorageDomain> storageDomains = Arrays.asList(validSd, inactiveIscsiSd, nfsSd);
    when(storageDomainDao.getAllForStoragePool(storagePoolId)).thenReturn(storageDomains);
    assertEquals(Collections.singletonList(validSd), command.getStorageDomainsToSync().collect(Collectors.toList()));
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Test(org.junit.Test)

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