apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.06k stars 1.1k forks source link

Please provide a sql scripts to force clear all the related resource of a zone when a zone was decomission #7715

Closed xuanyuanaosheng closed 1 year ago

xuanyuanaosheng commented 1 year ago
ISSUE TYPE

some zone has been decomission, some resource can not delete because the system vm can not start.

could you please provide a sql scripts to force clear all the related resource of a zone?

DaanHoogland commented 1 year ago

@xuanyuanaosheng which resources do you mean? also please see #7630 , it fixes some of what you describe and might contain clues to what you need.

rajujith commented 1 year ago

@xuanyuanaosheng if you want to remove the resources of all the zones you could run the cloudstack-setup-databasesagain but this won't delete any resources at the hypervisors.

xuanyuanaosheng commented 1 year ago

@rajujith I just want to delete the resources related to one zone.


@DaanHoogland
The resources include the volumes, Primary storage, Secondary storage, Template. and the physical network etc.

In some reason, the hosts and the Storage can not work again, this cause the System VMs can not started and the so I can not delete the resource in this zone.

like:

I can not delete the template using Force delete

image

so I can not delete the Secondary storage

image

I can not delete the volumes image

so I can not delete the Primary storage

image

image

https://github.com/apache/cloudstack/pull/7630

so I can not delete the cluster, pod and zone.

Because there are working zone in cloudstack, So I can not use cloudstack-setup-databases to init cloudstack. Please provide a sql scripts to force delete these resources.

rajujith commented 1 year ago

@xuanyuanaosheng unfortunately there is no ready to use script delete a specific zone and associated resources to the best of my knowledge.

xuanyuanaosheng commented 1 year ago

@rajujith It is so sad to hear about that. I know it is not good to delete a zone this way.


@weizhouapache @DaanHoogland

Is it possible to add a force delete option in the cloudsatck web UI?

Volumes --> Primary storage Template --> Secondary storage Ips --> Physical network

Have any idears?

DaanHoogland commented 1 year ago

@xuanyuanaosheng ,

Please specify what action you are taking and what you would expect from it. I have removed zones for the ticket I mentioned without problems but maybe there is a sequence of events, or an extra item in the zone that prevents it for you.

xuanyuanaosheng commented 1 year ago

@DaanHoogland

image

image

image

image


STEPS TO REPRODUCE
DaanHoogland commented 1 year ago

@xuanyuanaosheng it does not sound as the right order to go about it. But as a reparation method you could try and find the right SQLs to delete the remnance. Make sure you backup your DB before trying anything.

You should start at tables like template_store_ref, volume_store_ref, snapshot_store_ref and template_spool_ref, and work in two directions. For IPs I think it would not be so hard as the table user_ip_address has a field for zone. This one is also the table the fix I referred in https://github.com/apache/cloudstack/issues/7715#issuecomment-1619699345 is for.

hope this helps

xuanyuanaosheng commented 1 year ago

@DaanHoogland

This situation is indeed strange. Thanks for your reply.

I have done some test on DB level and it works.

Could you please help to look at the issue: https://github.com/apache/cloudstack/issues/7720

xuanyuanaosheng commented 1 year ago

I will close this issue