use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class UpdateStoragePoolCommand method updateStoragePoolFormatType.
private void updateStoragePoolFormatType() {
final StoragePool storagePool = getStoragePool();
final Guid spId = storagePool.getId();
final Version spVersion = storagePool.getCompatibilityVersion();
final Version oldSpVersion = getOldStoragePool().getCompatibilityVersion();
if (oldSpVersion.equals(spVersion)) {
return;
}
StorageFormatType targetFormat = updatePoolAndDomainsFormat(spVersion);
if (getOldStoragePool().getStatus() == StoragePoolStatus.Up) {
try {
// No need to worry about "reupgrading" as VDSM will silently ignore
// the request.
runVdsCommand(VDSCommandType.UpgradeStoragePool, new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat));
} catch (EngineException e) {
log.warn("Upgrade process of Storage Pool '{}' has encountered a problem due to following reason: {}", spId, e.getMessage());
auditLogDirector.log(this, AuditLogType.UPGRADE_STORAGE_POOL_ENCOUNTERED_PROBLEMS);
// and return.
if (e.getVdsError() != null && e.getErrorCode() == EngineError.PoolUpgradeInProgress) {
updatePoolAndDomainsFormat(oldSpVersion);
return;
}
}
}
runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), new ArrayList<Guid>());
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class RecoveryStoragePoolCommand method executeCommand.
@Override
protected void executeCommand() {
StorageDomain newMasterDomain = loadTargetedMasterDomain();
if (storageHelperDirector.getItem(newMasterDomain.getStorageType()).connectStorageToDomainByVdsId(newMasterDomain, getVds().getId())) {
getEventQueue().submitEventSync(new Event(getParameters().getStoragePoolId(), getParameters().getNewMasterDomainId(), null, EventType.RECOVERY, ""), () -> {
getParameters().setStorageDomainId(getMasterDomainIdFromDb());
StoragePoolIsoMap domainPoolMap = new StoragePoolIsoMap(getParameters().getNewMasterDomainId(), getParameters().getStoragePoolId(), StorageDomainStatus.Active);
storagePoolIsoMapDao.save(domainPoolMap);
getParameters().setVdsId(getVds().getId());
ActionReturnValue returnVal = runInternalAction(ActionType.ReconstructMasterDomain, getParameters(), cloneContextAndDetachFromParent());
boolean reconstructVerbExecuted = (returnVal.getActionReturnValue() != null) ? (Boolean) returnVal.getActionReturnValue() : false;
storagePoolDao.updateStatus(getStoragePool().getId(), StoragePoolStatus.NonResponsive);
if (!reconstructVerbExecuted) {
storagePoolIsoMapDao.remove(domainPoolMap.getId());
}
if (returnVal.getSucceeded()) {
updateStorageDomainFormatIfNeeded(loadTargetedMasterDomain());
}
setSucceeded(returnVal.getSucceeded());
return new EventResult(reconstructVerbExecuted, EventType.RECONSTRUCT);
});
} else {
getReturnValue().setFault(new EngineFault(new EngineException(EngineError.StorageServerConnectionError, "Failed to connect storage"), EngineError.StorageServerConnectionError));
}
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class ExternalNetworkManager method deallocateIfExternal.
/**
* Deallocate the vNIC from the external network, if it's attached to a network and the network is indeed an
* external network (otherwise, nothing is done).
*/
public void deallocateIfExternal() {
if (getNetwork() != null && getNetwork().isExternal()) {
Provider<?> provider = providerDao.get(getNetwork().getProvidedBy().getProviderId());
NetworkProviderProxy providerProxy = providerProxyFactory.create(provider);
try {
providerProxy.deallocate(nic);
} catch (EngineException e) {
AuditLogable removePortFailureEvent = new AuditLogableImpl();
removePortFailureEvent.addCustomValue("NicName", nic.getName());
removePortFailureEvent.addCustomValue("NicId", nic.getId().toString());
removePortFailureEvent.addCustomValue("ProviderName", provider.getName());
auditLogDirector.log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED);
}
}
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class AddNetworkParametersBuilder method buildParameters.
public ArrayList<ActionParametersBase> buildParameters(Network network, List<VdsNetworkInterface> nics) {
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (VdsNetworkInterface nic : nics) {
PersistentHostSetupNetworksParameters setupNetworkParams = createHostSetupNetworksParameters(nic.getVdsId());
setupNetworkParams.setNetworkNames(network.getName());
VdsNetworkInterface nicToConfigure = getNicToConfigure(getNics(nic.getVdsId()), nic.getId());
if (nicToConfigure == null) {
throw new EngineException(EngineError.LABELED_NETWORK_INTERFACE_NOT_FOUND);
}
NetworkAttachment networkAttachment = new NetworkAttachment(nicToConfigure, network, NetworkUtils.createIpConfigurationFromVdsNetworkInterface(getVlanDevice(nicToConfigure, network.getVlanId())));
setupNetworkParams.getNetworkAttachments().add(networkAttachment);
addBootProtocolForRoleNetworkAttachment(nicToConfigure, network, networkAttachment);
parameters.add(setupNetworkParams);
}
return parameters;
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class ExportVmCommand method moveOrCopyAllImageGroups.
@Override
protected void moveOrCopyAllImageGroups(Guid containerID, Iterable<DiskImage> disks) {
for (DiskImage disk : disks) {
ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForDisk(containerID, disk));
if (!vdcRetValue.getSucceeded()) {
throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand");
}
// TODO: Currently REST-API doesn't support coco for async commands, remove when bug 1199011 fixed
getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList());
}
}
Aggregations