Search in sources :

Example 1 with StorageDomainPoolParametersBase

use of org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase in project ovirt-engine by oVirt.

the class AddStoragePoolWithStoragesCommand method activateStorageDomains.

private boolean activateStorageDomains() {
    boolean returnValue = true;
    for (final Guid storageDomainId : getParameters().getStorages()) {
        StorageDomainPoolParametersBase activateParameters = new StorageDomainPoolParametersBase(storageDomainId, getStoragePool().getId());
        activateParameters.setSessionId(getParameters().getSessionId());
        activateParameters.setTransactionScopeOption(TransactionScopeOption.RequiresNew);
        returnValue = Backend.getInstance().runInternalAction(ActionType.ActivateStorageDomain, activateParameters).getSucceeded();
        // if activate domain failed then set domain status to inactive
        if (!returnValue) {
            TransactionSupport.executeInNewTransaction(() -> {
                storagePoolIsoMapDao.updateStatus(new StoragePoolIsoMapId(storageDomainId, getStoragePool().getId()), StorageDomainStatus.Inactive);
                return null;
            });
        }
    }
    return returnValue;
}
Also used : StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) StoragePoolIsoMapId(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId) Guid(org.ovirt.engine.core.compat.Guid)

Example 2 with StorageDomainPoolParametersBase

use of org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase in project ovirt-engine by oVirt.

the class StorageDataCenterListModel method activate.

private void activate() {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        StorageDomain a = (StorageDomain) item;
        StorageDomainPoolParametersBase parameters = new StorageDomainPoolParametersBase();
        parameters.setStorageDomainId(getEntity().getId());
        if (a.getStoragePoolId() != null) {
            parameters.setStoragePoolId(a.getStoragePoolId());
        }
        list.add(parameters);
    }
    Frontend.getInstance().runMultipleAction(ActionType.ActivateStorageDomain, list, result -> {
    }, null);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with StorageDomainPoolParametersBase

use of org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase in project ovirt-engine by oVirt.

the class AutoRecoveryManager method recoverImpl.

public void recoverImpl() {
    check(vdsDao, ActionType.ActivateVds, arg -> {
        final VdsActionParameters params = new VdsActionParameters(arg.getId());
        params.setRunSilent(true);
        return params;
    }, list -> {
        List<VDS> filtered = new ArrayList<>(list.size());
        List<VdsNetworkInterface> nics;
        for (VDS vds : list) {
            if (vds.getNonOperationalReason() == NonOperationalReason.NETWORK_INTERFACE_IS_DOWN) {
                backend.getResourceManager().runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(vds));
                nics = vds.getInterfaces();
            } else {
                nics = interfaceDao.getAllInterfacesForVds(vds.getId());
            }
            Map<String, Set<String>> problematicNics = NetworkMonitoringHelper.determineProblematicNics(nics, networkDao.getAllForCluster(vds.getClusterId()));
            if (problematicNics.isEmpty()) {
                filtered.add(vds);
            }
        }
        return filtered;
    }, "hosts");
    check(storageDomainDao, ActionType.ConnectDomainToStorage, arg -> {
        final StorageDomainPoolParametersBase params = new StorageDomainPoolParametersBase(arg.getId(), arg.getStoragePoolId());
        params.setRunSilent(true);
        return params;
    }, list -> list, "storage domains");
}
Also used : Set(java.util.Set) VDS(org.ovirt.engine.core.common.businessentities.VDS) VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) ArrayList(java.util.ArrayList) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 4 with StorageDomainPoolParametersBase

use of org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase in project ovirt-engine by oVirt.

the class AttachStorageDomainsMultipleActionRunner method execute.

@Override
public List<ActionReturnValue> execute() {
    Iterator<?> iterator = getParameters() == null ? null : getParameters().iterator();
    Object parameter = iterator != null && iterator.hasNext() ? iterator.next() : null;
    if (parameter instanceof StorageDomainPoolParametersBase) {
        StorageDomainPoolParametersBase storagePoolParameter = (StorageDomainPoolParametersBase) parameter;
        StoragePool pool = storagePoolDao.get(storagePoolParameter.getStoragePoolId());
        if (pool.getStatus() == StoragePoolStatus.Uninitialized) {
            List<Guid> storageDomainIds = new ArrayList<>();
            for (ActionParametersBase param : getParameters()) {
                storageDomainIds.add(((StorageDomainPoolParametersBase) param).getStorageDomainId());
            }
            List<ActionParametersBase> parameters = new ArrayList<>();
            parameters.add(new StoragePoolWithStoragesParameter(pool, storageDomainIds, storagePoolParameter.getSessionId()));
            if (isInternal) {
                return backend.runInternalMultipleActions(ActionType.AddStoragePoolWithStorages, parameters);
            } else {
                return backend.runMultipleActions(ActionType.AddStoragePoolWithStorages, parameters, false);
            }
        } else {
            return super.execute();
        }
    } else {
        return super.execute();
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) StoragePoolWithStoragesParameter(org.ovirt.engine.core.common.action.StoragePoolWithStoragesParameter) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 5 with StorageDomainPoolParametersBase

use of org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase in project ovirt-engine by oVirt.

the class DeactivateStorageDomainWithOvfUpdateCommand method executeDeactivateCommand.

private void executeDeactivateCommand() {
    final StorageDomainPoolParametersBase params = new StorageDomainPoolParametersBase(getStorageDomainId(), getStoragePoolId());
    params.setSkipChecks(true);
    params.setSkipLock(true);
    params.setShouldBeLogged(true);
    runInternalAction(ActionType.DeactivateStorageDomain, params, ExecutionHandler.createInternalJobContext(getContext()));
}
Also used : StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase)

Aggregations

StorageDomainPoolParametersBase (org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase)7 ArrayList (java.util.ArrayList)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 Guid (org.ovirt.engine.core.compat.Guid)2 Set (java.util.Set)1 StoragePoolWithStoragesParameter (org.ovirt.engine.core.common.action.StoragePoolWithStoragesParameter)1 VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 StoragePoolIsoMapId (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 EventResult (org.ovirt.engine.core.common.eventqueue.EventResult)1 VdsIdAndVdsVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase)1