Removed state for removed accounts (#7868)

Co-authored-by: Henrique Sato <henrique.sato@scclouds.com.br>
This commit is contained in:
sato03 2023-09-28 11:49:12 -03:00 committed by GitHub
parent ae5dda867f
commit 31e2b629ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
* Account states.
* */
enum State {
DISABLED, ENABLED, LOCKED;
DISABLED, ENABLED, LOCKED, REMOVED;
/**
* The toString method was overridden to maintain consistency in the DB, as the GenericDaoBase uses toString in the enum value to make the sql statements

View File

@ -180,3 +180,6 @@ CREATE TABLE `cloud`.`vm_scheduled_job` (
-- Add support for different cluster types for kubernetes
ALTER TABLE `cloud`.`kubernetes_cluster` ADD COLUMN `cluster_type` varchar(64) DEFAULT 'CloudManaged' COMMENT 'type of cluster';
ALTER TABLE `cloud`.`kubernetes_cluster` MODIFY COLUMN `kubernetes_version_id` bigint unsigned NULL COMMENT 'the ID of the Kubernetes version of this Kubernetes cluster';
-- Set removed state for all removed accounts
UPDATE `cloud`.`account` SET state='removed' WHERE `removed` IS NOT NULL;

View File

@ -814,6 +814,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
return false;
}
account.setState(State.REMOVED);
_accountDao.update(accountId, account);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Removed account " + accountId);
}