use of org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters in project ovirt-engine by oVirt.
the class RemoveGlusterServerCommand method executeCommand.
@Override
protected void executeCommand() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RemoveGlusterServer, new RemoveGlusterServerVDSParameters(upServer.getId(), getParameters().getHostnameOrIp(), getParameters().isForceAction()));
setSucceeded(returnValue.getSucceeded());
if (!getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_SERVER_REMOVE_FAILED, returnValue.getVdsError().getMessage());
}
}
use of org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters in project ovirt-engine by oVirt.
the class RemoveVdsCommand method glusterHostRemove.
private void glusterHostRemove() {
if (clusterHasMultipleHosts() && !hasVolumeBricksOnServer()) {
try (EngineLock lock = glusterUtil.acquireGlusterLockWait(getClusterId())) {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RemoveGlusterServer, new RemoveGlusterServerVDSParameters(upServer.getId(), getVds().getHostName(), getParameters().isForceAction()));
// If the host is already removed Cluster using Gluster CLI then we can setSucceeded to true.
setSucceeded(returnValue.getSucceeded() || EngineError.GlusterHostIsNotPartOfCluster == returnValue.getVdsError().getCode());
if (!getSucceeded()) {
if (returnValue.getVdsError().getCode() == EngineError.GlusterHostRemoveFailedException) {
List<GlusterServerInfo> glusterServers = getGlusterPeers(upServer);
if (glusterServers != null) {
if (!glusterUtil.isHostExists(glusterServers, getVds())) {
setSucceeded(true);
}
}
}
if (!getSucceeded()) {
getReturnValue().getFault().setError(returnValue.getVdsError().getCode());
getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage());
errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED;
return;
}
}
// if last but one host in cluster, update the last host's known addresses
if (clusterUtils.getServerCount(getClusterId()) == 2) {
removeOtherKnowAddressesForGlusterServer(upServer.getId());
}
}
}
}
use of org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters in project ovirt-engine by oVirt.
the class ChangeVDSClusterCommand method glusterHostRemove.
private boolean glusterHostRemove(Guid sourceClusterId) {
// condition.
try (EngineLock lock = glusterUtil.acquireGlusterLockWait(sourceClusterId)) {
VDS runningHostInSourceCluster = glusterUtil.getUpServer(sourceClusterId);
if (runningHostInSourceCluster == null) {
log.error("Cannot remove host from source cluster, no host in Up status found in source cluster");
handleError(-1, "No host in Up status found in source cluster");
errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED;
return false;
}
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RemoveGlusterServer, new RemoveGlusterServerVDSParameters(runningHostInSourceCluster.getId(), getVds().getHostName(), false));
if (!returnValue.getSucceeded()) {
handleVdsError(returnValue);
errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED;
return false;
}
return true;
}
}
Aggregations