Search in sources :

Example 1 with RemoveGlusterServerVDSParameters

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());
    }
}
Also used : RemoveGlusterServerVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 2 with RemoveGlusterServerVDSParameters

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());
            }
        }
    }
}
Also used : RemoveGlusterServerVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters) GlusterServerInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with RemoveGlusterServerVDSParameters

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;
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) RemoveGlusterServerVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 RemoveGlusterServerVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.RemoveGlusterServerVDSParameters)3 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 GlusterServerInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo)1