use of org.ovirt.engine.core.common.queries.GetFenceAgentStatusParameters in project ovirt-engine by oVirt.
the class FenceAgentModel method test.
/**
* Execute the fence agent test.
*/
public void test() {
validatePmModels();
if (!isValid()) {
return;
}
setMessage(ConstantsManager.getInstance().getConstants().testingInProgressItWillTakeFewSecondsPleaseWaitMsg());
getTestCommand().setIsExecutionAllowed(false);
Cluster cluster = getHost().getCluster().getSelectedItem();
GetFenceAgentStatusParameters param = new GetFenceAgentStatusParameters();
FenceAgent agent = new FenceAgent();
if (getHost().getHostId() != null) {
param.setVdsId(getHost().getHostId());
}
agent.setOrder(getOrder().getEntity());
agent.setIp(getManagementIp().getEntity());
agent.setType(getPmType().getSelectedItem());
agent.setUser(getPmUserName().getEntity());
agent.setPassword(getPmPassword().getEntity());
agent.setPort(getPmPort().getEntity());
agent.setOptionsMap(getPmOptionsMap());
param.setAgent(agent);
param.setStoragePoolId(cluster.getStoragePoolId() != null ? cluster.getStoragePoolId() : Guid.Empty);
param.setFenceProxySources(FenceProxySourceTypeHelper.parseFromString(getHost().getPmProxyPreferences()));
param.setVdsName(getHost().getName().getEntity());
param.setHostName(getHost().getHost().getEntity());
param.setClusterId(cluster.getId());
Frontend.getInstance().runQuery(QueryType.GetFenceAgentStatus, param, new AsyncQuery<QueryReturnValue>(returnValue -> {
String msg;
if (returnValue == null) {
msg = ConstantsManager.getInstance().getConstants().testFailedUnknownErrorMsg();
} else {
FenceOperationResult result = returnValue.getReturnValue();
if (result.getStatus() == FenceOperationResult.Status.SUCCESS) {
msg = ConstantsManager.getInstance().getMessages().testSuccessfulWithPowerStatus(result.getPowerStatus() == PowerStatus.ON ? ConstantsManager.getInstance().getConstants().powerOn() : ConstantsManager.getInstance().getConstants().powerOff());
} else {
msg = ConstantsManager.getInstance().getMessages().testFailedWithErrorMsg(result.getMessage());
}
}
setMessage(msg);
getTestCommand().setIsExecutionAllowed(true);
}, true));
}
Aggregations