Skip to content

Conversation

@SURYAS1306
Copy link

Description

When attempting to delete an account, CloudStack currently blocks the deletion if the
account is listed as an administrator of any project, even when those projects have
already been deleted (i.e. removed is not null).

This leads to a misleading error and prevents valid account deletion for accounts that
only manage already-deleted projects.

This PR improves the account deletion flow by ensuring that only active projects
are considered when checking whether an account manages projects. Deleted projects are
ignored, allowing the account deletion to proceed correctly.

A unit test has been added to validate this behavior and prevent regressions.

Fixes #12601


Expected behavior

An account should be deletable if it only manages projects that have already been deleted.


Actual behavior

Account deletion fails with an error indicating that the account manages projects,
even when all associated projects are already deleted.


Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Test (unit test code)

Bug Severity

  • Minor

How Has This Been Tested?

  • Added a unit test in AccountManagerImplTest to verify that an account managing
    only deleted projects does not cause account deletion to fail.
  • Verified that the account deletion logic continues to block deletion when the
    account manages active projects.
  • Built the affected CloudStack modules locally using Maven.

How did you try to break this feature and the system with this change?

  • Simulated scenarios where an account manages:
    • only deleted projects
    • a mix of active and deleted projects
  • Confirmed that deletion is allowed only when no active projects are managed,
    and correctly blocked otherwise.

@SURYAS1306 SURYAS1306 force-pushed the fix-account-delete-deleted-projects branch from 2cb8b40 to 836f84a Compare February 7, 2026 21:26
}
}


Copy link
Contributor

Choose a reason for hiding this comment

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

check indentation ^^^

@Imvedansh
Copy link
Contributor

@blueorangutan ui

@blueorangutan
Copy link

@Imvedansh a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/12607 (QA-JID-873)

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.67%. Comparing base (408e8c0) to head (d002109).
⚠️ Report is 3 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (408e8c0) and HEAD (d002109). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (408e8c0) HEAD (d002109)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #12607       +/-   ##
=============================================
- Coverage     17.90%    3.67%   -14.23%     
=============================================
  Files          5937      453     -5484     
  Lines        532841    38447   -494394     
  Branches      65190     7115    -58075     
=============================================
- Hits          95397     1414    -93983     
+ Misses       426766    36846   -389920     
+ Partials      10678      187    -10491     
Flag Coverage Δ
uitests 3.67% <ø> (ø)
unittests ?

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to delete account if the project is removed

4 participants