firewall service is not supported in shared SG enabled network offering , remove it

This commit is contained in:
Anthony Xu 2013-05-23 14:18:09 -07:00
parent 2336d478be
commit e8fbee0e18
2 changed files with 33 additions and 1 deletions

View File

@ -75,6 +75,7 @@ public class Upgrade410to420 implements DbUpgrade {
updateNetworkACLs(conn);
addHostDetailsIndex(conn);
updateNetworksForPrivateGateways(conn);
removeFirewallServiceFromSharedNetworkOfferingWithSGService(conn);
}
private void updateSystemVmTemplates(Connection conn) {
@ -747,4 +748,35 @@ public class Upgrade410to420 implements DbUpgrade {
throw new CloudRuntimeException("Failed to update private networks with VPC id.", e);
}
}
private void removeFirewallServiceFromSharedNetworkOfferingWithSGService(Connection conn) {
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = conn.prepareStatement("select id from `cloud`.`network_offerings` where unique_name='DefaultSharedNetworkOfferingWithSGService'");
rs = pstmt.executeQuery();
while (rs.next()) {
long id = rs.getLong(1);
// remove Firewall service for SG shared network offering
pstmt = conn.prepareStatement("DELETE `cloud`.`ntwk_offering_service_map` where network_offering_id=? and service='Firewall'");
pstmt.setLong(1, id);
pstmt.executeUpdate();
}
} catch (SQLException e) {
throw new CloudRuntimeException("Unable to remove Firewall service for SG shared network offering.", e);
} finally {
try {
if (rs != null) {
rs.close();
}
if (pstmt != null) {
pstmt.close();
}
} catch (SQLException e) {
}
}
}
}

View File

@ -1710,5 +1710,5 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'VpcMa
-- Re-enable foreign key checking, at the end of the upgrade path
SET foreign_key_checks = 1;
UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL;