Copilot commented on code in PR #11193:
URL: https://github.com/apache/cloudstack/pull/11193#discussion_r4425382745
##########
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java:
##########
@@ -104,14 +104,20 @@ 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) {
+ Integer apiVersionMajor =
host.getAPIVersionMajor(conn);
Review Comment:
`Host.getAPIVersionMajor(Connection)` returns `Long` in the XenAPI SDK,
which cannot be assigned to `Integer`. This prevents the XenServer plugin from
compiling. Declare this variable as `Long` so the existing null check remains
valid.
##########
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java:
##########
@@ -104,14 +104,20 @@ 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) {
+ 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) {
Review Comment:
The XenAPI protocol version is not the hypervisor product version: XCP-ng
8.x reports API major version 2, not 8. Consequently, this condition still
rejects VLAN-backed management interfaces on the hosts this change is intended
to support. Compare the hypervisor product version (available through
`CitrixHelper.getProductVersion(host.getRecord(conn))`) against the supported
release cutoff, rather than comparing the API major version to 8.
--
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]