server: pass network label of physical network when plug nic for private gateway on hypervisor (#11846)

This commit is contained in:
Wei Zhou 2026-01-29 13:47:08 +01:00 committed by GitHub
parent 3ba5c2b610
commit aef3df7577
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -137,7 +137,9 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
}
sc.setParameters("physicalNetworkId", physicalNetworkId);
sc.setParameters("trafficType", trafficType);
if (trafficType != null) {
sc.setParameters("trafficType", trafficType);
}
List<String> tag = customSearch(sc, null);
return tag.size() == 0 ? null : tag.get(0);

View File

@ -232,7 +232,7 @@ public class BridgeVifDriver extends VifDriverBase {
String brName = createVnetBr(vNetId, trafficLabel, protocol);
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
} else {
String brName = createVnetBr(vNetId, _bridges.get("private"), protocol);
String brName = createVnetBr(vNetId, _bridges.get("guest"), protocol);
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
}
} else {

View File

@ -1442,11 +1442,11 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi
return null;
}
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
Long physicalNetworkId = null;
if (effectiveTrafficType != TrafficType.Guest) {
physicalNetworkId = getNonGuestNetworkPhysicalNetworkId(network, effectiveTrafficType);
} else {
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
physicalNetworkId = network.getPhysicalNetworkId();
if (physicalNetworkId == null) {
physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), offering.getTags(), offering.getTrafficType());
@ -1459,6 +1459,10 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi
return null;
}
if (offering != null && TrafficType.Guest.equals(offering.getTrafficType()) && offering.isSystemOnly()) {
// For private gateway, do not check the Guest traffic type
return _pNTrafficTypeDao.getNetworkTag(physicalNetworkId, null, hType);
}
return _pNTrafficTypeDao.getNetworkTag(physicalNetworkId, effectiveTrafficType, hType);
}