This is an automated email from the ASF dual-hosted git repository.

wido pushed a commit to branch direct-routed-network
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/direct-routed-network by this 
push:
     new e5f1b64b6d7 Direct Routed networks: skip the PVLAN overlap check for 
routed:// URIs
e5f1b64b6d7 is described below

commit e5f1b64b6d766c20f02e0ffce7d128a502673efe
Author: Wido den Hollander <[email protected]>
AuthorDate: Sat Sep 5 19:13:48 2026 +0000

    Direct Routed networks: skip the PVLAN overlap check for routed:// URIs
    
    Creating an L3 network died in NetworkOrchestrator.createGuestNetwork():
    after encodeVlanIdIntoBroadcastUri() produced routed://<id>, the
    unconditional PVLAN overlap check handed that URI to
    listByPhysicalNetworkPvlan(), which rejects every URI scheme other than
    vlan:// and vxlan://:
    
      'Requested URI routed://189 is not in the expected format. Expected
       URI Scheme as vlan://VID or vxlan://VID.'
    
    The check is meaningless for a routed id: no PVLAN network can exist on
    a ROUTED physical network (only L3 networks can), and the id's real
    overlap checks - zone-wide URI, public ranges, the vnet range - have
    already run earlier in the method. Skip it when the URI scheme is
    routed.
    
    Also reject the isolatedpvlan parameter for L3 networks explicitly, so
    the pvlan branch (which would build a pvlan:// URI around the routed id)
    is unreachable for this guest type.
---
 .../cloudstack/engine/orchestration/NetworkOrchestrator.java       | 7 ++++++-
 server/src/main/java/com/cloud/network/NetworkServiceImpl.java     | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
 
b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 24f9b83ac2a..35bc55e1d35 100644
--- 
a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ 
b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -3192,7 +3192,12 @@ public class NetworkOrchestrator extends ManagerBase 
implements NetworkOrchestra
                                 uri = 
encodeVlanIdIntoBroadcastUri(vlanIdFinal, pNtwk);
                             }
 
-                            if 
(_networksDao.listByPhysicalNetworkPvlan(physicalNetworkId, 
uri.toString()).size() > 0) {
+                            // The PVLAN overlap check only understands 
vlan:// and vxlan:// URIs. A
+                            // routed:// URI is a bridge label on a ROUTED 
physical network, where no
+                            // PVLAN network can exist; its overlap checks 
(zone-wide URI, public
+                            // ranges, vnet range) have already run above.
+                            final boolean isRoutedUri = uri != null && 
BroadcastDomainType.getSchemeValue(uri) == BroadcastDomainType.Routed;
+                            if (!isRoutedUri && 
_networksDao.listByPhysicalNetworkPvlan(physicalNetworkId, 
uri.toString()).size() > 0) {
                                 throw new 
InvalidParameterValueException(String.format(
                                         "Network with vlan %s already exists 
or overlaps with other network pvlans in zone %s",
                                         vlanIdFinal, zone));
diff --git a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java 
b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java
index d76a960834d..7d23ca9a973 100644
--- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java
@@ -1731,7 +1731,7 @@ public class NetworkServiceImpl extends ManagerBase 
implements NetworkService, C
             if (!_accountMgr.isRootAdmin(caller.getId())) {
                 throw new InvalidParameterValueException("Only ROOT admin is 
allowed to create Private VLAN network");
             }
-            if (zone.getNetworkType() != NetworkType.Advanced || 
ntwkOff.getGuestType() == GuestType.Isolated) {
+            if (zone.getNetworkType() != NetworkType.Advanced || 
ntwkOff.getGuestType() == GuestType.Isolated || ntwkOff.getGuestType() == 
GuestType.L3) {
                 throw new InvalidParameterValueException("Can only support 
create Private VLAN network with advanced shared or L2 network!");
             }
             if (ipv6) {

Reply via email to