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


##########
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java:
##########
@@ -104,14 +104,14 @@ 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 (host.getAPIVersionMajor(conn) < 8 && rec.VLAN != 
null && rec.VLAN != -1) {

Review Comment:
   The API version check should include proper null safety. Consider checking 
if host.getAPIVersionMajor(conn) returns a valid value before comparison to 
prevent potential NullPointerException.
   ```suggestion
                           Integer apiVersionMajor = 
host.getAPIVersionMajor(conn);
                           if (apiVersionMajor == null) {
                               final String msg = "Unable to determine API 
version for host: " + citrixResourceBase.getHost().getUuid();
                               logger.warn(msg);
                               return new SetupAnswer(command, msg);
                           }
                           if (apiVersionMajor < 8 && 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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to