Skip to content

Removed state for removed accounts#7868

Merged
DaanHoogland merged 2 commits into
apache:mainfrom
scclouds:removed-account-state
Sep 28, 2023
Merged

Removed state for removed accounts#7868
DaanHoogland merged 2 commits into
apache:mainfrom
scclouds:removed-account-state

Conversation

@hsato03

@hsato03 hsato03 commented Aug 14, 2023

Copy link
Copy Markdown
Member

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.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

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

codecov Bot commented Aug 15, 2023

Copy link
Copy Markdown

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
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@hsato03 do you want this in 4.18.1?

@hsato03

hsato03 commented Aug 15, 2023

Copy link
Copy Markdown
Member Author

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 force-pushed the removed-account-state branch from 223b7c2 to 91290ab Compare August 15, 2023 21:23
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

Comment thread api/src/main/java/com/cloud/user/Account.java Outdated

@yadvr yadvr left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown

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

soreana commented Aug 31, 2023

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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

hsato03 commented Aug 31, 2023

Copy link
Copy Markdown
Member Author

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
Copy Markdown

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

@soreana

soreana commented Sep 4, 2023

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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
Copy Markdown

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

@soreana

soreana commented Sep 4, 2023

Copy link
Copy Markdown
Member

@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
Copy Markdown
Contributor

have you tested @soreana ?

@soreana

soreana commented Sep 18, 2023

Copy link
Copy Markdown
Member

@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

hsato03 commented Sep 26, 2023

Copy link
Copy Markdown
Member Author

Hi @soreana,

Any updates on this one?

@soreana

soreana commented Sep 28, 2023

Copy link
Copy Markdown
Member

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
@hsato03

hsato03 commented Sep 28, 2023

Copy link
Copy Markdown
Member Author

@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.

6 participants