Skip to content

Commit 647fe01

Browse files
weizhouapachedhslove
authored andcommitted
server: pass network label of physical network when plug nic for private gateway on hypervisor (apache#11846)
1 parent 1282ae6 commit 647fe01

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

engine/schema/src/main/java/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ public String getNetworkTag(long physicalNetworkId, TrafficType trafficType, Hyp
137137
}
138138

139139
sc.setParameters("physicalNetworkId", physicalNetworkId);
140-
sc.setParameters("trafficType", trafficType);
140+
if (trafficType != null) {
141+
sc.setParameters("trafficType", trafficType);
142+
}
141143
List<String> tag = customSearch(sc, null);
142144

143145
return tag.size() == 0 ? null : tag.get(0);

server/src/main/java/com/cloud/network/NetworkModelImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,11 +1453,11 @@ public String getNetworkTag(HypervisorType hType, Network network) {
14531453
return null;
14541454
}
14551455

1456+
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
14561457
Long physicalNetworkId = null;
14571458
if (effectiveTrafficType != TrafficType.Guest) {
14581459
physicalNetworkId = getNonGuestNetworkPhysicalNetworkId(network, effectiveTrafficType);
14591460
} else {
1460-
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
14611461
physicalNetworkId = network.getPhysicalNetworkId();
14621462
if (physicalNetworkId == null) {
14631463
physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), offering.getTags(), offering.getTrafficType());
@@ -1470,6 +1470,10 @@ public String getNetworkTag(HypervisorType hType, Network network) {
14701470
return null;
14711471
}
14721472

1473+
if (offering != null && TrafficType.Guest.equals(offering.getTrafficType()) && offering.isSystemOnly()) {
1474+
// For private gateway, do not check the Guest traffic type
1475+
return _pNTrafficTypeDao.getNetworkTag(physicalNetworkId, null, hType);
1476+
}
14731477
return _pNTrafficTypeDao.getNetworkTag(physicalNetworkId, effectiveTrafficType, hType);
14741478
}
14751479

0 commit comments

Comments
 (0)