|
17 | 17 | package com.cloud.upgrade.dao; |
18 | 18 |
|
19 | 19 | import java.io.InputStream; |
20 | | -import java.util.Arrays; |
21 | | -import java.util.List; |
22 | 20 | import java.sql.Connection; |
23 | 21 | import java.sql.PreparedStatement; |
24 | 22 | import java.sql.ResultSet; |
@@ -53,7 +51,6 @@ public InputStream[] getPrepareScripts() { |
53 | 51 | @Override |
54 | 52 | public void performDataMigration(Connection conn) { |
55 | 53 | unhideJsInterpretationEnabled(conn); |
56 | | - updateVpcDefaultOfferingsWithFirewallService(conn); |
57 | 54 | } |
58 | 55 |
|
59 | 56 | protected void unhideJsInterpretationEnabled(Connection conn) { |
@@ -92,65 +89,4 @@ protected void updateJsInterpretationEnabledFields(Connection conn, String encry |
92 | 89 | logger.warn("Error while decrypting configuration 'js.interpretation.enabled'. The configuration may already be decrypted."); |
93 | 90 | } |
94 | 91 | } |
95 | | - |
96 | | - private void updateVpcDefaultOfferingsWithFirewallService(Connection conn) { |
97 | | - logger.debug("Updating default VPC offerings to add Firewall service with VpcVirtualRouter provider"); |
98 | | - |
99 | | - final List<String> defaultVpcOfferingUniqueNames = Arrays.asList( |
100 | | - "DefaultIsolatedNetworkOfferingForVpcNetworks", |
101 | | - "DefaultIsolatedNetworkOfferingForVpcNetworksNoLB", |
102 | | - "DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB", |
103 | | - "DefaultNATNSXNetworkOfferingForVpc", |
104 | | - "DefaultRoutedNSXNetworkOfferingForVpc", |
105 | | - "DefaultNATNSXNetworkOfferingForVpcWithInternalLB", |
106 | | - "DefaultRoutedNetrisNetworkOfferingForVpc", |
107 | | - "DefaultNATNetrisNetworkOfferingForVpc", |
108 | | - "DefaultNSXVPCNetworkOfferingforKubernetesService" |
109 | | - ); |
110 | | - |
111 | | - try { |
112 | | - for (String uniqueName : defaultVpcOfferingUniqueNames) { |
113 | | - PreparedStatement pstmt = conn.prepareStatement("SELECT id FROM `cloud`.`network_offerings` WHERE unique_name = ?"); |
114 | | - pstmt.setString(1, uniqueName); |
115 | | - |
116 | | - ResultSet rs = pstmt.executeQuery(); |
117 | | - if (!rs.next()) { |
118 | | - continue; |
119 | | - } |
120 | | - |
121 | | - long offeringId = rs.getLong(1); |
122 | | - rs.close(); |
123 | | - pstmt.close(); |
124 | | - |
125 | | - // Insert into ntwk_offering_service_map (if not exists) |
126 | | - pstmt = conn.prepareStatement("INSERT INTO `cloud`.`ntwk_offering_service_map` " + |
127 | | - "(network_offering_id, service, provider, created) " + |
128 | | - "VALUES (?, 'Firewall', 'VpcVirtualRouter', now())"); |
129 | | - pstmt.setLong(1, offeringId); |
130 | | - pstmt.executeUpdate(); |
131 | | - pstmt.close(); |
132 | | - |
133 | | - // Update existing networks (ntwk_service_map) |
134 | | - pstmt = conn.prepareStatement("SELECT id FROM `cloud`.`networks` WHERE network_offering_id = ?"); |
135 | | - pstmt.setLong(1, offeringId); |
136 | | - |
137 | | - rs = pstmt.executeQuery(); |
138 | | - while (rs.next()) { |
139 | | - long networkId = rs.getLong(1); |
140 | | - PreparedStatement insertService = conn.prepareStatement("INSERT INTO `cloud`.`ntwk_service_map` " + |
141 | | - "(network_id, service, provider, created) " + |
142 | | - "VALUES (?, 'Firewall', 'VpcVirtualRouter', now())"); |
143 | | - insertService.setLong(1, networkId); |
144 | | - insertService.executeUpdate(); |
145 | | - insertService.close(); |
146 | | - } |
147 | | - |
148 | | - rs.close(); |
149 | | - pstmt.close(); |
150 | | - } |
151 | | - |
152 | | - } catch (SQLException e) { |
153 | | - logger.warn("Exception while updating VPC default offerings with Firewall service: " + e.getMessage(), e); |
154 | | - } |
155 | | - } |
156 | 92 | } |
0 commit comments