Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed state for removed accounts #7868

Merged
merged 2 commits into from Sep 28, 2023

Conversation

hsato03
Copy link
Collaborator

@hsato03 hsato03 commented Aug 14, 2023

Description

When deleting an account, its state is maintained as Enabled even if it is removed.

Accordingly the Removed state for accounts was created, which is always set when an account is deleted.

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)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

I created and deleted an account. Then, I created a SELECT SQL query for the account table and the account state was Removed.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

Good change! one remark, other entities have a state DESTROYED. maybe it would make sense to be in line with that?

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #7868 (f37b460) into main (78411fd) will increase coverage by 0.00%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               main    #7868   +/-   ##
=========================================
  Coverage     14.40%   14.40%           
  Complexity    10109    10109           
=========================================
  Files          2748     2748           
  Lines        259390   259392    +2     
  Branches      40381    40381           
=========================================
+ Hits          37354    37355    +1     
- Misses       217203   217204    +1     
  Partials       4833     4833           
Files Changed Coverage Δ
...c/main/java/com/cloud/user/AccountManagerImpl.java 20.57% <100.00%> (+0.09%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SF] 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6782

@DaanHoogland
Copy link
Contributor

@hsato03 do you want this in 4.18.1?

@hsato03
Copy link
Collaborator Author

hsato03 commented Aug 15, 2023

Good change! one remark, other entities have a state DESTROYED. maybe it would make sense to be in line with that?

@DaanHoogland Yes, that's a good idea. But some entities have the Inactive removed state like domain and vm_template.

@hsato03 do you want this in 4.18.1?

OK.

@hsato03 hsato03 changed the base branch from main to 4.18 August 15, 2023 21:24
@soreana soreana added this to the 4.18.1.0 milestone Aug 15, 2023
@soreana soreana self-requested a review August 15, 2023 22:29
@weizhouapache
Copy link
Member

Good change! one remark, other entities have a state DESTROYED. maybe it would make sense to be in line with that?

@DaanHoogland
to be honest, I think removed makes more sense.

@DaanHoogland
Copy link
Contributor

@weizhouapache REMOVED does make sense but having different terms with the same meaning is something we should prevent, and adding a new one should replace all occurences of the old ones. Not going to block this for that reason, but it will be confusing for new operators and developers alike.

worth a discuss thread?

cc @soreana @hsato03

@weizhouapache
Copy link
Member

@hsato03
since this is not a bug, but an improvement. let's move to next major release 4.19.0.0
cc @DaanHoogland

@weizhouapache weizhouapache modified the milestones: 4.18.1.0, 4.19.0.0 Aug 17, 2023
@DaanHoogland
Copy link
Contributor

I think this can be included in 4.18.1 as well, but do not mind either way

Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

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

LGTM - I'm not sure if there could be only possible side-effects; or it should also emit some kind of event for usage-server?

@weizhouapache
Copy link
Member

LGTM - I'm not sure if there could be only possible side-effects; or it should also emit some kind of event for usage-server?

it is one of my concerns as well.
let's consider it for 4.19.0.0

@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@hsato03 hsato03 changed the base branch from 4.18 to main August 31, 2023 21:10
@soreana
Copy link
Member

soreana commented Aug 31, 2023

@blueorangutan package

@blueorangutan
Copy link

@soreana a [SF] 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.

@hsato03
Copy link
Collaborator Author

hsato03 commented Aug 31, 2023

I agree with @rohityadavcloud and @weizhouapache, REMOVED sounds better for accounts. @DaanHoogland Although your idea of ​​standardizing the state of entities is good, there are already other entities that use the REMOVED state.

LGTM - I'm not sure if there could be only possible side-effects; or it should also emit some kind of event for usage-server?

@rohityadavcloud ACS already emits an event when deleting an account.

@blueorangutan
Copy link

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

@soreana
Copy link
Member

soreana commented Sep 4, 2023

@blueorangutan package

@blueorangutan
Copy link

@soreana a [SF] 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6973

@soreana
Copy link
Member

soreana commented Sep 4, 2023

@DaanHoogland @rohityadavcloud @weizhouapache I did some research to understand the definitions of removed and destroyed in CloudStack terminology.

Once an object is Destroyed in CloudStack, it remains visible to the root admin, who has the exclusive ability to either restore or remove it. Even when an object is destroyed, it can still be restored. But once an object is removed, it cannot be restored and will be lost permanently.

As of now, it is not possible to restore the account that was removed. Therefore, using the term Remove state would be more appropriate than Destroyed.

@DaanHoogland
Copy link
Contributor

have you tested @soreana ?

@soreana
Copy link
Member

soreana commented Sep 18, 2023

@DaanHoogland I tested that on fresh install of the CloudStack. I haven't tested the upgrade path from 4.18 to 4.19. I can check that as well later this week.

@hsato03
Copy link
Collaborator Author

hsato03 commented Sep 26, 2023

Hi @soreana,

Any updates on this one?

@soreana
Copy link
Member

soreana commented Sep 28, 2023

Hi @DaanHoogland @hsato03,

I've tested the upgrade from 4.18.1 to 4.19 the process went smooth and the account have removed state now.

Before upgrade:

MariaDB [cloud]> select account_name,state,removed from account ;
+--------------------------+---------+---------------------+
| account_name             | state   | removed             |
+--------------------------+---------+---------------------+
| system                   | enabled | NULL                |
| admin                    | enabled | NULL                |
| baremetal-system-account | enabled | NULL                |
| Removed-01               | enabled | 2023-09-28 08:41:35 |
| Removed-02               | enabled | 2023-09-28 08:45:18 |
| Removed-03               | enabled | 2023-09-28 08:46:16 |
+--------------------------+---------+---------------------+
6 rows in set (0.001 sec)

MariaDB [cloud]>

After upgrade:

MariaDB [cloud]> select account_name,state,removed from account ;
+--------------------------+---------+---------------------+
| account_name             | state   | removed             |
+--------------------------+---------+---------------------+
| system                   | enabled | NULL                |
| admin                    | enabled | NULL                |
| baremetal-system-account | enabled | NULL                |
| Removed-01               | removed | 2023-09-28 08:41:35 |
| Removed-02               | removed | 2023-09-28 08:45:18 |
| Removed-03               | removed | 2023-09-28 08:46:16 |
+--------------------------+---------+---------------------+
6 rows in set (0.001 sec)

MariaDB [cloud]>

@DaanHoogland DaanHoogland merged commit 31e2b62 into apache:main Sep 28, 2023
25 of 26 checks passed
@hsato03
Copy link
Collaborator Author

hsato03 commented Sep 28, 2023

@soreana Thank's for testing.

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.

None yet

6 participants