You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pstmt = conn.prepareStatement("select network_id FROM `cloud`.`ntwk_service_map` where service='Firewall' and provider='VirtualRouter' ");
118
-
rs = pstmt.executeQuery();
119
-
while (rs.next()) {
120
-
longnetId = rs.getLong(1);
107
+
// update the existing ingress rules traffic type
108
+
try (PreparedStatementupdateNwpstmt = conn.prepareStatement("update `cloud`.`firewall_rules` set traffic_type='Ingress' where purpose='Firewall' and ip_address_id is " +
thrownewCloudRuntimeException("Unable to update ingress firewall rules ", e);
115
+
}
116
+
117
+
118
+
try (PreparedStatementvrNwpstmt = conn.prepareStatement("select network_id FROM `cloud`.`ntwk_service_map` where service='Firewall' and provider='VirtualRouter' ");
119
+
ResultSetvrNwsRs = vrNwpstmt.executeQuery();
120
+
) {
121
+
while (vrNwsRs.next()) {
122
+
longnetId = vrNwsRs.getLong(1);
121
123
//When upgraded from 2.2.14 to 3.0.6 guest_type is updated to Isolated in the 2214to30 clean up sql. clean up executes
122
124
//after this. So checking for Isolated OR Virtual
123
-
pstmt = conn.prepareStatement("select account_id, domain_id FROM `cloud`.`networks` where (guest_type='Isolated' OR " +
124
-
"guest_type='Virtual') and traffic_type='Guest' and vpc_id is NULL and " +
125
-
"(state='implemented' OR state='Shutdown') and id=? ");
126
-
pstmt.setLong(1, netId);
127
-
s_logger.debug("Getting account_id, domain_id from networks table: " + pstmt);
128
-
rsNw = pstmt.executeQuery();
129
-
130
-
if (rsNw.next()) {
131
-
longaccountId = rsNw.getLong(1);
132
-
longdomainId = rsNw.getLong(2);
133
-
134
-
//Add new rule for the existing networks
135
-
s_logger.debug("Adding default egress firewall rule for network " + netId);
pstmt = conn.prepareStatement("select id from firewall_rules where protocol='all' and network_id=?");
146
-
pstmt.setLong(1, netId);
147
-
rsId = pstmt.executeQuery();
148
-
149
-
longfirewallRuleId;
150
-
if (rsId.next()) {
151
-
firewallRuleId = rsId.getLong(1);
152
-
pstmt = conn.prepareStatement("insert into firewall_rules_cidrs (firewall_rule_id,source_cidr) values (?, '0.0.0.0/0')");
153
-
pstmt.setLong(1, firewallRuleId);
154
-
s_logger.debug("Inserting rule for cidr 0.0.0.0/0 for the new Firewall rule id=" + firewallRuleId + " with statement " + pstmt);
155
-
pstmt.executeUpdate();
125
+
try (PreparedStatementNwAcctDomIdpstmt = conn.prepareStatement("select account_id, domain_id FROM `cloud`.`networks` where (guest_type='Isolated' OR " +
126
+
"guest_type='Virtual') and traffic_type='Guest' and vpc_id is NULL and " +
127
+
"(state='implemented' OR state='Shutdown') and id=? "); ) {
0 commit comments