Search in sources :

Example 91 with StorageDomain

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

the class AddVmCommandTestBase method createStorageDomain.

protected StorageDomain createStorageDomain(Guid sdId) {
    StorageDomain sd = new StorageDomain();
    sd.setStorageDomainType(StorageDomainType.Data);
    sd.setStatus(StorageDomainStatus.Active);
    sd.setId(sdId);
    return sd;
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain)

Example 92 with StorageDomain

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

the class AddVmCommandTestBase method initDestSDs.

private void initDestSDs() {
    StorageDomain sd1 = new StorageDomain();
    StorageDomain sd2 = new StorageDomain();
    sd1.setId(STORAGE_DOMAIN_ID_1);
    sd2.setId(STORAGE_DOMAIN_ID_2);
    sd1.setStatus(StorageDomainStatus.Active);
    sd2.setStatus(StorageDomainStatus.Active);
    cmd.destStorages.put(STORAGE_DOMAIN_ID_1, sd1);
    cmd.destStorages.put(STORAGE_DOMAIN_ID_2, sd2);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain)

Example 93 with StorageDomain

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

the class ImportValidator method validateStorageExistsForMemoryDisks.

public ValidationResult validateStorageExistsForMemoryDisks(List<Snapshot> snapshots, boolean allowPartial, Map<Guid, String> failedDisksToImport) {
    for (Snapshot snap : snapshots) {
        if (snap.containsMemory()) {
            DiskImage memoryDump = (DiskImage) getDiskDao().get(snap.getMemoryDiskId());
            StorageDomain dumpSd = getStorageDomainDao().getForStoragePool(memoryDump.getStorageIds().get(0), params.getStoragePoolId());
            ValidationResult dumpSdResult = new StorageDomainValidator(dumpSd).isDomainExistAndActive();
            if (!handleStorageValidationResult(dumpSdResult, memoryDump, snap, failedDisksToImport) && !allowPartial) {
                return dumpSdResult;
            }
            DiskImage memoryConf = (DiskImage) getDiskDao().get(snap.getMetadataDiskId());
            StorageDomain confSd = getStorageDomainDao().getForStoragePool(memoryConf.getStorageIds().get(0), params.getStoragePoolId());
            ValidationResult confSdResult = new StorageDomainValidator(confSd).isDomainExistAndActive();
            if (!handleStorageValidationResult(confSdResult, memoryConf, snap, failedDisksToImport) && !allowPartial) {
                return confSdResult;
            }
        }
    }
    return ValidationResult.VALID;
}
Also used : Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainValidator(org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 94 with StorageDomain

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

the class UpdateVmDiskCommandTest method addNewStorageDomainToDisk.

private StorageDomain addNewStorageDomainToDisk(DiskImage diskImage, StorageType storageType) {
    StorageDomain storage = new StorageDomain();
    storage.setId(Guid.newGuid());
    storage.setStorageType(storageType);
    storage.setStatus(StorageDomainStatus.Active);
    diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storage.getId())));
    return storage;
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain)

Example 95 with StorageDomain

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

the class UpdateVmDiskCommandTest method testInvalidDiskExtend.

@Test
public void testInvalidDiskExtend() {
    DiskImage oldDiskImage = createDiskImage();
    oldDiskImage.setSize(SizeConverter.convert(8L, SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
    DiskImage newDiskImage = createDiskImage();
    newDiskImage.setSize(SizeConverter.convert(10L, SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
    command.getParameters().setDiskVmElement(new DiskVmElement(newDiskImage.getId(), vmId));
    command.getParameters().setDiskInfo(newDiskImage);
    when(diskDao.get(diskImageGuid)).thenReturn(oldDiskImage);
    initializeCommand();
    StorageDomain sd = new StorageDomain();
    sd.setId(Guid.newGuid());
    sd.setStorageType(StorageType.ISCSI);
    when(storageDomainDao.get(any())).thenReturn(sd);
    ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DISK_MAX_SIZE_EXCEEDED);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

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