dheeraj12347 opened a new pull request, #12860: URL: https://github.com/apache/cloudstack/pull/12860
When starting a GRE isolated network on XCP-ng, the management server can fail with a ClassCastException like UnsupportedAnswer cannot be cast to OvsFetchInterfaceAnswer in OvsTunnelManagerImpl.handleFetchInterfaceAnswer. This happens when the agent returns an UnsupportedAnswer (or another Answer type) for OvsFetchInterfaceCommand, but the code unconditionally casts the first Answer to OvsFetchInterfaceAnswer. Root cause handleFetchInterfaceAnswer assumed answers[0] is always an OvsFetchInterfaceAnswer and directly cast it without checking for null, array length, or actual runtime type. When the hypervisor agent responds with a different Answer implementation (e.g. UnsupportedAnswer), this results in a ClassCastException and the GRE tunnel setup fails. Solution Add null and length checks for the Answer[] to handle missing or empty responses. Check answers[0] with instanceof OvsFetchInterfaceAnswer before casting. If the answer is not an OvsFetchInterfaceAnswer, log a clear warning with the actual type and details, and return null instead of throwing a ClassCastException. Preserve the existing success path when a successful OvsFetchInterfaceAnswer with a non-empty IP address is returned. Testing Local build on 4.22: bash mvn -pl api,server -am -DskipTests clean install -- 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]
