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:
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user