Do not pass excessive configuration to shotgun

For dump configuration section with empty hosts array shotgun tries to
process all entries locally - on master node.
When there are no nodes ready for log collection this behaviour causes
all slave and controller's log entries to be processed on master
node. Taking into account that currently master node logs are symlinked
before being packed this leads to a situation when snapshot lacks some
files.
For instance when a symlink /var/log/libvirt is created it is impossible
to create /var/log symlink later.

Change-Id: Ife60115d8d0203654ae58ed7c13f94fd9b7b3b8a
Closes-Bug: #1590750
This commit is contained in:
Georgy Kibardin 2016-06-09 15:03:45 +03:00
parent f121a0c322
commit e8e9157cea
2 changed files with 8 additions and 1 deletions

View File

@ -1889,6 +1889,12 @@ class DumpTask(object):
dump_conf['dump']['controller']['hosts'].append(host)
# save slaves
dump_conf['dump']['slave']['hosts'].append(host)
if 'controller' in dump_conf['dump'] and \
not dump_conf['dump']['controller']['hosts']:
del dump_conf['dump']['controller']
if 'slave' in dump_conf['dump'] and \
not dump_conf['dump']['slave']['hosts']:
del dump_conf['dump']['slave']
# render postgres connection data in dump settings
dump_conf['dump']['local']['objects'].append({

View File

@ -28,7 +28,8 @@ class TestSnapshotConf(base.TestCase):
conf = task.DumpTask.conf()
self.assertIn('local', conf['dump'])
self.assertIn('master', conf['dump'])
self.assertIn('slave', conf['dump'])
self.assertNotIn('slave', conf['dump'])
self.assertNotIn('controller', conf['dump'])
def test_local_host(self):
conf = task.DumpTask.conf()