firewall service is not supported in shared SG enabled network offering , remove it
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e8fbee0e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e8fbee0e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e8fbee0e Branch: refs/heads/vmware-storage-motion Commit: e8fbee0e18383a4ae07b62c4dafdadf742ec62bb Parents: 2336d47 Author: Anthony Xu <anthony...@citrix.com> Authored: Thu May 23 14:18:09 2013 -0700 Committer: Anthony Xu <anthony...@citrix.com> Committed: Thu May 23 14:19:43 2013 -0700 ---------------------------------------------------------------------- .../src/com/cloud/upgrade/dao/Upgrade410to420.java | 32 +++++++++++++++ setup/db/db/schema-410to420.sql | 2 +- 2 files changed, 33 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8fbee0e/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java index c03d377..95abe5f 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java @@ -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) { + } + } + } + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8fbee0e/setup/db/db/schema-410to420.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql index ea7a18d..b548035 100644 --- a/setup/db/db/schema-410to420.sql +++ b/setup/db/db/schema-410to420.sql @@ -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;