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

pearl11594 pushed a commit to branch netris-integration-upstream
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit c02592e2810e586aa2a535791a50de18b441dec4
Author: Pearl Dsilva <pearl1...@gmail.com>
AuthorDate: Tue Nov 26 14:20:25 2024 -0500

    Run moodifyvxlan script if broadcast domain type is Netris (#18)
---
 .../com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
index 26b8de53083..8ed780a9714 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
@@ -51,6 +51,10 @@ public class BridgeVifDriver extends VifDriverBase {
     private String _controlCidr = NetUtils.getLinkLocalCIDR();
     private Long libvirtVersion;
 
+    private static boolean isVxlanOrNetris(String protocol) {
+        return protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme()) || 
protocol.equals(Networks.BroadcastDomainType.Netris.scheme());
+    }
+
     @Override
     public void configure(Map<String, Object> params) throws 
ConfigurationException {
 
@@ -177,7 +181,7 @@ public class BridgeVifDriver extends VifDriverBase {
 
     protected boolean isBroadcastTypeVlanOrVxlan(final NicTO nic) {
         return nic != null && (nic.getBroadcastType() == 
Networks.BroadcastDomainType.Vlan
-                || nic.getBroadcastType() == 
Networks.BroadcastDomainType.Vxlan);
+                || nic.getBroadcastType() == 
Networks.BroadcastDomainType.Vxlan || nic.getBroadcastType() == 
Networks.BroadcastDomainType.Netris);
     }
 
     protected boolean isValidProtocolAndVnetId(final String vNetId, final 
String protocol) {
@@ -284,7 +288,7 @@ public class BridgeVifDriver extends VifDriverBase {
 
     private String createVnetBr(String vNetId, String pifKey, String protocol) 
throws InternalErrorException {
         String nic = _pifs.get(pifKey);
-        if (nic == null || 
protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
+        if (nic == null || isVxlanOrNetris(protocol)) {
             // if not found in bridge map, maybe traffic label refers to pif 
already?
             File pif = new File("/sys/class/net/" + pifKey);
             if (pif.isDirectory()) {
@@ -292,7 +296,7 @@ public class BridgeVifDriver extends VifDriverBase {
             }
         }
         String brName = "";
-        if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
+        if (isVxlanOrNetris(protocol)) {
             brName = generateVxnetBrName(nic, vNetId);
         } else {
             brName = generateVnetBrName(nic, vNetId);
@@ -304,7 +308,7 @@ public class BridgeVifDriver extends VifDriverBase {
     private void createVnet(String vnetId, String pif, String brName, String 
protocol) throws InternalErrorException {
         synchronized (_vnetBridgeMonitor) {
             String script = _modifyVlanPath;
-            if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
+            if (isVxlanOrNetris(protocol)) {
                 script = _modifyVxlanPath;
             }
             final Script command = new Script(script, _timeout, logger);
@@ -358,6 +362,7 @@ public class BridgeVifDriver extends VifDriverBase {
             }
 
             String scriptPath = null;
+            // TODO: check for netris as well
             if (cmdout != null && cmdout.contains("vxlan")) {
                 scriptPath = _modifyVxlanPath;
             } else {

Reply via email to