Skip to content

Deleted userdata owned by a deleted account remains linked with the template #9477

Open

Description

@shwstppr
ISSUE TYPE
  • Bug Report
COMPONENT NAME
Server
CLOUDSTACK VERSION
4.19 branch, most likely earlier versions
CONFIGURATION

NA

OS / ENVIRONMENT

NA

SUMMARY

Deleted userdata owned by a deleted account remains linked with the template. In UI it produces a 404 error. During VM deployment with the linked template it return error like,
UserData linked to the template CentOS 5.6(64-bit) no GUI (XenServer) is not found

STEPS TO REPRODUCE
1. As the admin, create a new user account
2. As the new user, register a userdata
3. As the admin, link the userdata to a template
4. As the admin, delete the new user
5. Observer userdata remains linked to the template
deleted-userdata.mp4
EXPECTED RESULTS
Maybe either an error while deleting the user account or the userdata that gets deleted is unlinked from the template
ACTUAL RESULTS
Delete userdata remains linked to the template

Activity

  1. shwstppr commented on Aug 1, 2024

    @shwstppr
    ContributorAuthor

    @harikrishna-patnala any thoughts on this

  2. harikrishna-patnala commented on Aug 8, 2024

    @harikrishna-patnala
    Member

    Yes @shwstppr seems like a valid issue.

    Regarding the fix, I think we should allow linking of the userdata to the template only if both are created by that user.
    If we have to go with the fix of restricting the deletion of the user just because he/she created a userdata and linked to a template.

  3. DaanHoogland commented on Aug 12, 2024

    @DaanHoogland
    Contributor

    Regarding the fix, I think we should allow linking of the userdata to the template only if both are created by that user. If we have to go with the fix of restricting the deletion of the user just because he/she created a userdata and linked to a template.

    @harikrishna-patnala , that doesn't sound right. Let's discuss the scenarios, as the one described by @shwstppr is certainly not the only one that pertains to this linkage of resources:

    • an account-user created a userdata entry
    • another account-user created a template
    • now several things may happen
    1. the first user does the linking, or the second
    2. the first user get deleted, or the second
    3. the template gets deleted (while VMs are still running) though I am not sure of the latests guards against that.

    on the one hand, removing the link might be resulting in unexpected behaviour of the VMs/template. On the other hand, a delete with cleanup should work on the account (and thus the user).

  4. added this to the 4.21.0.0 milestone on Aug 13, 2024
  5. modified the milestones: 4.21.0, 4.22.0 on Aug 29, 2025
  6. 16 remaining items

  7. nvazquez commented on Jan 15, 2026

    @nvazquez
    Contributor

    @DaanHoogland I don't think so, I think with the current state users may think the user data will still be applied but it wouldn't as its removed during the user removal.

    Edit: after quick sync with @DaanHoogland we have defined to mark the user_data_id field and policy for each template as NULL and log the number of updated templates during the user data deletion within the account removal operation

  8. moved this from Discuss to Dev In Progress in Apache CloudStack BugFest - Issueson Jan 15, 2026
  9. moved this from Dev In Progress to ready for Review in Apache CloudStack BugFest - Issueson Jan 15, 2026
  10. nvazquez commented on Jan 15, 2026

    @nvazquez
    Contributor

    Hi @DaanHoogland @shwstppr @harikrishna-patnala I have created the PR #12439, can you please review?

  11. nvazquez commented on Jan 20, 2026

    @nvazquez
    Contributor

    @DaanHoogland @shwstppr as discussed I have closed my PR #12439 in favour of #11595

  12. modified the milestones: 4.20.3, 4.20.4 on Feb 16, 2026
  13. github-actions commented on Jul 1, 2026

    @github-actions

    🎯 Triage report

    When a user account is deleted, its userdata is removed from the DB, but the user_data_id foreign key on vm_template is not nulled out. This leaves templates pointing to a deleted/non-existent userdata record, causing 404 errors in the UI and deployment failures. A PR (#11595) is already in flight with the agreed fix of setting user_data_id = NULL on affected templates during user deletion.

    📊 Assessment

    Dimension Value Reasoning
    Type type:bug Data-integrity defect — dangling FK after account deletion
    Component component:management-server Server-side account removal logic
    Severity Severity:Minor Causes errors only when deploying from affected templates; workaround exists (re-link or remove userdata)
    Labels type:bug, component:management-server, Severity:Minor As above
    Coding agent Suitable Root cause confirmed, fix agreed in comments: null user_data_id + user_data_policy on vm_template rows during userdata removal in account cleanup

    🔗 Similar issues

    No distinct duplicate found; the original discussion and fix are tracked within this issue and PR #11595.

    💡 Notes and suggestions

    Generated by Daily Issue Triage · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@d7c1dc4b72b00607a67caaffdcc216cb64379cf9
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions