openstack 如何通过计算 API 或连接 API 获取已删除的服务器列表

how openstack get deleted server list by compute API or connection API

我想通过 API operation 获取一些像 openstack server list --delete 这样的删除服务器列表,我该如何实现,THX。

您走在正确的轨道上,但显然没有坚持到底。如果您查看 https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detailed-detail#list-servers you'll find the servers/detail section,您会在其中找到有关选项的更多详细信息:

deleted (Optional)

Show deleted items only. In some circumstances deleted items will still be accessible via the backend database, however there is no contract on how long, so this parameter should be used with caution. 1, t, true, on, y and yes are treated as True (case-insensitive). Other than them are treated as False.

This parameter is only valid when specified by administrators. If non-admin users specify this parameter, it is ignored.

您可以在 openstack 上找到已删除或停止的实例信息的一个很棒的地方是 mysql。例如 运行 这个查询:

ubuntu

#mysql -e "use nova; select * from instances \G;"

centos

#mysql -uroot -p(password) -e "use nova; select * from instances \G;"

你的输出会让你大吃一惊。

另见 cinder 数据库。保证你会找到一些重要的数据。