Merge "Insert physnet1 in ml2_flat_allocations"

This commit is contained in:
Jenkins 2016-09-20 09:05:49 +00:00 committed by Gerrit Code Review
commit 8a4278e3b9
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)