Search in sources :

Example 1 with StorageDomainOvfInfo

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

the class CreateOvfVolumeForStorageDomainCommand method addStorageDomainOvfInfoToDb.

private void addStorageDomainOvfInfoToDb(Guid diskId) {
    StorageDomainOvfInfo storageDomainOvfInfo = new StorageDomainOvfInfo(getStorageDomainId(), null, diskId, StorageDomainOvfInfoStatus.DISABLED, null);
    storageDomainOvfInfoDao.save(storageDomainOvfInfo);
}
Also used : StorageDomainOvfInfo(org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo)

Example 2 with StorageDomainOvfInfo

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

the class ProcessOvfUpdateForStorageDomainCommand method populateStorageDomainOvfData.

private void populateStorageDomainOvfData() {
    List<StorageDomainOvfInfo> storageDomainOvfInfos = storageDomainOvfInfoDao.getAllForDomain(getStorageDomainId());
    ovfDiskCount = storageDomainOvfInfos.size();
    storageDomainOvfInfos.sort(OVF_INFO_COMPARATOR);
    for (StorageDomainOvfInfo storageDomainOvfInfo : storageDomainOvfInfos) {
        if (storageDomainOvfInfo.getStatus() != StorageDomainOvfInfoStatus.DISABLED) {
            DiskImage ovfDisk = (DiskImage) diskDao.get(storageDomainOvfInfo.getOvfDiskId());
            domainOvfStoresInfoForUpdate.add(new Pair<>(storageDomainOvfInfo, ovfDisk));
        }
    }
}
Also used : StorageDomainOvfInfo(org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 3 with StorageDomainOvfInfo

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

the class ProcessOvfUpdateForStoragePoolCommand method proccessDomainsForOvfUpdate.

protected void proccessDomainsForOvfUpdate(StoragePool pool) {
    List<StorageDomain> domainsInPool = storageDomainDao.getAllForStoragePool(pool.getId());
    for (StorageDomain domain : domainsInPool) {
        if (!domain.getStorageDomainType().isDataDomain() || (domain.getStatus() != StorageDomainStatus.Active && getParameters().getStorageDomainId() != null && !domain.getId().equals(getParameters().getStorageDomainId()))) {
            continue;
        }
        activeDataDomainsIds.add(domain.getId());
        Integer ovfStoresCountForDomain = Config.<Integer>getValue(ConfigValues.StorageDomainOvfStoreCount);
        List<StorageDomainOvfInfo> storageDomainOvfInfos = storageDomainOvfInfoDao.getAllForDomain(domain.getId());
        if (storageDomainOvfInfos.size() < ovfStoresCountForDomain) {
            proccessedDomains.add(domain.getId());
            continue;
        }
        for (StorageDomainOvfInfo storageDomainOvfInfo : storageDomainOvfInfos) {
            if (storageDomainOvfInfo.getStatus() == StorageDomainOvfInfoStatus.OUTDATED) {
                proccessedDomains.add(storageDomainOvfInfo.getStorageDomainId());
                break;
            }
        }
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainOvfInfo(org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo)

Example 4 with StorageDomainOvfInfo

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

the class ProcessOvfUpdateForStoragePoolCommandTest method performStoragePoolInitOps.

private void performStoragePoolInitOps(StoragePool pool) {
    executedUpdatedOvfGenerationIdsInDb = new HashMap<>();
    for (int i = 0; i < 2; i++) {
        Guid domainId = Guid.newGuid();
        StorageDomainOvfInfo ovfInfo = new StorageDomainOvfInfo(domainId, null, null, StorageDomainOvfInfoStatus.UPDATED, null);
        StorageDomain domain = new StorageDomain();
        domain.setId(domainId);
        domain.setStoragePoolIsoMapData(new StoragePoolIsoMap(domainId, pool.getId(), StorageDomainStatus.Active));
        poolDomainsOvfInfo.put(domainId, new Pair<>(Collections.singletonList(ovfInfo), domain));
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) Guid(org.ovirt.engine.core.compat.Guid) StorageDomainOvfInfo(org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo)

Example 5 with StorageDomainOvfInfo

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

the class StorageDomainOvfInfoDaoTest method updateOvfUpdatedInfoFewDomains.

@Test
public void updateOvfUpdatedInfoFewDomains() {
    StorageDomainOvfInfo ovfInfo = dao.get(getExistingEntityId());
    StorageDomainOvfInfo ovfInfo1 = dao.getAllForDomain(FixturesTool.STORAGE_DOMAIN_NFS2_2).get(0);
    assertNotSame("domain shouldn't be ovf updated prior to test", StorageDomainOvfInfoStatus.UPDATED, ovfInfo1.getStatus());
    assertNotSame("domain shouldn't be ovf updated prior to test", StorageDomainOvfInfoStatus.UPDATED, ovfInfo.getStatus());
    dao.updateOvfUpdatedInfo(Arrays.asList(ovfInfo.getStorageDomainId(), ovfInfo1.getStorageDomainId()), StorageDomainOvfInfoStatus.UPDATED, StorageDomainOvfInfoStatus.DISABLED);
    ovfInfo = dao.get(ovfInfo.getOvfDiskId());
    ovfInfo1 = dao.get(ovfInfo1.getOvfDiskId());
    assertEquals(StorageDomainOvfInfoStatus.UPDATED, ovfInfo.getStatus());
    assertEquals(StorageDomainOvfInfoStatus.UPDATED, ovfInfo1.getStatus());
}
Also used : StorageDomainOvfInfo(org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo) Test(org.junit.Test)

Aggregations

StorageDomainOvfInfo (org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo)13 Guid (org.ovirt.engine.core.compat.Guid)7 Test (org.junit.Test)6 LinkedList (java.util.LinkedList)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)2 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 CollectionUtils (org.apache.commons.collections.CollectionUtils)1 Assert.assertEquals (org.junit.Assert.assertEquals)1