use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class ChangeVDSClusterCommand method configureNetworks.
private void configureNetworks() {
final PersistentHostSetupNetworksParameters params;
try {
params = changeClusterParametersBuilder.buildParameters(getVdsId(), getSourceCluster().getId(), getTargetCluster().getId());
} catch (EngineException e) {
auditLogDirector.log(this, AuditLogType.CONFIGURE_NETWORK_BY_LABELS_WHEN_CHANGING_CLUSTER_FAILED);
return;
}
ThreadPoolUtil.execute(() -> runInternalAction(ActionType.PersistentHostSetupNetworks, params, cloneContextAndDetachFromParent()));
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class HibernateVmCommand method addDisk.
private void addDisk(DiskImage disk) {
ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.AddDisk, buildAddDiskParameters(disk));
if (!returnValue.getSucceeded()) {
throw new EngineException(returnValue.getFault().getError(), String.format("Failed to create disk! %s", disk.getDiskAlias()));
}
getTaskIdList().addAll(returnValue.getInternalVdsmTaskIdList());
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class HibernateVmCommand method endSuccessfully.
@Override
protected void endSuccessfully() {
if (getVm().getStatus() != VMStatus.Up) {
log.warn("VM '{}' is not up, cannot Hibernate.", getVm().getName());
endWithFailure();
return;
}
List<ActionReturnValue> addDiskReturnValues = endActionOnDisks();
DiskImage dumpDisk = getMemoryDumpDisk(addDiskReturnValues);
DiskImage metadataDisk = getMemoryMetadataDisk(addDiskReturnValues);
String hiberVol = MemoryUtils.createMemoryStateString(getStorageDomainId(), getStoragePoolId(), dumpDisk.getId(), dumpDisk.getImageId(), metadataDisk.getId(), metadataDisk.getImageId());
try {
runVdsCommand(VDSCommandType.Hibernate, new HibernateVDSCommandParameters(getVm().getRunOnVds(), getVmId(), hiberVol));
snapshotDao.updateHibernationMemory(getVmId(), dumpDisk.getId(), metadataDisk.getId());
} catch (EngineException e) {
hibernateVdsProblematic = true;
endWithFailure();
return;
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class GetVmFromOvaQuery method runAnsibleQueryOvaInfoPlaybook.
private String runAnsibleQueryOvaInfoPlaybook() {
String hostname = vdsStaticDao.get(getParameters().getVdsId()).getHostName();
AnsibleCommandBuilder command = new AnsibleCommandBuilder().hostnames(hostname).variables(new Pair<>("ovirt_query_ova_path", getParameters().getPath())).logFileDirectory(ExtractOvaCommand.IMPORT_OVA_LOG_DIRECTORY).logFilePrefix("ovirt-query-ova-ansible").logFileName(hostname).verboseLevel(AnsibleVerbosity.LEVEL0).stdoutCallback(AnsibleConstants.OVA_QUERY_CALLBACK_PLUGIN).playbook(AnsibleConstants.QUERY_OVA_PLAYBOOK);
boolean succeeded = false;
AnsibleReturnValue ansibleReturnValue = null;
try {
ansibleReturnValue = ansibleExecutor.runCommand(command);
succeeded = ansibleReturnValue.getAnsibleReturnCode() == AnsibleReturnCode.OK;
} catch (IOException | InterruptedException e) {
log.debug("Failed to query OVA info", e);
}
if (!succeeded) {
log.error("Failed to query OVA info");
throw new EngineException(EngineError.GeneralException, "Failed to query OVA info");
}
return ansibleReturnValue.getStdout();
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class GetSignedWebsocketProxyTicketQuery method getGraphicsInfo.
private GraphicsInfo getGraphicsInfo() {
final VM vm = vmDao.get(getParameters().getVmId(), getUserID(), getParameters().isFiltered());
if (vm == null) {
throw new EngineException(EngineError.VMCantBeObtained, String.format("vmid=%s", getParameters().getVmId()));
}
final GraphicsInfo graphicsInfo = vm.getGraphicsInfos().get(getParameters().getGraphicsType());
if (graphicsInfo == null) {
throw new EngineException(EngineError.GraphicsConsoleCantBeObtained, String.format("vmid=%s console=%s", getParameters().getVmId(), getParameters().getGraphicsType()));
}
return graphicsInfo;
}
Aggregations