Insert physnet1 in ml2_flat_allocations

On fix neutron migration insert phisnet1 in ml2_flat_allocations table.

Change-Id: I6af2eb78d25a060e5f1ba71d6180ca207988d656
This commit is contained in:
Sergey Abramov 2016-09-16 17:49:12 +03:00 committed by Ilya Kharin
parent 413c6b03a8
commit 9e31055b38
1 changed files with 8 additions and 1 deletions

View File

@ -107,10 +107,17 @@ def fix_neutron_migrations(node):
"UPDATE ml2_network_segments " \
"SET network_type='flat',physical_network='physnet1' " \
"WHERE network_id IN (SELECT network_id FROM externalnetworks);"
insert_physnet1 = \
"INSERT INTO ml2_flat_allocations " \
"SELECT b.* FROM (SELECT 'physnet1') AS b " \
"WHERE NOT EXISTS (" \
"SELECT 1 FROM ml2_flat_allocations " \
"WHERE physical_network = 'physnet1'" \
");"
cmd = ['sudo', '-iu', 'root', 'mysql', 'neutron']
with ssh.popen(cmd, node=node, stdin=ssh.PIPE) as proc:
proc.stdin.write(add_networksecuritybindings_sql)
proc.stdin.write(insert_physnet1)
proc.stdin.write(update_network_segments_sql)