Search in sources :

Example 31 with StorageDomain

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

the class BlockStorageDiscardFunctionalityHelperTest method createStorageDomain.

private void createStorageDomain() {
    storageDomain = new StorageDomain();
    storageDomain.setId(Guid.newGuid());
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain)

Example 32 with StorageDomain

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

the class DiskValidatorTest method canCopyDiskFails.

@Test
public void canCopyDiskFails() {
    StorageDomain domain = createStorageDomainForDisk(StorageType.ISCSI);
    domain.setStorageFormat(StorageFormatType.V3);
    disk.setSize(1000);
    DiskImage child = createDiskImage();
    child.setSize(1000);
    child.setStorageIds(Collections.singletonList(domain.getId()));
    DiskImage parent = createDiskImage();
    parent.setId(Guid.newGuid());
    parent.setSize(500);
    parent.setStorageIds(Collections.singletonList(domain.getId()));
    child.setParentId(parent.getParentId());
    List<DiskImage> diskImages = new ArrayList<>(2);
    diskImages.add(parent);
    diskImages.add(child);
    when(validator.getDiskImageDao().getAllSnapshotsForImageGroup(disk.getId())).thenReturn(diskImages);
    assertThat(diskImagesValidator.childDiskWasExtended(domain), failsWith(EngineMessage.CANNOT_MOVE_DISK_SNAPSHOTS));
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 33 with StorageDomain

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

the class DiskVmElementDiscardSupportValidatorTest method initDiskStorageDomain.

private void initDiskStorageDomain(StorageType storageType, Boolean sdSupportsDiscard) {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setStorageName(storageDomainName);
    storageDomain.setStorageType(storageType);
    storageDomain.setSupportsDiscard(sdSupportsDiscard);
    storageDomainId = Guid.newGuid();
    storageDomain.setId(storageDomainId);
    initMocks(this);
    injectorRule.bind(StorageDomainDao.class, storageDomainDao);
    when(storageDomainDao.get(storageDomainId)).thenReturn(storageDomain);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain)

Example 34 with StorageDomain

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

the class MultipleStorageDomainsValidatorTest method setUp.

@Before
public void setUp() {
    Guid spId = Guid.newGuid();
    sdId1 = Guid.newGuid();
    sdId2 = Guid.newGuid();
    sdId3 = Guid.newGuid();
    domain1 = new StorageDomain();
    domain1.setId(sdId1);
    domain1.setStoragePoolId(spId);
    domain2 = new StorageDomain();
    domain2.setId(sdId2);
    domain2.setStoragePoolId(spId);
    domain3 = new StorageDomain();
    domain3.setId(sdId3);
    domain3.setStoragePoolId(spId);
    when(dao.getForStoragePool(sdId1, spId)).thenReturn(domain1);
    when(dao.getForStoragePool(sdId2, spId)).thenReturn(domain2);
    when(dao.getForStoragePool(sdId3, spId)).thenReturn(domain3);
    validator = spy(new MultipleStorageDomainsValidator(spId, Arrays.asList(sdId1, sdId2, sdId3)));
    doReturn(dao).when(validator).getStorageDomainDao();
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Guid(org.ovirt.engine.core.compat.Guid) Before(org.junit.Before)

Example 35 with StorageDomain

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

the class StorageConnectionValidatorTest method setUp.

@Before
public void setUp() {
    connection = new StorageServerConnections();
    connection.setId(CONNECTION_ID_FOR_VALIDATION);
    connection.setStorageType(StorageType.ISCSI);
    validator = spy(new StorageConnectionValidator(connection));
    domain = new StorageDomain();
    domain.setStorageType(StorageType.ISCSI);
    domain.setId(Guid.newGuid());
    domain.setStatus(StorageDomainStatus.Maintenance);
    domain.setStorageDomainSharedStatus(StorageDomainSharedStatus.Inactive);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Before(org.junit.Before)

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