bug 9422: added rows in op_networks table to correspond to the rows in networks table

This commit is contained in:
Alex Huang 2011-04-14 03:17:55 -07:00
parent 6936a666fd
commit 38dd1d6ea9
1 changed files with 10 additions and 2 deletions

View File

@ -552,12 +552,20 @@ public class Upgrade218to22 implements DbUpgrade {
pstmt.setString(i++, reservationId);
pstmt.setString(i++, broadcastUri);
pstmt.executeUpdate();
pstmt = conn.prepareStatement("INSERT INTO op_networks(id, mac_address_seq, nics_count, gc, check_for_gc) VALUES(?, ?, ?, ?, ?)");
pstmt.setLong(1, seq);
pstmt.setLong(2, 0);
pstmt.setLong(3, 1);
pstmt.setLong(4, 0);
pstmt.setBoolean(5, true);
pstmt.executeUpdate();
pstmt = conn.prepareStatement("INSERT INTO account_network_ref (account_id, network_id, is_owner) VALUES (?, ?, 1)");
pstmt.setLong(1, accountId);
pstmt.setLong(2, seq);
pstmt.executeUpdate();
return seq;
} catch (SQLException e) {
throw new CloudRuntimeException("Unable to create network", e);