DaanHoogland commented on code in PR #11193:
URL: https://github.com/apache/cloudstack/pull/11193#discussion_r4579328987


##########
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
##########
@@ -2785,7 +2785,7 @@ protected XsLocalNetwork getManagementNetwork(final 
Connection conn) throws XmlR
         for (final PIF pif : hostPifs) {
             final PIF.Record rec = pif.getRecord(conn);
             if (rec.management) {
-                if (rec.VLAN != null && rec.VLAN != -1) {
+                if (!isVlanAllowedForManagementPif(rec)) {

Review Comment:
   make
   ```
   +                        boolean vlanMgmtSupported = false;
   +                        try {
   +                            final java.util.Map<String, String> sw = 
host.getSoftwareVersion(conn);
   +                            final String productVersion = 
sw.get("product_version");
   +                            if (productVersion != null) {
   +                                vlanMgmtSupported = 
Integer.parseInt(productVersion.split("\\.")[0]) >= 8;
   +                            }
   +                        } catch (final Exception e) {
   +                            logger.warn("Could not determine product 
version of host " + citrixResourceBase.getHost().getUuid() + "; assuming VLAN 
management network is unsupported", e);
   +                        }
   +                        if (!vlanMgmtSupported && rec.VLAN != null && 
rec.VLAN != -1) {
   ```
   a method



##########
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java:
##########
@@ -104,7 +104,7 @@ public Answer execute(final SetupCommand command, final 
CitrixResourceBase citri
                 for (final PIF pif : hostPifs) {
                     final PIF.Record rec = pif.getRecord(conn);
                     if (rec.management) {
-                        if (rec.VLAN != null && rec.VLAN != -1) {
+                        if 
(!citrixResourceBase.isVlanAllowedForManagementPif(rec)) {

Review Comment:
   call `actOnVlanAllowedForManagement()` from here.



##########
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
##########
@@ -2785,7 +2785,7 @@ protected XsLocalNetwork getManagementNetwork(final 
Connection conn) throws XmlR
         for (final PIF pif : hostPifs) {
             final PIF.Record rec = pif.getRecord(conn);
             if (rec.management) {
-                if (rec.VLAN != null && rec.VLAN != -1) {
+                if (!isVlanAllowedForManagementPif(rec)) {

Review Comment:
   ```suggestion
                   if (!isVlanAllowedForManagementPif(rec)) {
                   boolean vlanMgmtSupported = false;
                   try {
                       final java.util.Map<String, String> sw = 
host.getSoftwareVersion(conn);
                       final String productVersion = sw.get("product_version");
                       if (productVersion != null) {
                           vlanMgmtSupported = 
Integer.parseInt(productVersion.split("\\.")[0]) >= 8;
                       }
                   } catch (final Exception e) {
                       logger.warn("Could not determine product version of host 
" + _host.getUuid() + "; assuming VLAN management network is unsupported", e);
                   }
                   if (!vlanMgmtSupported && rec.VLAN != null && rec.VLAN != 
-1) {
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to