Updated Branches:
  refs/heads/3.0.x d4447cc22 -> 9fcfb70d4

CS-13944: 2.2.x - 3.0 db upgrade for multiple physical networks

Changes:

- Need to add physical network references to public network related vlan entries


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/9fcfb70d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/9fcfb70d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/9fcfb70d

Branch: refs/heads/3.0.x
Commit: 9fcfb70d4aaebc3f9ca0acf29409b3ef1b5344a0
Parents: d4447cc
Author: prachi <[email protected]>
Authored: Tue May 29 15:03:16 2012 -0700
Committer: prachi <[email protected]>
Committed: Tue Jun 5 14:57:47 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade2214to30.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9fcfb70d/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java 
b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
index 14fab7d..ace9c15 100755
--- a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
@@ -64,7 +64,7 @@ public class Upgrade2214to30 implements DbUpgrade {
     @Override
     public void performDataMigration(Connection conn) {
        // Fail upgrade if encryption is not enabled
-       if(!EncryptionSecretKeyChecker.useEncryption()){
+        if(!EncryptionSecretKeyChecker.useEncryption()){
                throw new CloudRuntimeException("Encryption is not enabled. 
Please Run cloud-setup-encryption to enable encryption");
        }
        
@@ -382,8 +382,19 @@ public class Upgrade2214to30 implements DbUpgrade {
                             addPhysicalNtwk_To_Ntwk_IP_Vlan(conn, 
physicalNetworkId,networkId);
                         }
                         pstmt3.close();
+
+                        // add the reference to this physical network for the 
default public network entries in vlan / user_ip_address tables
                         // add first physicalNetworkId to op_dc_vnet_alloc for 
this zone - just a placeholder since direct networking dont need this
                         if(isFirstPhysicalNtwk){
+                            s_logger.debug("Adding PhysicalNetwork to default 
Public network entries in vlan and user_ip_address");
+                            pstmt3 = conn.prepareStatement("SELECT id FROM 
`cloud`.`networks` where traffic_type = 'Public' and data_center_id = "+zoneId);
+                            ResultSet rsPubNet = pstmt3.executeQuery();
+                            if(rsPubNet.next()){
+                                Long publicNetworkId = rsPubNet.getLong(1);
+                                addPhysicalNtwk_To_Ntwk_IP_Vlan(conn, 
physicalNetworkId,publicNetworkId);
+                            }
+                            pstmt3.close();
+                            
                             s_logger.debug("Adding PhysicalNetwork to 
op_dc_vnet_alloc");
                             String updateVnet = "UPDATE 
`cloud`.`op_dc_vnet_alloc` SET physical_network_id = " + physicalNetworkId + " 
WHERE data_center_id = " + zoneId;
                             pstmtUpdate = conn.prepareStatement(updateVnet);

Reply via email to