Delete user-project mappings on project deletion#13456
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #13456 +/- ##
=========================================
Coverage 16.25% 16.26%
- Complexity 13432 13437 +5
=========================================
Files 5667 5667
Lines 500670 500679 +9
Branches 60801 60800 -1
=========================================
+ Hits 81401 81419 +18
+ Misses 410163 410154 -9
Partials 9106 9106
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ac25417 to
4244c2c
Compare
4244c2c to
2106a39
Compare
2106a39 to
0c297c1
Compare
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18316 |
|
looks good, but will need extensive upgrade testing (will 20.2 -> 23.0 work?) |
|
@Tonitzpp |
0c297c1 to
847913e
Compare
|
@weizhouapache I tested it again, with and without the changes, to see if was still possible to reproduce the issue #12601. I was able to reproduce it without, but not with my changes. Here are the steps I executed: Before the changes, I tried to delete the account and the error showed up: I checked the database too: MariaDB [cloud]> select * from project_account;
+----+------------+---------+--------------+------------+--------------------+-----------------+---------------------+
| id | account_id | user_id | account_role | project_id | project_account_id | project_role_id | created |
+----+------------+---------+--------------+------------+--------------------+-----------------+---------------------+
| 2 | 4 | 4 | Admin | 1 | 5 | NULL | 2026-04-23 12:22:59 |
+----+------------+---------+--------------+------------+--------------------+-----------------+---------------------+
1 row in set (0.000 sec)After the changes, I deleted the account successfully: And checked the database that it was clean: Did you perform any different steps? @DaanHoogland And in regards to the normalization, it will need to be included in the 4.22.1 -> 4.23.0 and 4.22.1 -> 4.22.2 scripts. |
If it is idem potent we can just add it to both. that would be best. But if 22.2 is released after 23.0 it can not go in that upgrade, but must go into 22.2 -> 23.1! |






Description
When a user is added to a project, and this project is then deleted, the user-project mapping is never removed from the database. Thus, when attempting to delete the user's account, an error is returned stating that the account is still linked to a project.
Therefore, this PR deletes the invalid user-project mappings and fixes the project deletion process in CloudStack.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
select * from project_accounthad the entries for 1 account and 1 user belonging to the project.