MXS-1929: Make services destroyable
Services can now be destroyed if they have no active listeners and they are not linked to servers. When these conditions are met, the service will be destroyed when the last session for the service is closed. The closing of a service will close all listeners that were once assigned to the service. This allows closing of the ports at runtime which previously was done only on shutdown. Exposed the command through the REST API but not through MaxAdmin as it is deprecated.
This commit is contained in:
@ -459,6 +459,19 @@ HttpResponse cb_delete_listener(const HttpRequest& request)
|
||||
return HttpResponse(MHD_HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
HttpResponse cb_delete_service(const HttpRequest& request)
|
||||
{
|
||||
SERVICE* service = service_find(request.uri_part(1).c_str());
|
||||
ss_dassert(service);
|
||||
|
||||
if (runtime_destroy_service(service))
|
||||
{
|
||||
return HttpResponse(MHD_HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
return HttpResponse(MHD_HTTP_FORBIDDEN, runtime_get_json_error());
|
||||
}
|
||||
|
||||
HttpResponse cb_all_servers(const HttpRequest& request)
|
||||
{
|
||||
return HttpResponse(MHD_HTTP_OK, server_list_to_json(request.host()));
|
||||
@ -930,6 +943,8 @@ public:
|
||||
|
||||
m_delete.push_back(SResource(new Resource(cb_delete_server, 2, "servers", ":server")));
|
||||
m_delete.push_back(SResource(new Resource(cb_delete_monitor, 2, "monitors", ":monitor")));
|
||||
m_delete.push_back(SResource(new Resource(cb_delete_service, 2, "services", ":service")));
|
||||
|
||||
m_delete.push_back(SResource(new Resource(cb_delete_user, 3, "users", "inet", ":inetuser")));
|
||||
m_delete.push_back(SResource(new Resource(cb_delete_user, 3, "users", "unix", ":unixuser")));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user