use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo in project ovirt-engine by oVirt.
the class GlusterSyncJob method fetchServers.
private List<GlusterServerInfo> fetchServers(Cluster cluster, VDS upServer, List<VDS> existingServers) {
// Create a copy of the existing servers as the fetchServer method can potentially remove elements from it
List<VDS> tempServers = new ArrayList<>(existingServers);
List<GlusterServerInfo> fetchedServers = fetchServers(upServer, tempServers);
if (fetchedServers == null) {
log.error("gluster peer status command failed on all servers of the cluster '{}'." + "Can't refresh it's data at this point.", cluster.getName());
return null;
}
if (fetchedServers.size() == 1 && existingServers.size() > 2) {
log.info("Gluster servers list fetched from server '{}' has only one server", upServer.getName());
// It's possible that the server we are using to get list of servers itself has been removed from the
// cluster, and hence is returning a single server (itself)
GlusterServerInfo server = fetchedServers.iterator().next();
if (isSameServer(upServer, server)) {
// Find a different UP server, and get servers list from it
tempServers.remove(upServer);
upServer = getNewUpServer(tempServers, upServer);
if (upServer == null) {
log.warn("The only UP server in cluster '{}' seems to have been removed from it using gluster CLI. " + "Can't refresh it's data at this point.", cluster.getName());
return null;
}
fetchedServers = fetchServers(upServer, tempServers);
if (fetchedServers == null) {
log.warn("The only UP server in cluster '{}' (or the only one on which gluster peer status " + "command is working) seems to have been removed from it using gluster CLI. " + "Can't refresh it's data at this point.", cluster.getName());
return null;
}
}
}
return fetchedServers;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo in project ovirt-engine by oVirt.
the class InitGlusterCommandHelper method getGlusterPeers.
@SuppressWarnings("unchecked")
private List<GlusterServerInfo> getGlusterPeers(VDS upServer) {
List<GlusterServerInfo> glusterServers = new ArrayList<>();
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServer.getId()));
if (!returnValue.getSucceeded()) {
AuditLogable logable = GlusterEventFactory.createEvent(upServer, returnValue);
auditLogDirector.log(logable, AuditLogType.GLUSTER_SERVERS_LIST_FAILED);
} else {
glusterServers = (List<GlusterServerInfo>) returnValue.getReturnValue();
}
return glusterServers;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method getFetchedServersList.
private List<GlusterServerInfo> getFetchedServersList() {
List<GlusterServerInfo> servers = new ArrayList<>();
servers.add(new GlusterServerInfo(SERVER_ID_1, SERVER_NAME_1, PeerStatus.CONNECTED));
servers.add(new GlusterServerInfo(SERVER_ID_2, SERVER_NAME_2, PeerStatus.CONNECTED));
return servers;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo in project ovirt-engine by oVirt.
the class GetAddedGlusterServersQueryTest method setupExpectedGlusterServersInfo.
private void setupExpectedGlusterServersInfo() {
expectedServers = new ArrayList<>();
GlusterServerInfo server = new GlusterServerInfo();
server.setUuid(server_id3);
server.setHostnameOrIp(TEST_SERVER3);
server.setStatus(PeerStatus.CONNECTED);
expectedServers.add(server);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo in project ovirt-engine by oVirt.
the class GlusterServersListReturn method prepareServerInfo.
private GlusterServerInfo prepareServerInfo(Map<String, Object> map) {
GlusterServerInfo entity = new GlusterServerInfo();
entity.setHostnameOrIp(map.get(HOST_NAME).toString());
entity.setUuid(new Guid(map.get(UUID).toString()));
String status = map.get(PEER_STATUS).toString();
entity.setStatus(PeerStatus.valueOf(status));
return entity;
}
Aggregations