openstack task_state 状态一直为powering-on 的处理

原因

由于断电重启集群忘记启动一台nova节点,使用openstack server start 1caf85fb-e025-4834-afc8-50c3fb7887df启动虚拟机。造成task_state一直处于powering-on的状态。 如下:

[root@ctl01 ~]# openstack server show 1caf85fb-e025-4834-afc8-50c3fb7887df
+-------------------------------------+----------------------------------------------------------+
| Field                               | Value                                                    |
+-------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                   | AUTO                                                     |
| OS-EXT-AZ:availability_zone         | nova                                                     |
| OS-EXT-SRV-ATTR:host                | cs07                                                     |
| OS-EXT-SRV-ATTR:hypervisor_hostname | cs07                                                     |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000015                                        |
| OS-EXT-STS:power_state              | Shutdown                                                 |
| OS-EXT-STS:task_state               | powering-on                                              |
| OS-EXT-STS:vm_state                 | stopped                                                  |
| OS-SRV-USG:launched_at              | 2021-08-26T03:25:01.000000                               |
| OS-SRV-USG:terminated_at            | None                                                     |
~~~
| volumes_attached                    | id='2f184cda-3e7a-4d13-89db-abc0e4002217'                |
+-------------------------------------+----------------------------------------------------------+

尝试多次启动均告失败。

状态修复

尝试使用server set命令对虚拟机状态进行修复,task_state状态变更None

[root@ctl01 ~]# openstack server set --state active 1caf85fb-e025-4834-afc8-50c3fb7887df
[root@ctl01 ~]# openstack server show 1caf85fb-e025-4834-afc8-50c3fb7887df
+-------------------------------------+----------------------------------------------------------+
| Field                               | Value                                                    |
+-------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                   | AUTO                                                     |
| OS-EXT-AZ:availability_zone         | nova                                                     |
| OS-EXT-SRV-ATTR:host                | cs07                                                     |
| OS-EXT-SRV-ATTR:hypervisor_hostname | cs07                                                     |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000015                                        |
| OS-EXT-STS:power_state              | Shutdown                                                 |
| OS-EXT-STS:task_state               | None                                                     |
| OS-EXT-STS:vm_state                 | stopped                                                  |
| OS-SRV-USG:launched_at              | 2021-08-26T03:25:01.000000                               |
| OS-SRV-USG:terminated_at            | None                                                     |
~~~
| volumes_attached                    | id='2f184cda-3e7a-4d13-89db-abc0e4002217'                |
+-------------------------------------+----------------------------------------------------------+

重启服务

task_status的状态修改正确后再重启服务。一切正常

[root@ctl01 ~]# openstack server start 1caf85fb-e025-4834-afc8-50c3fb7887df
[root@ctl01 ~]# openstack server show 1caf85fb-e025-4834-afc8-50c3fb7887df
+-------------------------------------+----------------------------------------------------------+
| Field                               | Value                                                    |
+-------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                   | AUTO                                                     |
| OS-EXT-AZ:availability_zone         | nova                                                     |
| OS-EXT-SRV-ATTR:host                | cs07                                                     |
| OS-EXT-SRV-ATTR:hypervisor_hostname | cs07                                                     |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000015                                        |
| OS-EXT-STS:power_state              | Running                                                  |
| OS-EXT-STS:task_state               | None                                                     |
| OS-EXT-STS:vm_state                 | active                                                   |
| OS-SRV-USG:launched_at              | 2021-08-26T03:25:01.000000                               |
| OS-SRV-USG:terminated_at            | None                                                     |
~~~
| volumes_attached                    | id='2f184cda-3e7a-4d13-89db-abc0e4002217'                |
+-------------------------------------+----------------------------------------------------------+

其他扩展

查看server set帮助后,感觉应该可以解决以前遇到的VM_stateerror的情况

[root@ctl01 ~]# openstack server set --help
usage: openstack server set [-h] [--name <new-name>] [--root-password]
                            [--property <key=value>] [--state <state>]
                            [--description <description>]
                            <server>

Set server properties

positional arguments:
  <server>              Server (name or ID)

optional arguments:
  -h, --help            show this help message and exit
  --name <new-name>     New server name
  --root-password       Set new root password (interactive only)
  --property <key=value>
                        Property to add/change for this server (repeat option
                        to set multiple properties)
  --state <state>       New server state (valid value: active, error)
  --description <description>
                        New server description (supported by --os-compute-api-
                        version 2.19 or above)

以前的解决办法是直接修改数据库。有点土。步骤如下

update instances set task_state = NULL,vm_state = 'stopped', power_state = 4 , host='cs07' where uuid='1caf85fb-e025-4834-afc8-50c3fb7887df'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值