openstack的nova部分删除cell0、cell1

本来的:

+-------+--------------------------------------+------------------------------------+----------------------------------------------+----------+
|  Name |                 UUID                 |           Transport URL            |             Database Connection              | Disabled |
+-------+--------------------------------------+------------------------------------+----------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |               none:/               | mysql+pymysql://nova:****@node150/nova_cell0 |  False   |
| cell1 | 2be0bd53-979e-45e3-a4aa-9510714ad6e8 | rabbit://openstack:****@node3:5672 |    mysql+pymysql://nova:****@node150/nova    |  False   |
+-------+--------------------------------------+------------------------------------+----------------------------------------------+----------+

由于出了问题,计划删除cell0、 cell1;
操作如下:

  1. 删除cell0
 su -s /bin/sh -c "nova-manage cell_v2 delete_cell --cell_uuid=00000000-0000-0000-0000-000000000000" nova

下面是结果,没报错;

root@node2:/var/log/nova# su -s /bin/sh -c "nova-manage cell_v2 delete_cell --cell_uuid=00000000-0000-0000-0000-000000000000" nova
Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
  1. 删除cell1
    进入数据库
MariaDB [(none)]> use nova_api;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [nova_api]> select * from cell_mappings where cell_mappings.uuid = '2be0bd53-979e-45e3-a4aa-9510714ad6e8';
+---------------------+------------+----+--------------------------------------+-------+-------------------------------------------------------------------------------------------------------+---------------------------------------------+----------+
| created_at          | updated_at | id | uuid                                 | name  | transport_url                                                                                         | database_connection                         | disabled |
+---------------------+------------+----+--------------------------------------+-------+-------------------------------------------------------------------------------------------------------+---------------------------------------------+----------+
| 2023-11-28 03:03:55 | NULL       |  4 | 2be0bd53-979e-45e3-a4aa-9510714ad6e8 | cell1 | rabbit://openstack:haday1234@node1:5672,openstack:haday1234@node2:5672,openstack:haday1234@node3:5672 | mysql+pymysql://nova:haday1234@node150/nova |        0 |
+---------------------+------------+----+--------------------------------------+-------+-------------------------------------------------------------------------------------------------------+---------------------------------------------+----------+
1 row in set (0.000 sec)

发现id为4

MariaDB [nova_api]> delete from instance_mappings where cell_id = '4';

然后接着删除,但是出现了报错;

MariaDB [nova_api]> delete from cell_mappings where cell_mappings.uuid = '2be0bd53-979e-45e3-a4aa-9510714ad6e8';
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`nova_api`.`host_mappings`, CONSTRAINT `host_mappings_ibfk_1` FOREIGN KEY (`cell_id`) REFERENCES `cell_mappings` (`id`))

输入如下解决;

MariaDB [nova_api]> SET Foreign_key_checks=0;

然后再次操作删除命令;

MariaDB [nova_api]> delete from cell_mappings where cell_mappings.uuid = '2be0bd53-979e-45e3-a4aa-9510714ad6e8';
Query OK, 1 row affected (0.001 sec)
  1. 退出数据库查看
root@node2:/var/log/nova# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
+------+------+---------------+---------------------+----------+
| Name | UUID | Transport URL | Database Connection | Disabled |
+------+------+---------------+---------------------+----------+
+------+------+---------------+---------------------+----------+

发现为空,表示删除成功;
接着可以输入:

su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

重新初始化cell0数据库和创建cell1表;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值