天天看点

openstack 管理三十六 - openstack 资源查询常用 sql作用查询用户对应主机

作用

直接通过查询 openstack 数据库, 获得相应的常见查询结果
查询用户使用中主机, 及其主机对应信息
查询用户使用中存储, 及其存储对应信息
           

查询用户对应主机

参考例子

mysql> select a.display_name instnace from nova.instances a,  keystone.user b 
where b.id=a.user_id 
  and a.vm_state in ('active', 'building', 'stopped') 
  and a.deleted = 0 
  and b.name='terry.zeng';
+---------------------------------------+
| instnace                              |
+---------------------------------------+
| terry-zskvt.xxxxxxx.xxx               |
| cloud-logmon-rmasm.xxxxxxx.xxx        |
| cloud-logmon-detzu.xxxxxxx.xxx        |
| cloud-logmon-rzje2.xxxxxxx.xxx        |
| cloud-logmon-rejat.xxxxxxx.xxx        |
| cloud-logmon-tgshs.xxxxxxx.xxx        |
| cloud-logmon-9kpm4.xxxxxxx.xxx        |
| cloud-logmon-ragyg.xxxxxxx.xxx        |
| cloud-logmon-zwvff.xxxxxxx.xxx        |
| cloud-logmon-vnagw.xxxxxxx.xxx        |
|
           

继续阅读