MXS-2121: Allow destruction of static listeners

If a listener is defined in a static configuration file, it can now be
destroyed at runtime. If MaxScale is restarted, the listener will be
created again unless the configuration file is modified.
This commit is contained in:
Markus Mäkelä 2018-10-29 15:56:45 +02:00
parent 906d8cee5b
commit 47d2898818
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
3 changed files with 11 additions and 12 deletions

View File

@ -137,7 +137,7 @@ describe("Create/Destroy Commands", function() {
it('will not destroy static listener', function() {
return doCommand('destroy listener RW-Split-Router RW-Split-Listener')
.should.be.rejected
.should.be.fulfilled
})
it('create user', function() {

View File

@ -1032,7 +1032,6 @@ bool runtime_create_listener(Service* service,
bool runtime_destroy_listener(Service* service, const char* name)
{
bool rval = false;
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s/%s.cnf", get_config_persistdir(), name);
@ -1043,20 +1042,20 @@ bool runtime_destroy_listener(Service* service, const char* name)
if (errno != ENOENT)
{
MXS_ERROR("Failed to remove persisted listener configuration '%s': %d, %s",
filename,
errno,
mxs_strerror(errno));
filename, errno, mxs_strerror(errno));
return false;
}
else
{
config_runtime_error("Persisted configuration file for listener '%s' was not "
"found. This means that the listener was not created at "
"runtime. Remove the listener manually from the correct "
"configuration file.",
name);
MXS_WARNING("Persisted configuration file for listener '%s' was not found. This means that the "
"listener was not created at runtime. Remove the listener manually from the correct "
"configuration file to permanently destroy the listener.", name);
}
}
else if (!service_remove_listener(service, name))
bool rval = false;
if (!service_remove_listener(service, name))
{
MXS_ERROR("Failed to destroy listener '%s' for service '%s'", name, service->name);
config_runtime_error("Failed to destroy listener '%s' for service '%s'", name, service->name);

View File

@ -165,7 +165,7 @@ describe("Service", function() {
it("destroy a static listener", function() {
return request.delete(base_url + "/services/RW-Split-Router/listeners/RW-Split-Listener")
.should.be.rejected
.should.be.fulfilled
});
after(stopMaxScale)