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;
}
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);
}
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");
}
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();
}
}
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()));
}
Aggregations