OpenStack manually removes instances from the database-ugyn109 's column-Blog channel-csdn.net

Source: Internet
Author: User

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

    1. update ? instances? Set
    2. deleted_at?=?updated_at ,???
    3. deleted?=?1,???
    4. power_state?=?0,???
    5. vm_state?=? " deleted ",???
    6. terminated_at?=?updated_at,???
    7. root_device_name?=? NULL,???
    8. task_state?=? NULL
    9. 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

  1. update? instance_info_caches? Set
  2. Deleted_at?=?updated_at,???
  3. Deleted?=?1???
  4. whereis id?=?9;??
  5. ?
  6. update? fixed_ips? Set
  7. Instance_id?=? Null???
  8. Allocated?=?0,???
  9. Virtual_interface_id?=? Null
  10. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.