天天看點

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        |
|
           

繼續閱讀