03-28-2017 07:21 PM - edited 03-21-2019 11:27 AM
I am unable to delete some subtenants due to the following message:
"Failed to delete tenant. This Sub-Tenants users have currently running deployments and virtual machines. First, terminate those workloads, before you delete this Sub-Tenant."
When I login as the Sub-Tenant, there are no running deployments. None. Zero. Nada.
Is there a way to clear these Sub-Tenants?
Thanks,
David
03-29-2017 01:39 AM
Hello David,
Unfortunately, if there was error while terminating. You need to clean DB
1. Connect to your DB there your DB is (psql -U cliqr -d cliqrdb)
2. In order to check user_id you want to delete (select * from user_accounts;)
3. To check deployments (select * from app_deployments;)
4. Delete needed deployments where owner = user_id
5. Go back to UI and delete those sub-tenant or do that using DB
Kind Regards,
Vladimir
03-29-2017 03:02 PM
Hi Vladimir,
This is very helpful!
For step 4, what command do I issue to delete the deployment?
David
03-30-2017 06:08 AM
example:
We want to delete this deployment, which belong to user_id 6
select * from app_deployments where owner = 6;
deployment_id | name | description | app_id | owner | status | deleted | health_status
---------------+--------------------+-------------+--------+-------+------------------+---------+--------------------
74 | test_centos_tenant | | 63 | 6 | DeploymentKilled | t | DeploymentNoStatus
note yourself deployment_id
then
delete from deployment_jobs where deployment_id = 74;
delete from app_deployments where deployment_id = 74;
You need delete by deployment_id, you can't delete by owner. So if you have a lot of jobs that will take some time to clean up.
04-01-2017 01:56 AM
What does it mean where there are multiple rows that match a specific pattern?
Namely, the subtenant owner for the subtenant I am trying to remove is 't3admin'.
This subtenant does not have any other users other than this subtenant admin.
The result below results in 4 user_id's that have t3admin in them:
cliqrdb=> select user_id from user_accounts where username like '%t3admin%';
user_id
---------
28
17
50
59
(4 rows)
Assuming this is normal, I went ahead and deleted all the deployment_jobs and app_deployments associated with the above user_id's based on their deployment_id's.
The final state is now as follows (for owners 28, 17, 50, and 59):
cliqrdb=> select * from app_deployments where owner = 28;
deployment_id | name | description | app_id | owner | status | deleted | health_status
---------------+------+-------------+--------+-------+--------+---------+---------------
(0 rows)
cliqrdb=> select * from app_deployments where owner = 17;
deployment_id | name | description | app_id | owner | status | deleted | health_status
---------------+------+-------------+--------+-------+--------+---------+---------------
(0 rows)
cliqrdb=> select * from app_deployments where owner = 50;
deployment_id | name | description | app_id | owner | status | deleted | health_status
---------------+------+-------------+--------+-------+--------+---------+---------------
(0 rows)
cliqrdb=> select * from app_deployments where owner = 59;
deployment_id | name | description | app_id | owner | status | deleted | health_status
---------------+------+-------------+--------+-------+--------+---------+---------------
(0 rows)
When I try and delete the subtenant (Tenant3), it get the same error message stating there are subtenant users with running deployments.
I have logged in as the t3admin user and confirmed there are no active deployments.
I tried stopping and restarting the mongod service (eg: service mongod stop, service mongod start) and even rebooting the CCM.
Is there anything else that needs to be deleted in the database? Something is causing the CCM to think there are still subtenant users with active deployments but based on the outputs above, that's not the case anymore.
Any other suggestions are greatly appreciated.
04-02-2017 11:57 PM
Hi David,
Can you show output:
select * from user_accounts where username ilike '%t3admin%';
Another thing if you delete from UI it's not really wiped out from DB
kr,
Vladimir
04-03-2017 10:15 AM
-------------------------------------------------------------------------------
cliqrdb=> select * from user_accounts where username ilike '%t3admin%';
-------------------------------------------------------------------------------
user_id | username | password | enabled | first_name | last_name | company_name | admin | internal | email
_addr | phone_number | validation_token | vendor_id | edition | email_verified | disable_reason | created | last_updated | ac
cess_token | deleted | delete_reason | external_id | account_source | activation_rule | activation_profile_id | encrypted | password_expiry_date | password_temp
orary
---------+-----------+------------------------------------------------------------------+---------+------------+-----------+--------------+-------+----------+------------
-------------+--------------+------------------+-----------+----------+----------------+--------------------------+-------------------------+-------------------------+---
-----------+---------+-------------------------+-------------+----------------+-----------------+-----------------------+-----------+----------------------+--------------
------
28 | t3admin_s | 81b879320cb61e7f2fa6f23c219bb6b024d10a9c15bdb32f75c41c8a389adee0 | t | Tenant3 | admin | OneCloud | f | f | t3admin@one
cloudinc.com | 1234567890 | | 25 | Vendor | t | | 2017-02-22 21:43:06.175 | 2017-04-01 07:17:00.807 |
| f | | | AdminCreated | | 1 | t | | f
17 | t3admin_h | 513ee70529633363b0b60a9719864c83bb1e357eacc910338a1a0518af92a5fc | t | Tenant3 | admin | OneCloud | f | f | t3admin@one
cloudinc.com | 1234567890 | | 14 | Vendor | t | | 2017-02-17 17:54:01.628 | 2017-02-17 17:54:01.623 |
| t | AdministrativelyDeleted | | AdminCreated | | 1 | t | | f
50 | t3admin_O | 1e9e6c2db869193ec63578dedacf9d47977f76d02c07f24ae9204207afaec076 | f | Tenant3 | admin | OneCloud | f | f | t3admin@one
cloudinc.com | 1234567890 | | 1 | Standard | t | AdministrativelyDisabled | 2017-03-29 07:02:10.885 | 2017-04-01 07:49:00.136 |
| t | AdministrativelyDeleted | | AdminCreated | | 1 | t | | f
59 | t3admin_X | b52dfda2f0ad00ed502628e0f8ab40d618dbcb03c9180001f8d94910147658f9 | t | Tenant3 | admin | OneCloud | f | f | t3admin@one
cloudinc.com | 1234567890 | | 1 | Standard | t | | 2017-04-01 07:52:28.494 | 2017-04-01 07:52:28.443 |
| f | | | AdminCreated | | 1 | t | | f
(4 rows)
Screenshot also attached.
David
04-03-2017 11:23 PM
Hi David,
Few more things:
1. select * from user_accounts where vendor_id = 14;
2. select * from user_accounts where vendor_id = 25;
3. Provide also screenshot from UI so I can see under which user you're logged in and that exactly in UI you're trying to delete with Error message.
kr,
Vladimir
03-29-2017 01:02 PM
HI David,
I would recommend you to wait for sometime and then try deleting the sub-tenant since it might take some time for the CCM to get the message that the deployments in background have been terminated successfully.
Once confirmed that all the deployments are terminated, please logout and login again to delete the Sub tenant.
Please be noted that modifying the DB directly without the proper queries might lead to unsupported environment.
Regards,
Deepak
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide