incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [2/45] git commit: refs/heads/storage_refactor - CLOUDSTACK-1331: Upgrade fails for a 2.2.14 Zone having multiple guest networks using network_tags and Public Vlan
Date Thu, 21 Feb 2013 19:15:17 GMT
CLOUDSTACK-1331: Upgrade fails for a 2.2.14 Zone having multiple guest networks using network_tags
and Public Vlan

Changes:
-We need to update the physical_network_id for public vlans.
-Physical network ID should be retrieved from the network if present.


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

Branch: refs/heads/storage_refactor
Commit: ec1f48a4b2c31b1f7c3854b0b2ada5322a18e42f
Parents: 476ad0b
Author: Prachi Damle <prachi@cloud.com>
Authored: Wed Feb 20 11:22:28 2013 -0800
Committer: Prachi Damle <prachi@cloud.com>
Committed: Wed Feb 20 11:23:32 2013 -0800

----------------------------------------------------------------------
 .../network/guru/NiciraNvpGuestNetworkGuru.java    |    7 ++++++-
 .../com/cloud/network/guru/GuestNetworkGuru.java   |    7 ++++++-
 .../src/com/cloud/upgrade/dao/Upgrade2214to30.java |   11 +++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ec1f48a4/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
index 3ba6167..b78d165 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
@@ -151,7 +151,12 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
         long dcId = dest.getDataCenter().getId();
 
         //get physical network id
-        long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(),
offering.getTrafficType());
+        Long physicalNetworkId = network.getPhysicalNetworkId();
+        
+        // physical network id can be null in Guest Network in Basic zone, so locate the
physical network
+        if (physicalNetworkId == null) {        
+            physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(),
offering.getTrafficType());
+        }
 
         NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(),
network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
                 network.getDataCenterId(), physicalNetworkId);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ec1f48a4/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
index ab8a069..cc79d30 100755
--- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
@@ -314,7 +314,12 @@ public abstract class GuestNetworkGuru extends AdapterBase implements
NetworkGur
         long dcId = dest.getDataCenter().getId();
 
         //get physical network id
-        long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(),
offering.getTrafficType());
+        Long physicalNetworkId = network.getPhysicalNetworkId();
+        
+       // physical network id can be null in Guest Network in Basic zone, so locate the physical
network
+       if (physicalNetworkId == null) {        
+           physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(),
offering.getTrafficType());
+       }
 
         NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(),

                 network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ec1f48a4/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 88370c1..c0f827e 100755
--- a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
@@ -266,8 +266,19 @@ public class Upgrade2214to30 extends Upgrade30xBase 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);


Mime
View raw message