For some reason I removed a compute node for OpenStack but did not delete the instance running on it before removing it, and then I wanted to delete the instances by dash, so n days passed and my dash also showed the following:
It's an eyesore, isn't it? So I'm going to manually remove them from the database!
1. Tables related to deleting instances in the database
The tables associated with deleting instances in the database are as follows:
Fixed_ips The fixed ip,floating_ips assigned to the instance is clearly related to the floating IP assigned to the instance, but I have not used floating in the experiment, so I do not judge, instance_actions I am empty here, Instance_faults record an instance-related error regardless of whether Instance_info_caches is related to the instance's network settings cache, instance_metadata the metadata about the instance, Instance_type_extra_ Specs and instance_types are related to flavor settings regardless, instances is obviously the main table of the instance, volumes is related to the volumes of the instance. My experiment did not have floating IP nor volumes, so I only focus on fixed_ips,instance_info_caches,instances three tables.
Delete Policy for 2.OpenStack
It is observed that the following fields are basically found in the tables in Nova:
OpenStack does not delete records from the database when it deletes objects, but only modifies the Deleted_at and deleted fields.
3. Operational database
The operation to delete an instance is mainly focused on instances,instance_info_caches,fixed_ips three tables.
3.1 Operating Instances Table
is a comparison of the test3 (right) that has been deleted in my database from the TEST3 (left) that cannot be deleted now:
So here's what I do:
[SQL] View Plaincopy
- update ? instances? Set
- deleted_at?=?updated_at ,???
- deleted?=?1,???
- power_state?=?0,???
- vm_state?=? " deleted ",???
- terminated_at?=?updated_at,???
- root_device_name?=? NULL,???
- task_state?=? NULL
- where ? id?=?9;??
3.2 Operating Instance_info_caches and Fixed_ips
These two operations are simple, after the previous operation has not seen the deleted instance in the dash, these two operations are mainly to release the deleted instance occupied by the network resources, directly on the code:
[SQL]view plaincopy
- update? instance_info_caches? Set
- Deleted_at?=?updated_at,???
- Deleted?=?1???
- whereis id?=?9;??
- ?
- update? fixed_ips? Set
- Instance_id?=? Null???
- Allocated?=?0,???
- Virtual_interface_id?=? Null
- whereis id?=?7;??
OK, and then delete another instance, finally in the dash don't look at the two annoying examples.
OpenStack manually removes instances from the database-ugyn109 's column-Blog channel-csdn.net