MXS-2314 Populate services with servers

The services whose servers are defined using a monitor, will
now be populated from the monitor.

Note, no consideration has yet been given to runtime changes.
This commit is contained in:
Johan Wikman
2019-02-06 14:38:48 +02:00
parent f271c5cea1
commit b4eb87dfcc
6 changed files with 48 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#include <set>
#include <maxscale/json_api.h>
#include "../../../core/internal/config_runtime.hh"
#include "../../../core/internal/service.hh"
namespace http = mxb::http;
using namespace std;
@ -65,6 +66,15 @@ bool ClustrixMonitor::configure(const MXS_CONFIG_PARAMETER* pParams)
return true;
}
void ClustrixMonitor::populate_services()
{
mxb_assert(Monitor::m_state == MONITOR_STATE_STOPPED);
// The servers that the Clustrix monitor has been configured with are
// only used for bootstrapping and services will not be populated
// with them.
}
bool ClustrixMonitor::softfail(SERVER* pServer, json_t** ppError)
{
bool rv = false;
@ -335,6 +345,10 @@ void ClustrixMonitor::refresh_nodes()
health_check_threshold, pServer);
m_nodes.insert(make_pair(id, node));
// New server, so it needs to be added to all services that
// use this monitor for defining its cluster of servers.
service_add_server(this, pServer);
}
else
{

View File

@ -64,6 +64,8 @@ public:
bool configure(const MXS_CONFIG_PARAMETER* pParams) override;
void populate_services() override;
bool softfail(SERVER* pServer, json_t** ppError);
bool unsoftfail(SERVER* pServer, json_t** ppError);