openstack云平台删除云主机失败解决方法

openstack云平台删除云主机失败解决方法

【现象】

​ 在云平台页面删除实例失败,提示报错:Failed to execute action (server_force_delete) for server (0504ad86-b423-4a6b-bcb7-2339b0108d54), error: Instance 0504ad86-b423-4a6b-bcb7-2339b0108d54 could not be found. (HTTP 404) ,可通过修改数据库记录来清理实例,具体方法参照如下。

【步骤】

  1. 找到平台的mariadb密码

    [root@hero ~]# grep ^database_password ~/passwords.yml
    database_password: bekBVE3Vkip046voKt3wdrhVAkplk3KzHvovr42k

  2. 登录数据库

    [root@hero ~]# docker exec -it mariadb mysql -u root -pbekBVE3Vkip046voKt3wdrhVAkplk3KzHvovr42k
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 17345
    Server version: 10.3.20-MariaDB-log MariaDB Server

    Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.

    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

    MariaDB [(none)]>

  3. 通过查询语句,在instances表中找到"0504ad86-b423-4a6b-bcb7-2339b0108d54"实例状态,可见已经是删除状态。

    MariaDB [(none)]> select deleted,cleaned from nova.instances where uuid=‘0504ad86-b423-4a6b-bcb7-2339b0108d54’;
    ±--------±--------+
    | deleted | cleaned |
    ±--------±--------+
    | 50 | 1 |
    ±--------±--------+
    1 row in set (0.000 sec)

  4. 在这,我们手动将实例设置成未删除状态,以方便云平台在回收站中硬删除实例。

    MariaDB [(none)]> update nova.instances set deleted=‘0’, cleaned=‘0’ where uuid=‘0504ad86-b423-4a6b-bcb7-2339b0108d54’;
    Query OK, 1 row affected (0.001 sec)
    Rows matched: 1 Changed: 1 Warnings: 0

    MariaDB [(none)]> select deleted,cleaned from nova.instances where uuid=‘0504ad86-b423-4a6b-bcb7-2339b0108d54’;
    ±--------±--------+
    | deleted | cleaned |
    ±--------±--------+
    | 0 | 0 |
    ±--------±--------+
    1 row in set (0.000 sec)

  5. 之后,在页面上再删除一次实例,发现已能成功删除。

    Action (server_force_delete) successfully executed for server (instance-a8hk36793d).

    {
      "resource_id": "0504ad86-b423-4a6b-bcb7-2339b0108d54"
    }
    
  6. 在数据库中,查询"0504ad86-b423-4a6b-bcb7-2339b0108d54"实例,发现已是删除状态,一切正常。

    MariaDB [(none)]> select deleted,cleaned from nova.instances where uuid=‘0504ad86-b423-4a6b-bcb7-2339b0108d54’;
    ±--------±--------+
    | deleted | cleaned |
    ±--------±--------+
    | 50 | 1 |
    ±--------±--------+
    1 row in set (0.000 sec)

    MariaDB [(none)]>

  • 11
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值