mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
This commit is contained in:
parent
476ad0be62
commit
ec1f48a4b2
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user