Merge "Ip address instead fqdn in snapshot configuration"
This commit is contained in:
commit
73a7dd0757
|
@ -1307,7 +1307,8 @@ class DumpTask(object):
|
|||
dump_conf = deepcopy(settings.DUMP)
|
||||
for node in nodes:
|
||||
host = {
|
||||
'address': objects.Node.get_node_fqdn(node),
|
||||
'hostname': objects.Node.get_slave_name(node),
|
||||
'address': node.ip,
|
||||
'ssh-key': settings.SHOTGUN_SSH_KEY,
|
||||
}
|
||||
|
||||
|
|
|
@ -409,7 +409,8 @@ class TestLogs(BaseIntegrationTest):
|
|||
def test_snapshot_conf(self):
|
||||
self.env.create_node(
|
||||
status='ready',
|
||||
hostname='node111'
|
||||
hostname='node111',
|
||||
ip='10.109.0.2',
|
||||
)
|
||||
conf = {
|
||||
'dump': {
|
||||
|
@ -426,7 +427,8 @@ class TestLogs(BaseIntegrationTest):
|
|||
},
|
||||
'slave': {
|
||||
'hosts': [{
|
||||
'address': 'node111.example.com',
|
||||
'hostname': 'node111',
|
||||
'address': '10.109.0.2',
|
||||
'ssh-key': '/root/.ssh/id_rsa',
|
||||
}],
|
||||
'objects': [],
|
||||
|
|
|
@ -69,19 +69,21 @@ class TestSnapshotConf(base.TestCase):
|
|||
mock_db.return_value.query.return_value.filter.return_value.
|
||||
all.return_value
|
||||
) = [
|
||||
mock.Mock(hostname='node1', roles=[]),
|
||||
mock.Mock(hostname='node2', roles=[]),
|
||||
mock.Mock(hostname='node1', ip="10.109.0.2", roles=[]),
|
||||
mock.Mock(hostname='node2', ip="10.109.0.5", roles=[]),
|
||||
]
|
||||
|
||||
conf = task.DumpTask.conf()
|
||||
|
||||
self.assertIn({
|
||||
'address': 'node1.example.com',
|
||||
'hostname': 'node1',
|
||||
'address': '10.109.0.2',
|
||||
'ssh-key': settings.SHOTGUN_SSH_KEY,
|
||||
}, conf['dump']['slave']['hosts'])
|
||||
|
||||
self.assertIn({
|
||||
'address': 'node2.example.com',
|
||||
'hostname': 'node2',
|
||||
'address': '10.109.0.5',
|
||||
'ssh-key': settings.SHOTGUN_SSH_KEY,
|
||||
}, conf['dump']['slave']['hosts'])
|
||||
|
||||
|
@ -92,18 +94,20 @@ class TestSnapshotConf(base.TestCase):
|
|||
mock_db.return_value.query.return_value.filter.return_value.
|
||||
all.return_value
|
||||
) = [
|
||||
mock.Mock(hostname='node1', roles=['controller', 'cinder']),
|
||||
mock.Mock(hostname='node1', ip='10.109.0.1', roles=['controller',
|
||||
'cinder']),
|
||||
mock.Mock(hostname='node2', roles=['compute']),
|
||||
]
|
||||
|
||||
conf = task.DumpTask.conf()
|
||||
|
||||
self.assertIn({
|
||||
'address': 'node1.example.com',
|
||||
'hostname': 'node1',
|
||||
'address': '10.109.0.1',
|
||||
'ssh-key': settings.SHOTGUN_SSH_KEY,
|
||||
}, conf['dump']['controller']['hosts'])
|
||||
|
||||
self.assertNotIn({
|
||||
'address': 'node2.example.com',
|
||||
'hostname': 'node2',
|
||||
'ssh-key': settings.SHOTGUN_SSH_KEY,
|
||||
}, conf['dump']['controller']['hosts'])
|
||||
|
|
Loading…
Reference in New Issue