Search in sources :

Example 1 with StorageDomainStatus

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

the class StorageDomainCommandBase method checkStorageDomainStatus.

protected boolean checkStorageDomainStatus(Set<StorageDomainStatus> statuses) {
    boolean valid = false;
    StorageDomainStatus status = getStorageDomainStatus();
    if (status != null) {
        valid = statuses.contains(status);
    }
    if (!valid) {
        if (status != null && status.isStorageDomainInProcess()) {
            return failValidation(EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED);
        }
        addStorageDomainStatusIllegalMessage();
    }
    return valid;
}
Also used : StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus)

Example 2 with StorageDomainStatus

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

the class StorageDomainCommandBase method addStorageDomainStatusIllegalMessage.

protected void addStorageDomainStatusIllegalMessage() {
    addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2);
    StorageDomainStatus status = getStorageDomainStatus();
    StorageDomainSharedStatus sharedStatus = getStorageDomainSharedStatus();
    Object messageParameter = status;
    if (status == StorageDomainStatus.Unknown && sharedStatus != null) {
        // We got more informative information than "Unknown".
        messageParameter = sharedStatus;
    }
    addValidationMessageVariable("status", messageParameter);
}
Also used : StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)

Example 3 with StorageDomainStatus

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

the class StorageDomainStaticDaoImpl method getAllIds.

@Override
public List<Guid> getAllIds(Guid pool, StorageDomainStatus status) {
    MapSqlParameterSource parameterSource = getStoragePoolIdParameterSource(pool).addValue("status", status.getValue());
    RowMapper<Guid> mapper = (rs, rowNum) -> getGuidDefaultEmpty(rs, "storage_id");
    return getCallsHandler().executeReadList("GetStorageDomainIdsByStoragePoolIdAndStatus", mapper, parameterSource);
}
Also used : StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) List(java.util.List) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Guid(org.ovirt.engine.core.compat.Guid) RowMapper(org.springframework.jdbc.core.RowMapper) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) Named(javax.inject.Named) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Singleton(javax.inject.Singleton) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) Guid(org.ovirt.engine.core.compat.Guid)

Example 4 with StorageDomainStatus

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

the class IsoDomainListSynchronizer method refreshIsoDomain.

/**
 * The procedure Try to refresh the repository files of the storage domain id, By iterate over the storage pools of
 * this domain, and try to choose a valid storage pool, to fetch the repository files from the VDSM, and refresh the
 * cached table. <BR/>
 * If succeeded, will return True. Otherwise return false with updated list of problematic repository files with the
 * storage pool, storage domain, and file type, that could not complete the cache update transaction.
 *
 * @param storageDomainId
 *            - The Repository domain Id, we want to refresh.
 * @param problematicRepoFileList
 *            - List of business entities, each one indicating the problematic entity.
 * @param imageType
 *            - The imageType we want to fetch the files from the cache.
 * @return Boolean value indicating if the refresh succeeded or not.
 */
private boolean refreshIsoDomain(Guid storageDomainId, List<RepoImage> problematicRepoFileList, ImageFileType imageType) {
    List<StoragePoolIsoMap> isoMapList = fetchAllStoragePoolsForIsoDomain(storageDomainId, imageType);
    for (StoragePoolIsoMap storagePoolIsoMap : isoMapList) {
        Guid storagePoolId = storagePoolIsoMap.getStoragePoolId();
        StorageDomainStatus status = storagePoolIsoMap.getStatus();
        if (StorageDomainStatus.Active != status) {
            handleInactiveStorageDomain(storageDomainId, imageType, status);
        } else {
            // Try to refresh the domain of the storage pool id because its status is active.
            boolean refreshOk = refreshIsoDomainFileForStoragePool(storageDomainId, storagePoolId, imageType);
            if (!refreshOk) {
                log.debug("Failed refreshing Storage domain id '{}', for '{}' file type in storage pool id '{}'.", storageDomainId, imageType, storagePoolId);
                // Add the repository file to the list of problematic Iso domains.
                RepoImage repoImage = createMockRepositoryFileMetaData(storageDomainId, imageType, storagePoolId);
                problematicRepoFileList.add(repoImage);
                return false;
            }
        }
    }
    return true;
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) Guid(org.ovirt.engine.core.compat.Guid) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus)

Aggregations

StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)4 Guid (org.ovirt.engine.core.compat.Guid)2 List (java.util.List)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1 StorageDomainSharedStatus (org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)1 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)1 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)1 StorageFormatType (org.ovirt.engine.core.common.businessentities.StorageFormatType)1 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)1 RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)1 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)1 RowMapper (org.springframework.jdbc.core.RowMapper)1 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)1