mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	coverity 1116544: a lot of the same (probably other coverity ids covered as well)
Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
		
							parent
							
								
									f8691b2c69
								
							
						
					
					
						commit
						2c7e19faff
					
				| @ -59,94 +59,72 @@ public class Upgrade303to304 extends Upgrade30xBase implements DbUpgrade { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private void correctVRProviders(Connection conn) { |     private void correctVRProviders(Connection conn) { | ||||||
|         PreparedStatement pstmtVR = null; |  | ||||||
|         ResultSet rsVR = null; |  | ||||||
|         PreparedStatement pstmt = null; |  | ||||||
|         ResultSet rs = null; |  | ||||||
| 
 | 
 | ||||||
|         try { |         try (PreparedStatement pstmtVR = conn.prepareStatement("SELECT id, nsp_id FROM `cloud`.`virtual_router_providers` where type = 'VirtualRouter' AND removed IS NULL"); | ||||||
|             pstmtVR = conn.prepareStatement("SELECT id, nsp_id FROM `cloud`.`virtual_router_providers` where type = 'VirtualRouter' AND removed IS NULL"); |              PreparedStatement pstmt = conn.prepareStatement("SELECT  physical_network_id, provider_name FROM `cloud`.`physical_network_service_providers` where id = ?"); | ||||||
|             rsVR = pstmtVR.executeQuery(); |              PreparedStatement pstmt1 = | ||||||
|  |                         conn.prepareStatement("SELECT  id FROM `cloud`.`physical_network_service_providers` where physical_network_id = ? AND provider_name = ? AND removed IS NULL"); | ||||||
|  |              PreparedStatement pstmtUpdate = conn.prepareStatement("UPDATE `cloud`.`virtual_router_providers` SET nsp_id = ? WHERE id = ?"); | ||||||
|  |              ResultSet rsVR = pstmtVR.executeQuery(); | ||||||
|  |             ) { | ||||||
|             while (rsVR.next()) { |             while (rsVR.next()) { | ||||||
|                 long vrId = rsVR.getLong(1); |                 long vrId = rsVR.getLong(1); | ||||||
|                 long nspId = rsVR.getLong(2); |                 long nspId = rsVR.getLong(2); | ||||||
| 
 |  | ||||||
|                 //check that this nspId points to a VR provider. |                 //check that this nspId points to a VR provider. | ||||||
|                 pstmt = conn.prepareStatement("SELECT  physical_network_id, provider_name FROM `cloud`.`physical_network_service_providers` where id = ?"); |  | ||||||
|                 pstmt.setLong(1, nspId); |  | ||||||
|                 rs = pstmt.executeQuery(); |  | ||||||
|                 if (rs.next()) { |  | ||||||
|                     long physicalNetworkId = rs.getLong(1); |  | ||||||
|                     String providerName = rs.getString(2); |  | ||||||
|                     if (!providerName.equalsIgnoreCase("VirtualRouter")) { |  | ||||||
|                         //mismatch, correct the nsp_id in VR |  | ||||||
|                         PreparedStatement pstmt1 = null; |  | ||||||
|                         ResultSet rs1 = null; |  | ||||||
|                         pstmt1 = |  | ||||||
|                             conn.prepareStatement("SELECT  id FROM `cloud`.`physical_network_service_providers` where physical_network_id = ? AND provider_name = ? AND removed IS NULL"); |  | ||||||
|                         pstmt1.setLong(1, physicalNetworkId); |  | ||||||
|                         pstmt1.setString(2, "VirtualRouter"); |  | ||||||
|                         rs1 = pstmt1.executeQuery(); |  | ||||||
|                         if (rs1.next()) { |  | ||||||
|                             long correctNSPId = rs1.getLong(1); |  | ||||||
| 
 | 
 | ||||||
|                             //update VR entry |                 pstmt.setLong(1, nspId); | ||||||
|                             PreparedStatement pstmtUpdate = null; |                 try (ResultSet rs = pstmt.executeQuery();) { | ||||||
|                             String updateNSPId = "UPDATE `cloud`.`virtual_router_providers` SET nsp_id = ? WHERE id = ?"; |                     if (rs.next()) { | ||||||
|                             pstmtUpdate = conn.prepareStatement(updateNSPId); |                         long physicalNetworkId = rs.getLong(1); | ||||||
|                             pstmtUpdate.setLong(1, correctNSPId); |                         String providerName = rs.getString(2); | ||||||
|                             pstmtUpdate.setLong(2, vrId); |                         if (!providerName.equalsIgnoreCase("VirtualRouter")) { | ||||||
|                             pstmtUpdate.executeUpdate(); |                             //mismatch, correct the nsp_id in VR | ||||||
|                             pstmtUpdate.close(); |                             pstmt1.setLong(1, physicalNetworkId); | ||||||
|  |                             pstmt1.setString(2, "VirtualRouter"); | ||||||
|  |                             try (ResultSet rs1 = pstmt1.executeQuery();) { | ||||||
|  |                                 if (rs1.next()) { | ||||||
|  |                                     long correctNSPId = rs1.getLong(1); | ||||||
|  | 
 | ||||||
|  |                                     //update VR entry | ||||||
|  |                                     pstmtUpdate.setLong(1, correctNSPId); | ||||||
|  |                                     pstmtUpdate.setLong(2, vrId); | ||||||
|  |                                     pstmtUpdate.executeUpdate(); | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|                         } |                         } | ||||||
|                         rs1.close(); |  | ||||||
|                         pstmt1.close(); |  | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 rs.close(); |  | ||||||
|                 pstmt.close(); |  | ||||||
|             } |             } | ||||||
|         } catch (SQLException e) { |         } catch (SQLException e) { | ||||||
|             throw new CloudRuntimeException("Exception while correcting Virtual Router Entries", e); |             throw new CloudRuntimeException("Exception while correcting Virtual Router Entries", e); | ||||||
|         } finally { |  | ||||||
|             if (rsVR != null) { |  | ||||||
|                 try { |  | ||||||
|                     rsVR.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (pstmtVR != null) { |  | ||||||
|                 try { |  | ||||||
|                     pstmtVR.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (rs != null) { |  | ||||||
|                 try { |  | ||||||
|                     rs.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (pstmt != null) { |  | ||||||
|                 try { |  | ||||||
|                     pstmt.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private void correctMultiplePhysicaNetworkSetups(Connection conn) { |     private void correctMultiplePhysicaNetworkSetups(Connection conn) { | ||||||
|         PreparedStatement pstmtZone = null; |  | ||||||
|         ResultSet rsZone = null; |  | ||||||
|         PreparedStatement pstmt = null; |  | ||||||
|         ResultSet rs = null; |  | ||||||
| 
 | 
 | ||||||
|         try { |         try ( | ||||||
|  |                 PreparedStatement pstmtZone = conn.prepareStatement("SELECT id, domain_id, networktype, name, uuid FROM `cloud`.`data_center`"); | ||||||
|  |                 ResultSet rsZone = pstmtZone.executeQuery(); | ||||||
|  |                 PreparedStatement pstmt_count_networks = conn.prepareStatement("SELECT count(n.id) FROM networks n WHERE n.physical_network_id IS NULL AND n.traffic_type = 'Guest' and n.data_center_id = ? and n.removed is null"); | ||||||
|  |                 PreparedStatement pstmtUpdate = conn.prepareStatement("UPDATE `cloud`.`data_center` SET uuid = ? WHERE id = ?"); | ||||||
|  |                 PreparedStatement pstmt_count_traffic_types_and_labels = | ||||||
|  |                         conn.prepareStatement("SELECT count(*) FROM `cloud`.`physical_network_traffic_types` pntt JOIN `cloud`.`physical_network` pn ON pntt.physical_network_id = pn.id WHERE pntt.traffic_type ='Guest' AND pn.data_center_id = ? AND pntt.xen_network_label = ?"); | ||||||
|  |                 PreparedStatement pstmt_network_id = | ||||||
|  |                         conn.prepareStatement("SELECT n.id FROM networks n WHERE n.physical_network_id IS NULL AND n.traffic_type = 'Guest' and n.data_center_id = ? and n.removed is null"); | ||||||
|  |                 PreparedStatement pstmt_count_traffic_types = | ||||||
|  |                         conn.prepareStatement("SELECT count(*) FROM `cloud`.`physical_network_traffic_types` pntt JOIN `cloud`.`physical_network` pn ON pntt.physical_network_id = pn.id WHERE pntt.traffic_type ='Guest' and pn.data_center_id = ?"); | ||||||
|  |                 PreparedStatement pstmt_select_vnets_on_different_physical_net = | ||||||
|  |                         conn.prepareStatement("SELECT v.id, v.vnet, v.reservation_id, v.physical_network_id as vpid, n.id, n.physical_network_id as npid FROM `cloud`.`op_dc_vnet_alloc` v JOIN `cloud`.`networks` n ON CONCAT('vlan://' , v.vnet) = n.broadcast_uri WHERE v.taken IS NOT NULL AND v.data_center_id = ? AND n.removed IS NULL AND v.physical_network_id !=  n.physical_network_id"); | ||||||
|  |                 PreparedStatement pstmt_select_vnets = | ||||||
|  |                         conn.prepareStatement("SELECT v.id, v.vnet, v.reservation_id FROM `cloud`.`op_dc_vnet_alloc` v LEFT JOIN networks n ON CONCAT('vlan://' , v.vnet) = n.broadcast_uri WHERE v.taken IS NOT NULL AND v.data_center_id = ? AND n.broadcast_uri IS NULL AND n.removed IS NULL"); | ||||||
|  |                 PreparedStatement pstmt_select_nic_ids = conn.prepareStatement("SELECT id, instance_id FROM `cloud`.`nics` where broadcast_uri = ? and removed IS NULL"); | ||||||
|  |                 PreparedStatement pstmt_physical_network_tags = | ||||||
|  |                         conn.prepareStatement("SELECT pn.id as pid , ptag.tag as tag FROM `cloud`.`physical_network` pn LEFT JOIN `cloud`.`physical_network_tags` ptag ON pn.id = ptag.physical_network_id where pn.data_center_id = ?"); | ||||||
|  |                 PreparedStatement pstmt_insert_physical_networkTags = conn.prepareStatement("INSERT INTO `cloud`.`physical_network_tags`(tag, physical_network_id) VALUES( ?, ? )"); | ||||||
|  |                 PreparedStatement pstmt_select_distict_netoffers = | ||||||
|  |                         conn.prepareStatement("SELECT distinct network_offering_id FROM `cloud`.`networks` where traffic_type= 'Guest' and physical_network_id = ? and removed is null"); | ||||||
|  |                 PreparedStatement pstmt_update_vnet_alloc = conn.prepareStatement("UPDATE `cloud`.`op_dc_vnet_alloc` SET account_id = NULL, taken = NULL, reservation_id = NULL WHERE id = ?"); | ||||||
|  |                 ) { | ||||||
| 
 | 
 | ||||||
|             //check if multiple physical networks with 'Guest' Traffic types are present |             //check if multiple physical networks with 'Guest' Traffic types are present | ||||||
|             //Yes: |             //Yes: | ||||||
| @ -159,8 +137,6 @@ public class Upgrade303to304 extends Upgrade30xBase implements DbUpgrade { | |||||||
|             //add ntwk service map entries |             //add ntwk service map entries | ||||||
|             //update all guest networks of 1 physical network having this offering id to this new offering id |             //update all guest networks of 1 physical network having this offering id to this new offering id | ||||||
| 
 | 
 | ||||||
|             pstmtZone = conn.prepareStatement("SELECT id, domain_id, networktype, name, uuid FROM `cloud`.`data_center`"); |  | ||||||
|             rsZone = pstmtZone.executeQuery(); |  | ||||||
|             while (rsZone.next()) { |             while (rsZone.next()) { | ||||||
|                 long zoneId = rsZone.getLong(1); |                 long zoneId = rsZone.getLong(1); | ||||||
|                 Long domainId = rsZone.getLong(2); |                 Long domainId = rsZone.getLong(2); | ||||||
| @ -168,331 +144,246 @@ public class Upgrade303to304 extends Upgrade30xBase implements DbUpgrade { | |||||||
|                 String zoneName = rsZone.getString(4); |                 String zoneName = rsZone.getString(4); | ||||||
|                 String uuid = rsZone.getString(5); |                 String uuid = rsZone.getString(5); | ||||||
| 
 | 
 | ||||||
|                 PreparedStatement pstmtUpdate = null; |  | ||||||
|                 if (uuid == null) { |                 if (uuid == null) { | ||||||
|                     uuid = UUID.randomUUID().toString(); |                     uuid = UUID.randomUUID().toString(); | ||||||
|                     String updateUuid = "UPDATE `cloud`.`data_center` SET uuid = ? WHERE id = ?"; |  | ||||||
|                     pstmtUpdate = conn.prepareStatement(updateUuid); |  | ||||||
|                     pstmtUpdate.setString(1, uuid); |                     pstmtUpdate.setString(1, uuid); | ||||||
|                     pstmtUpdate.setLong(2, zoneId); |                     pstmtUpdate.setLong(2, zoneId); | ||||||
|                     pstmtUpdate.executeUpdate(); |                     pstmtUpdate.executeUpdate(); | ||||||
|                     pstmtUpdate.close(); |  | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 //check if any networks were untagged and remaining to be mapped to a physical network |                 //check if any networks were untagged and remaining to be mapped to a physical network | ||||||
|  |                 pstmt_count_networks.setLong(1, zoneId); | ||||||
|  |                 try (ResultSet rsNetworks = pstmt_count_networks.executeQuery();) { | ||||||
|  |                     if (rsNetworks.next()) { | ||||||
|  |                         Long count = rsNetworks.getLong(1); | ||||||
|  |                         if (count > 0) { | ||||||
|  |                             // find the default tag to use from global config or use 'cloud-private' | ||||||
|  |                             String xenGuestLabel = getNetworkLabelFromConfig(conn, "xen.guest.network.device"); | ||||||
|  |                             //Decrypt this value. | ||||||
|  |                             xenGuestLabel = DBEncryptionUtil.decrypt(xenGuestLabel); | ||||||
| 
 | 
 | ||||||
|                 pstmt = |                             //make sure that no physical network with this traffic label already exists. if yes, error out. | ||||||
|                     conn.prepareStatement("SELECT count(n.id) FROM networks n WHERE n.physical_network_id IS NULL AND n.traffic_type = 'Guest' and n.data_center_id = ? and n.removed is null"); |                             if (xenGuestLabel != null) { | ||||||
|                 pstmt.setLong(1, zoneId); |                                 pstmt_count_traffic_types_and_labels.setLong(1, zoneId); | ||||||
|                 rs = pstmt.executeQuery(); |                                 pstmt_count_traffic_types_and_labels.setString(2, xenGuestLabel); | ||||||
|                 if (rs.next()) { |                                 try (ResultSet rsSameLabel = pstmt_count_traffic_types_and_labels.executeQuery();) { | ||||||
|                     Long count = rs.getLong(1); |  | ||||||
|                     if (count > 0) { |  | ||||||
|                         // find the default tag to use from global config or use 'cloud-private' |  | ||||||
|                         String xenGuestLabel = getNetworkLabelFromConfig(conn, "xen.guest.network.device"); |  | ||||||
|                         //Decrypt this value. |  | ||||||
|                         xenGuestLabel = DBEncryptionUtil.decrypt(xenGuestLabel); |  | ||||||
| 
 | 
 | ||||||
|                         //make sure that no physical network with this traffic label already exists. if yes, error out. |                                     if (rsSameLabel.next()) { | ||||||
|                         if (xenGuestLabel != null) { |                                         Long sameLabelcount = rsSameLabel.getLong(1); | ||||||
|                             PreparedStatement pstmt5 = |                                         if (sameLabelcount > 0) { | ||||||
|                                 conn.prepareStatement("SELECT count(*) FROM `cloud`.`physical_network_traffic_types` pntt JOIN `cloud`.`physical_network` pn ON pntt.physical_network_id = pn.id WHERE pntt.traffic_type ='Guest' AND pn.data_center_id = ? AND pntt.xen_network_label = ?"); |                                             s_logger.error("There are untagged networks for which we need to add a physical network with Xen traffic label = 'xen.guest.network.device' config value, which is: " + | ||||||
|                             pstmt5.setLong(1, zoneId); |                                                     xenGuestLabel); | ||||||
|                             pstmt5.setString(2, xenGuestLabel); |                                             s_logger.error("However already there are " + sameLabelcount + " physical networks setup with same traffic label, cannot upgrade"); | ||||||
|                             ResultSet rsSameLabel = pstmt5.executeQuery(); |                                             throw new CloudRuntimeException("Cannot upgrade this setup since a physical network with same traffic label: " + xenGuestLabel + | ||||||
|  |                                                     " already exists, Please check logs and contact Support."); | ||||||
|  |                                         } | ||||||
|  |                                     } | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  |                             //Create a physical network with guest traffic type and this tag | ||||||
|  |                             long physicalNetworkId = addPhysicalNetworkToZone(conn, zoneId, zoneName, networkType, null, domainId); | ||||||
|  |                             addTrafficType(conn, physicalNetworkId, "Guest", xenGuestLabel, null, null); | ||||||
|  |                             addDefaultVRProvider(conn, physicalNetworkId, zoneId); | ||||||
|  |                             addDefaultSGProvider(conn, physicalNetworkId, zoneId, networkType, true); | ||||||
| 
 | 
 | ||||||
|                             if (rsSameLabel.next()) { |                             pstmt_network_id.setLong(1, zoneId); | ||||||
|                                 Long sameLabelcount = rsSameLabel.getLong(1); |                             try (ResultSet rsNet = pstmt_network_id.executeQuery();) { | ||||||
|                                 if (sameLabelcount > 0) { |                                 s_logger.debug("Adding PhysicalNetwork to VLAN"); | ||||||
|                                     s_logger.error("There are untagged networks for which we need to add a physical network with Xen traffic label = 'xen.guest.network.device' config value, which is: " + |                                 s_logger.debug("Adding PhysicalNetwork to user_ip_address"); | ||||||
|                                         xenGuestLabel); |                                 s_logger.debug("Adding PhysicalNetwork to networks"); | ||||||
|                                     s_logger.error("However already there are " + sameLabelcount + " physical networks setup with same traffic label, cannot upgrade"); |                                 while (rsNet.next()) { | ||||||
|                                     throw new CloudRuntimeException("Cannot upgrade this setup since a physical network with same traffic label: " + xenGuestLabel + |                                     Long networkId = rsNet.getLong(1); | ||||||
|                                         " already exists, Please check logs and contact Support."); |                                     addPhysicalNtwk_To_Ntwk_IP_Vlan(conn, physicalNetworkId, networkId); | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
| 
 |  | ||||||
|                         //Create a physical network with guest traffic type and this tag |  | ||||||
|                         long physicalNetworkId = addPhysicalNetworkToZone(conn, zoneId, zoneName, networkType, null, domainId); |  | ||||||
|                         addTrafficType(conn, physicalNetworkId, "Guest", xenGuestLabel, null, null); |  | ||||||
|                         addDefaultVRProvider(conn, physicalNetworkId, zoneId); |  | ||||||
|                         addDefaultSGProvider(conn, physicalNetworkId, zoneId, networkType, true); |  | ||||||
| 
 |  | ||||||
|                         PreparedStatement pstmt3 = |  | ||||||
|                             conn.prepareStatement("SELECT n.id FROM networks n WHERE n.physical_network_id IS NULL AND n.traffic_type = 'Guest' and n.data_center_id = ? and n.removed is null"); |  | ||||||
|                         pstmt3.setLong(1, zoneId); |  | ||||||
|                         ResultSet rsNet = pstmt3.executeQuery(); |  | ||||||
|                         s_logger.debug("Adding PhysicalNetwork to VLAN"); |  | ||||||
|                         s_logger.debug("Adding PhysicalNetwork to user_ip_address"); |  | ||||||
|                         s_logger.debug("Adding PhysicalNetwork to networks"); |  | ||||||
|                         while (rsNet.next()) { |  | ||||||
|                             Long networkId = rsNet.getLong(1); |  | ||||||
|                             addPhysicalNtwk_To_Ntwk_IP_Vlan(conn, physicalNetworkId, networkId); |  | ||||||
|                         } |  | ||||||
|                         rsNet.close(); |  | ||||||
|                         pstmt3.close(); |  | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 rs.close(); |  | ||||||
|                 pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|                 boolean multiplePhysicalNetworks = false; |                 boolean multiplePhysicalNetworks = false; | ||||||
| 
 | 
 | ||||||
|                 pstmt = |                 pstmt_count_traffic_types.setLong(1, zoneId); | ||||||
|                     conn.prepareStatement("SELECT count(*) FROM `cloud`.`physical_network_traffic_types` pntt JOIN `cloud`.`physical_network` pn ON pntt.physical_network_id = pn.id WHERE pntt.traffic_type ='Guest' and pn.data_center_id = ?"); |                 try (ResultSet rs = pstmt_count_traffic_types.executeQuery();) { | ||||||
|                 pstmt.setLong(1, zoneId); |                     if (rs.next()) { | ||||||
|                 rs = pstmt.executeQuery(); |                         Long count = rs.getLong(1); | ||||||
|                 if (rs.next()) { |                         if (count > 1) { | ||||||
|                     Long count = rs.getLong(1); |                             s_logger.debug("There are " + count + " physical networks setup"); | ||||||
|                     if (count > 1) { |                             multiplePhysicalNetworks = true; | ||||||
|                         s_logger.debug("There are " + count + " physical networks setup"); |                         } | ||||||
|                         multiplePhysicalNetworks = true; |  | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 rs.close(); |  | ||||||
|                 pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|                 if (multiplePhysicalNetworks) { |                 if (multiplePhysicalNetworks) { | ||||||
|                     //check if guest vnet is wrongly configured by earlier upgrade. If yes error out |                     //check if guest vnet is wrongly configured by earlier upgrade. If yes error out | ||||||
|                     //check if any vnet is allocated and guest networks are using vnet But the physical network id does not match on the vnet and guest network. |                     //check if any vnet is allocated and guest networks are using vnet But the physical network id does not match on the vnet and guest network. | ||||||
|                     PreparedStatement pstmt4 = |                     pstmt_select_vnets_on_different_physical_net.setLong(1, zoneId); | ||||||
|                         conn.prepareStatement("SELECT v.id, v.vnet, v.reservation_id, v.physical_network_id as vpid, n.id, n.physical_network_id as npid FROM `cloud`.`op_dc_vnet_alloc` v JOIN `cloud`.`networks` n ON CONCAT('vlan://' , v.vnet) = n.broadcast_uri WHERE v.taken IS NOT NULL AND v.data_center_id = ? AND n.removed IS NULL AND v.physical_network_id !=  n.physical_network_id"); |                     try (ResultSet rsVNet = pstmt_select_vnets_on_different_physical_net.executeQuery();) { | ||||||
|                     pstmt4.setLong(1, zoneId); |                         if (rsVNet.next()) { | ||||||
|                     ResultSet rsVNet = pstmt4.executeQuery(); |                             String vnet = rsVNet.getString(2); | ||||||
|                     if (rsVNet.next()) { |                             String networkId = rsVNet.getString(5); | ||||||
|                         String vnet = rsVNet.getString(2); |                             String vpid = rsVNet.getString(4); | ||||||
|                         String networkId = rsVNet.getString(5); |                             String npid = rsVNet.getString(6); | ||||||
|                         String vpid = rsVNet.getString(4); |                             s_logger.error("Guest Vnet assignment is set wrongly . Cannot upgrade until that is corrected. Example- Vnet: " + vnet + | ||||||
|                         String npid = rsVNet.getString(6); |                                     " has physical network id: " + vpid + " ,but the guest network: " + networkId + " that uses it has physical network id: " + npid); | ||||||
|                         s_logger.error("Guest Vnet assignment is set wrongly . Cannot upgrade until that is corrected. Example- Vnet: " + vnet + |  | ||||||
|                             " has physical network id: " + vpid + " ,but the guest network: " + networkId + " that uses it has physical network id: " + npid); |  | ||||||
| 
 | 
 | ||||||
|                         String message = "Cannot upgrade. Your setup has multiple Physical Networks and is using guest Vnet that is assigned wrongly. " |                             String message = "Cannot upgrade. Your setup has multiple Physical Networks and is using guest Vnet that is assigned wrongly. " | ||||||
|                             + "To upgrade, first correct the setup by doing the following: \n" |                                     + "To upgrade, first correct the setup by doing the following: \n" | ||||||
|                             + "1. Please rollback to your 2.2.14 setup\n" |                                     + "1. Please rollback to your 2.2.14 setup\n" | ||||||
|                             + "2. Please stop all VMs using isolated(virtual) networks through CloudStack\n" |                                     + "2. Please stop all VMs using isolated(virtual) networks through CloudStack\n" | ||||||
|                             + "3. Run following query to find if any networks still have nics allocated:\n\t" |                                     + "3. Run following query to find if any networks still have nics allocated:\n\t" | ||||||
|                             + "a) check if any virtual guest networks still have allocated nics by running:\n\t" |                                     + "a) check if any virtual guest networks still have allocated nics by running:\n\t" | ||||||
|                             + "SELECT DISTINCT op.id from `cloud`.`op_networks` op JOIN `cloud`.`networks` n on op.id=n.id WHERE nics_count != 0 AND guest_type = 'Virtual';\n\t" |                                     + "SELECT DISTINCT op.id from `cloud`.`op_networks` op JOIN `cloud`.`networks` n on op.id=n.id WHERE nics_count != 0 AND guest_type = 'Virtual';\n\t" | ||||||
|                             + "b) If this returns any networkd ids, then ensure that all VMs are stopped, no new VM is being started, and then shutdown management server\n\t" |                                     + "b) If this returns any networkd ids, then ensure that all VMs are stopped, no new VM is being started, and then shutdown management server\n\t" | ||||||
|                             + "c) Clean up the nics count for the 'virtual' network id's returned in step (a) by running this:\n\t" |                                     + "c) Clean up the nics count for the 'virtual' network id's returned in step (a) by running this:\n\t" | ||||||
|                             + "UPDATE `cloud`.`op_networks` SET nics_count = 0 WHERE  id = <enter id of virtual network>\n\t" |                                     + "UPDATE `cloud`.`op_networks` SET nics_count = 0 WHERE  id = <enter id of virtual network>\n\t" | ||||||
|                             + "d) Restart management server and wait for all networks to shutdown. " |                                     + "d) Restart management server and wait for all networks to shutdown. " | ||||||
|                             + "[Networks shutdown will be determined by network.gc.interval and network.gc.wait seconds] \n" |                                     + "[Networks shutdown will be determined by network.gc.interval and network.gc.wait seconds] \n" | ||||||
|                             + "4. Please ensure all networks are shutdown and all guest Vnet's are free.\n" |                                     + "4. Please ensure all networks are shutdown and all guest Vnet's are free.\n" | ||||||
|                             + "5. Run upgrade. This will allocate all your guest vnet range to first physical network.  \n" |                                     + "5. Run upgrade. This will allocate all your guest vnet range to first physical network.  \n" | ||||||
|                             + "6. Reconfigure the vnet ranges for each physical network as desired by using updatePhysicalNetwork API \n" + "7. Start all your VMs"; |                                     + "6. Reconfigure the vnet ranges for each physical network as desired by using updatePhysicalNetwork API \n" + "7. Start all your VMs"; | ||||||
| 
 | 
 | ||||||
|                         s_logger.error(message); |                             s_logger.error(message); | ||||||
|                         throw new CloudRuntimeException("Cannot upgrade this setup since Guest Vnet assignment to the multiple physical networks " + |                             throw new CloudRuntimeException("Cannot upgrade this setup since Guest Vnet assignment to the multiple physical networks " + | ||||||
|                             "is incorrect. Please check the logs for details on how to proceed"); |                                     "is incorrect. Please check the logs for details on how to proceed"); | ||||||
| 
 | 
 | ||||||
|  |                         } | ||||||
|                     } |                     } | ||||||
|                     rsVNet.close(); |  | ||||||
|                     pstmt4.close(); |  | ||||||
| 
 | 
 | ||||||
|                     //Clean up any vnets that have no live networks/nics |                     //Clean up any vnets that have no live networks/nics | ||||||
|                     pstmt4 = |                     pstmt_select_vnets.setLong(1, zoneId); | ||||||
|                         conn.prepareStatement("SELECT v.id, v.vnet, v.reservation_id FROM `cloud`.`op_dc_vnet_alloc` v LEFT JOIN networks n ON CONCAT('vlan://' , v.vnet) = n.broadcast_uri WHERE v.taken IS NOT NULL AND v.data_center_id = ? AND n.broadcast_uri IS NULL AND n.removed IS NULL"); |                     try (ResultSet rsVNet = pstmt_select_vnets.executeQuery();) { | ||||||
|                     pstmt4.setLong(1, zoneId); |                         while (rsVNet.next()) { | ||||||
|                     rsVNet = pstmt4.executeQuery(); |                             Long vnet_id = rsVNet.getLong(1); | ||||||
|                     while (rsVNet.next()) { |                             String vnetValue = rsVNet.getString(2); | ||||||
|                         Long vnet_id = rsVNet.getLong(1); |                             // third result parameter is never used: String reservationId = rsVNet.getString(3); | ||||||
|                         String vnetValue = rsVNet.getString(2); |                             //does this vnet have any nic associated? | ||||||
|                         String reservationId = rsVNet.getString(3); |                             String uri = "vlan://" + vnetValue; | ||||||
|                         //does this vnet have any nic associated? |                             pstmt_select_nic_ids.setString(1, uri); | ||||||
|                         PreparedStatement pstmt5 = conn.prepareStatement("SELECT id, instance_id FROM `cloud`.`nics` where broadcast_uri = ? and removed IS NULL"); |                             try (ResultSet rsNic = pstmt_select_nic_ids.executeQuery();) { | ||||||
|                         String uri = "vlan://" + vnetValue; |                                 Long nic_id = rsNic.getLong(1); | ||||||
|                         pstmt5.setString(1, uri); |                                 Long instance_id = rsNic.getLong(2); | ||||||
|                         ResultSet rsNic = pstmt5.executeQuery(); |                                 if (rsNic.next()) { | ||||||
|                         Long nic_id = rsNic.getLong(1); |                                     throw new CloudRuntimeException("Cannot upgrade. Please cleanup the guest vnet: " + vnetValue + " , it is being used by nic_id: " + nic_id + | ||||||
|                         Long instance_id = rsNic.getLong(2); |                                             " , instance_id: " + instance_id); | ||||||
|                         if (rsNic.next()) { |                                 } | ||||||
|                             throw new CloudRuntimeException("Cannot upgrade. Please cleanup the guest vnet: " + vnetValue + " , it is being used by nic_id: " + nic_id + |                             } | ||||||
|                                 " , instance_id: " + instance_id); |                             //free this vnet | ||||||
|  |                             pstmt_update_vnet_alloc.setLong(1, vnet_id); | ||||||
|  |                             pstmt_update_vnet_alloc.executeUpdate(); | ||||||
|  |                             pstmt_update_vnet_alloc.close(); | ||||||
|                         } |                         } | ||||||
| 
 |  | ||||||
|                         //free this vnet |  | ||||||
|                         String freeVnet = "UPDATE `cloud`.`op_dc_vnet_alloc` SET account_id = NULL, taken = NULL, reservation_id = NULL WHERE id = ?"; |  | ||||||
|                         pstmtUpdate = conn.prepareStatement(freeVnet); |  | ||||||
|                         pstmtUpdate.setLong(1, vnet_id); |  | ||||||
|                         pstmtUpdate.executeUpdate(); |  | ||||||
|                         pstmtUpdate.close(); |  | ||||||
|                     } |                     } | ||||||
|                     rsVNet.close(); |  | ||||||
|                     pstmt4.close(); |  | ||||||
| 
 | 
 | ||||||
|                     //add tags to the physical networks if not present and clone offerings |                     //add tags to the physical networks if not present and clone offerings | ||||||
| 
 | 
 | ||||||
|                     pstmt = |                     pstmt_physical_network_tags.setLong(1, zoneId); | ||||||
|                         conn.prepareStatement("SELECT pn.id as pid , ptag.tag as tag FROM `cloud`.`physical_network` pn LEFT JOIN `cloud`.`physical_network_tags` ptag ON pn.id = ptag.physical_network_id where pn.data_center_id = ?"); |                     try (ResultSet rs_network_count = pstmt_physical_network_tags.executeQuery();) { | ||||||
|                     pstmt.setLong(1, zoneId); |                         while (rs_network_count.next()) { | ||||||
|                     rs = pstmt.executeQuery(); |                             long physicalNetworkId = rs_network_count.getLong("pid"); | ||||||
|                     while (rs.next()) { |                             String tag = rs_network_count.getString("tag"); | ||||||
|                         long physicalNetworkId = rs.getLong("pid"); |                             if (tag == null) { | ||||||
|                         String tag = rs.getString("tag"); |                                 //need to add unique tag | ||||||
|                         if (tag == null) { |                                 String newTag = "pNtwk-tag-" + physicalNetworkId; | ||||||
|                             //need to add unique tag |  | ||||||
|                             String newTag = "pNtwk-tag-" + physicalNetworkId; |  | ||||||
| 
 | 
 | ||||||
|                             String updateVnet = "INSERT INTO `cloud`.`physical_network_tags`(tag, physical_network_id) VALUES( ?, ? )"; |                                 pstmt_insert_physical_networkTags.setString(1, newTag); | ||||||
|                             pstmtUpdate = conn.prepareStatement(updateVnet); |                                 pstmt_insert_physical_networkTags.setLong(2, physicalNetworkId); | ||||||
|                             pstmtUpdate.setString(1, newTag); |                                 pstmt_insert_physical_networkTags.executeUpdate(); | ||||||
|                             pstmtUpdate.setLong(2, physicalNetworkId); |                                 pstmt_insert_physical_networkTags.close(); | ||||||
|                             pstmtUpdate.executeUpdate(); |  | ||||||
|                             pstmtUpdate.close(); |  | ||||||
| 
 | 
 | ||||||
|                             //clone offerings and tag them with this new tag, if there are any guest networks for this physical network |                                 //clone offerings and tag them with this new tag, if there are any guest networks for this physical network | ||||||
| 
 |                                 pstmt_select_distict_netoffers.setLong(1, physicalNetworkId); | ||||||
|                             PreparedStatement pstmt2 = null; |                                 try (ResultSet rs_netoffers = pstmt_select_distict_netoffers.executeQuery();) { | ||||||
|                             ResultSet rs2 = null; |                                     while (rs_netoffers.next()) { | ||||||
| 
 |                                         //clone each offering, add new tag, clone offering-svc-map, update guest networks with new offering id | ||||||
|                             pstmt2 = |                                         long networkOfferingId = rs_netoffers.getLong(1); | ||||||
|                                 conn.prepareStatement("SELECT distinct network_offering_id FROM `cloud`.`networks` where traffic_type= 'Guest' and physical_network_id = ? and removed is null"); |                                         cloneOfferingAndAddTag(conn, networkOfferingId, physicalNetworkId, newTag); | ||||||
|                             pstmt2.setLong(1, physicalNetworkId); |                                     } | ||||||
|                             rs2 = pstmt2.executeQuery(); |                                 } | ||||||
| 
 |  | ||||||
|                             while (rs2.next()) { |  | ||||||
|                                 //clone each offering, add new tag, clone offering-svc-map, update guest networks with new offering id |  | ||||||
|                                 long networkOfferingId = rs2.getLong(1); |  | ||||||
|                                 cloneOfferingAndAddTag(conn, networkOfferingId, physicalNetworkId, newTag); |  | ||||||
|                             } |                             } | ||||||
|                             rs2.close(); |  | ||||||
|                             pstmt2.close(); |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     rs.close(); |  | ||||||
|                     pstmt.close(); |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (SQLException e) { |         } catch (SQLException e) { | ||||||
|             throw new CloudRuntimeException("Exception while correcting PhysicalNetwork setup", e); |             throw new CloudRuntimeException("Exception while correcting PhysicalNetwork setup", e); | ||||||
|         } finally { |  | ||||||
|             if (rsZone != null) { |  | ||||||
|                 try { |  | ||||||
|                     rsZone.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (pstmtZone != null) { |  | ||||||
|                 try { |  | ||||||
|                     pstmtZone.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (rs != null) { |  | ||||||
|                 try { |  | ||||||
|                     rs.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (pstmt != null) { |  | ||||||
|                 try { |  | ||||||
|                     pstmt.close(); |  | ||||||
|                 } catch (SQLException e) { |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private void cloneOfferingAndAddTag(Connection conn, long networkOfferingId, long physicalNetworkId, String newTag) { |     private void cloneOfferingAndAddTag(Connection conn, long networkOfferingId, long physicalNetworkId, String newTag) { | ||||||
| 
 | 
 | ||||||
|         PreparedStatement pstmt = null; |         try (PreparedStatement pstmt_count_offerings = conn.prepareStatement("select count(*) from `cloud`.`network_offerings`"); | ||||||
|         ResultSet rs = null; |                 PreparedStatement pstmt_drop_temp_table = conn.prepareStatement("DROP TEMPORARY TABLE IF EXISTS `cloud`.`network_offerings2`"); | ||||||
|         try { |                 PreparedStatement pstmt_create_temp_table = conn.prepareStatement("CREATE TEMPORARY TABLE `cloud`.`network_offerings2` ENGINE=MEMORY SELECT * FROM `cloud`.`network_offerings` WHERE id=1"); | ||||||
|             pstmt = conn.prepareStatement("select count(*) from `cloud`.`network_offerings`"); |                 PreparedStatement pstmt_copy_net_offer = conn.prepareStatement("INSERT INTO `cloud`.`network_offerings2` SELECT * FROM `cloud`.`network_offerings` WHERE id=?"); | ||||||
|             rs = pstmt.executeQuery(); |                 PreparedStatement pstmt_unique_name = conn.prepareStatement("SELECT unique_name FROM `cloud`.`network_offerings` WHERE id=?"); | ||||||
|  |                 PreparedStatement pstmt_update_temp_offer = conn.prepareStatement("UPDATE `cloud`.`network_offerings2` SET id=?, unique_name=?, name=?, tags=?, uuid=?  WHERE id=?"); | ||||||
|  |                 PreparedStatement pstmt_update_offering = conn.prepareStatement("INSERT INTO `cloud`.`network_offerings` SELECT * from `cloud`.`network_offerings2` WHERE id= ?"); | ||||||
|  |                 PreparedStatement pstmt_select_service = conn.prepareStatement("select service, provider from `cloud`.`ntwk_offering_service_map` where network_offering_id=?"); | ||||||
|  |                 PreparedStatement pstmt_insert_netofferservicemap = | ||||||
|  |                         conn.prepareStatement("INSERT INTO `cloud`.`ntwk_offering_service_map` (`network_offering_id`, `service`, `provider`, `created`) values (?,?,?, now())"); | ||||||
|  |                 PreparedStatement pstmt_update_networks = | ||||||
|  |                         conn.prepareStatement("UPDATE `cloud`.`networks` SET network_offering_id=? where physical_network_id=? and traffic_type ='Guest' and network_offering_id= ?"); | ||||||
|  |                 ResultSet rs_net_offer_count = pstmt_count_offerings.executeQuery(); | ||||||
|  |             ) { | ||||||
|             long ntwkOffCount = 0; |             long ntwkOffCount = 0; | ||||||
|             while (rs.next()) { |             while (rs_net_offer_count.next()) { | ||||||
|                 ntwkOffCount = rs.getLong(1); |                 ntwkOffCount = rs_net_offer_count.getLong(1); | ||||||
|             } |             } | ||||||
|             rs.close(); |  | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|             pstmt = conn.prepareStatement("DROP TEMPORARY TABLE IF EXISTS `cloud`.`network_offerings2`"); |             pstmt_drop_temp_table.executeUpdate(); | ||||||
|             pstmt.executeUpdate(); |  | ||||||
| 
 | 
 | ||||||
|             pstmt = conn.prepareStatement("CREATE TEMPORARY TABLE `cloud`.`network_offerings2` ENGINE=MEMORY SELECT * FROM `cloud`.`network_offerings` WHERE id=1"); |             pstmt_create_temp_table.executeUpdate(); | ||||||
|             pstmt.executeUpdate(); |  | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|             // clone the record to |             // clone the record to | ||||||
|             pstmt = conn.prepareStatement("INSERT INTO `cloud`.`network_offerings2` SELECT * FROM `cloud`.`network_offerings` WHERE id=?"); |             pstmt_copy_net_offer.setLong(1, networkOfferingId); | ||||||
|             pstmt.setLong(1, networkOfferingId); |             pstmt_copy_net_offer.executeUpdate(); | ||||||
|             pstmt.executeUpdate(); |  | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|             pstmt = conn.prepareStatement("SELECT unique_name FROM `cloud`.`network_offerings` WHERE id=?"); |             pstmt_unique_name.setLong(1, networkOfferingId); | ||||||
|             pstmt.setLong(1, networkOfferingId); |  | ||||||
|             rs = pstmt.executeQuery(); |  | ||||||
|             String uniqueName = null; |             String uniqueName = null; | ||||||
|             while (rs.next()) { |             try (ResultSet rs_unique_name = pstmt_unique_name.executeQuery();) { | ||||||
|                 uniqueName = rs.getString(1) + "-" + physicalNetworkId; |                 while (rs_unique_name.next()) { | ||||||
|  |                     uniqueName = rs_unique_name.getString(1) + "-" + physicalNetworkId; | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|             rs.close(); |  | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|             pstmt = conn.prepareStatement("UPDATE `cloud`.`network_offerings2` SET id=?, unique_name=?, name=?, tags=?, uuid=?  WHERE id=?"); |  | ||||||
|             ntwkOffCount = ntwkOffCount + 1; |             ntwkOffCount = ntwkOffCount + 1; | ||||||
|             long newNetworkOfferingId = ntwkOffCount; |             long newNetworkOfferingId = ntwkOffCount; | ||||||
|             pstmt.setLong(1, newNetworkOfferingId); |             pstmt_update_temp_offer.setLong(1, newNetworkOfferingId); | ||||||
|             pstmt.setString(2, uniqueName); |             pstmt_update_temp_offer.setString(2, uniqueName); | ||||||
|             pstmt.setString(3, uniqueName); |             pstmt_update_temp_offer.setString(3, uniqueName); | ||||||
|             pstmt.setString(4, newTag); |             pstmt_update_temp_offer.setString(4, newTag); | ||||||
|             String uuid = UUID.randomUUID().toString(); |             String uuid = UUID.randomUUID().toString(); | ||||||
|             pstmt.setString(5, uuid); |             pstmt_update_temp_offer.setString(5, uuid); | ||||||
|             pstmt.setLong(6, networkOfferingId); |             pstmt_update_temp_offer.setLong(6, networkOfferingId); | ||||||
|             pstmt.executeUpdate(); |             pstmt_update_temp_offer.executeUpdate(); | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|             pstmt = conn.prepareStatement("INSERT INTO `cloud`.`network_offerings` SELECT * from `cloud`.`network_offerings2` WHERE id=" + newNetworkOfferingId); |             pstmt_update_offering.setLong(1, newNetworkOfferingId); | ||||||
|             pstmt.executeUpdate(); |             pstmt_update_offering.executeUpdate(); | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|             //clone service map |             //clone service map | ||||||
|             pstmt = conn.prepareStatement("select service, provider from `cloud`.`ntwk_offering_service_map` where network_offering_id=?"); |             pstmt_select_service.setLong(1, networkOfferingId); | ||||||
|             pstmt.setLong(1, networkOfferingId); |             try (ResultSet rs_service = pstmt_select_service.executeQuery();) { | ||||||
|             rs = pstmt.executeQuery(); |                 while (rs_service.next()) { | ||||||
|             while (rs.next()) { |                     String service = rs_service.getString(1); | ||||||
|                 String service = rs.getString(1); |                     String provider = rs_service.getString(2); | ||||||
|                 String provider = rs.getString(2); |                     pstmt_insert_netofferservicemap.setLong(1, newNetworkOfferingId); | ||||||
|                 pstmt = |                     pstmt_insert_netofferservicemap.setString(2, service); | ||||||
|                     conn.prepareStatement("INSERT INTO `cloud`.`ntwk_offering_service_map` (`network_offering_id`, `service`, `provider`, `created`) values (?,?,?, now())"); |                     pstmt_insert_netofferservicemap.setString(3, provider); | ||||||
|                 pstmt.setLong(1, newNetworkOfferingId); |                     pstmt_insert_netofferservicemap.executeUpdate(); | ||||||
|                 pstmt.setString(2, service); |                 } | ||||||
|                 pstmt.setString(3, provider); |  | ||||||
|                 pstmt.executeUpdate(); |  | ||||||
|             } |             } | ||||||
|             rs.close(); |  | ||||||
|             pstmt.close(); |  | ||||||
| 
 |  | ||||||
|             pstmt = |  | ||||||
|                 conn.prepareStatement("UPDATE `cloud`.`networks` SET network_offering_id=? where physical_network_id=? and traffic_type ='Guest' and network_offering_id=" + |  | ||||||
|                     networkOfferingId); |  | ||||||
|             pstmt.setLong(1, newNetworkOfferingId); |  | ||||||
|             pstmt.setLong(2, physicalNetworkId); |  | ||||||
|             pstmt.executeUpdate(); |  | ||||||
|             pstmt.close(); |  | ||||||
| 
 | 
 | ||||||
|  |             pstmt_update_networks.setLong(1, newNetworkOfferingId); | ||||||
|  |             pstmt_update_networks.setLong(2, physicalNetworkId); | ||||||
|  |             pstmt_update_networks.setLong(3, networkOfferingId); | ||||||
|  |             pstmt_update_networks.executeUpdate(); | ||||||
|         } catch (SQLException e) { |         } catch (SQLException e) { | ||||||
|             throw new CloudRuntimeException("Exception while cloning NetworkOffering", e); |             throw new CloudRuntimeException("Exception while cloning NetworkOffering", e); | ||||||
|         } finally { |         } finally { | ||||||
|             try { |             try (PreparedStatement pstmt_drop_table = conn.prepareStatement("DROP TEMPORARY TABLE `cloud`.`network_offerings2`");) { | ||||||
|                 pstmt = conn.prepareStatement("DROP TEMPORARY TABLE `cloud`.`network_offerings2`"); |                 pstmt_drop_table.executeUpdate(); | ||||||
|                 pstmt.executeUpdate(); |  | ||||||
| 
 |  | ||||||
|                 if (rs != null) { |  | ||||||
|                     rs.close(); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (pstmt != null) { |  | ||||||
|                     pstmt.close(); |  | ||||||
|                 } |  | ||||||
|             } catch (SQLException e) { |             } catch (SQLException e) { | ||||||
|  |                 s_logger.debug("drop of temp table 'network_offerings2' failed", e); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user