use of org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturn in project ovirt-engine by oVirt.
the class JsonRpcVdsServer method glusterSnapshotConfigSet.
@Override
public StatusOnlyReturn glusterSnapshotConfigSet(String configName, String configValue) {
JsonRpcRequest request = new RequestBuilder("GlusterSnapshot.configSet").withParameter("optionName", configName).withParameter("optionValue", configValue).build();
Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey();
return new StatusOnlyReturn(response);
}
use of org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturn in project ovirt-engine by oVirt.
the class JsonRpcVdsServer method destroy.
@Override
public StatusOnlyReturn destroy(String vmId) {
JsonRpcRequest request = new RequestBuilder("VM.destroy").withParameter("vmID", vmId).build();
Map<String, Object> response = new FutureMap(this.client, request);
return new StatusOnlyReturn(response);
}
use of org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturn in project ovirt-engine by oVirt.
the class JsonRpcVdsServer method hibernate.
@Override
public StatusOnlyReturn hibernate(String vmId, String hiberVolHandle) {
JsonRpcRequest request = new RequestBuilder("VM.hibernate").withParameter("vmID", vmId).withParameter("hibernationVolHandle", hiberVolHandle).build();
Map<String, Object> response = new FutureMap(this.client, request);
return new StatusOnlyReturn(response);
}
use of org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturn in project ovirt-engine by oVirt.
the class HttpImageTaskVDSCommand method executeHttpMethod.
protected void executeHttpMethod(final T method) {
int responseCode = -1;
VdsManager manager = resourceManager.getVdsManager(getParameters().getVdsId());
final HttpClient httpclient = manager.getVdsProxy().getHttpClient();
try {
FutureTask<Integer> futureTask = new FutureTask(() -> httpclient.executeMethod(method));
Future<Integer> f = ThreadPoolUtil.execute(futureTask);
if (f.get(Config.<Integer>getValue(getConfigValueTimeLimitForOperation()), TimeUnit.MINUTES) == null) {
responseCode = futureTask.get();
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (Exception e) {
log.debug("Exception", e);
throw createNetworkException(e);
}
if (responseCode == getSuccessCode()) {
Guid createdTask = Guid.createGuidFromString(processResponseHeaderValue(getMethod(), "Task-Id", null));
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(createdTask, getCreatedTaskType(), getParameters().getStoragePoolId()));
handleOkResponse();
getVDSReturnValue().setSucceeded(true);
return;
}
processResponseHeaderValue(getMethod(), "Content-type", "application/json");
String response;
try {
response = getMethod().getResponseBodyAsString();
} catch (Exception e) {
throw createNetworkException(e);
}
Map<String, Object> resultMap = null;
try {
resultMap = new ObjectMapper().readValue(response, HashMap.class);
status = new StatusOnlyReturn(resultMap);
} catch (Exception e) {
throwVdsErrorException("failed to parse response " + response, EngineError.GeneralException);
}
proceedProxyReturnValue();
}
use of org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturn in project ovirt-engine by oVirt.
the class JsonRpcVdsServer method glusterVolumeGeoRepSessionStart.
@Override
public StatusOnlyReturn glusterVolumeGeoRepSessionStart(String volumeName, String remoteHost, String remoteVolumeName, String userName, Boolean force) {
JsonRpcRequest request = new RequestBuilder("GlusterVolume.geoRepSessionStart").withParameter("volumeName", volumeName).withParameter("remoteHost", remoteHost).withParameter("remoteVolumeName", remoteVolumeName).withOptionalParameter("remoteUserName", userName).withParameter("force", force).build();
Map<String, Object> response = new FutureMap(this.client, request);
return new StatusOnlyReturn(response);
}
Aggregations