Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@
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) {
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if (host.getAPIVersionMajor(conn) < 8 && 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) {

Copilot uses AI. Check for mistakes.
final String msg =
new StringBuilder("Unsupported configuration. Management network is on a VLAN. host=").append(citrixResourceBase.getHost().getUuid())
.append("; pif=")
.append(rec.uuid)
.append("; vlan=")
.append(rec.VLAN)
.toString();
.append("; pif=")
.append(rec.uuid)
.append("; vlan=")
.append(rec.VLAN)
.toString();

Check warning on line 114 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java#L110-L114

Added lines #L110 - L114 were not covered by tests
logger.warn(msg);
return new SetupAnswer(command, msg);
}
Expand Down
Loading