Skip to content

Conversation

@nicoschmdt
Copy link
Collaborator

Description

In Java, the operator and has a higher precedence than the operator or. This caused the method handleUnsuccessfulExpungeOperation to execute even when the hostId or lastHostId value was null, allowing CloudStack to send a command to a host that doesn't exist.

This PR fixes this verification logic adding parenthesis to ensure the method will not execute when the value of the parameter hostId is null.

To reproduce this error you need to deploy a VM with a tag with no matches and then try to expunge it.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

Through debug mode I tested different values for finalizeExpungeCommands, nicExpungeCommands and hostId and I checked that it is not possible to execute the method when hostId is null or when both of the command lists are empty.

@codecov
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 15.99%. Comparing base (6a3314c) to head (092fa35).
Report is 5 commits behind head on 4.20.

Files with missing lines Patch % Lines
...n/java/com/cloud/vm/VirtualMachineManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #10418   +/-   ##
=========================================
  Coverage     15.98%   15.99%           
- Complexity    13079    13080    +1     
=========================================
  Files          5649     5649           
  Lines        495625   495625           
  Branches      60004    60004           
=========================================
+ Hits          79244    79257   +13     
+ Misses       407539   407520   -19     
- Partials       8842     8848    +6     
Flag Coverage Δ
uitests 4.01% <ø> (ø)
unittests 16.83% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DaanHoogland
Copy link
Contributor

@nicoschmdt , I see this bug is also present in 4.20, could you rebase your code on that branch please?

@nicoschmdt nicoschmdt changed the base branch from main to 4.20 February 18, 2025 15:23
@nicoschmdt nicoschmdt force-pushed the fix-host-id-verification-on-unsuccessful-expunge-operation branch from f674ee6 to 092fa35 Compare February 18, 2025 15:24
@DaanHoogland DaanHoogland added this to the 4.20.1 milestone Feb 19, 2025
Copy link
Contributor

@Pearl1594 Pearl1594 left a comment

Choose a reason for hiding this comment

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

clgtm

@Pearl1594
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12513

@Pearl1594
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@Pearl1594 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-12472)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 52821 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10418-t12472-kvm-ol8.zip
Smoke tests completed. 140 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_06_purge_expunged_vm_background_task Failure 384.81 test_purge_expunged_vms.py

@Pearl1594 Pearl1594 merged commit c80b886 into apache:4.20 Feb 20, 2025
25 of 26 checks passed
@Pearl1594 Pearl1594 moved this to Done in ACS 4.20.1 Mar 17, 2025
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants