From: chandrureddy <chandra(a)linux.vnet.ibm.com>
Earlier been used libvirt to fetch the vms information in the back end code
UI was using REST API 'plugins/kimchi/vms' to get the vms info.
Ginger Base not have this functionality and will not work on plain linux.
Ginger Base should handle well on both plain linux with out KVM and with KVM
New code provides REST API 'plugins/gingerbase/vms'
1. to get the vms information on KVM mahcine (virsh way)
For ex:
[root@chandra wok]# curl -k -u root -H "Content-Type: application/json" -H
"Accept: application/json" \
-X "GET"
https://127.0.0.1:8001/plugins/gingerbase/vms
Enter host password for user 'root':
[
{
"state":"shut off",
"id":"-",
"name":"a8Sr0LzRgWjEqy3iiKjQvA"
},
{
"state":"shut off",
"id":"-",
"name":"Fedora21"
},
{
"state":"shut off",
"id":"-",
"name":"kimchi-cdrom"
},
{
"state":"shut off",
"id":"-",
"name":"kimchi-ifaces"
}
]
2. return empty json in case of plain linux machine
For ex:
[root@chandra wok]# curl -k -u root -H "Content-Type: application/json" -H
"Accept: application/json" \
-X "GET"
https://127.0.0.1:8001/plugins/gingerbase/vms
Enter host password for user 'root':
[
]
chandrureddy (1):
Take off libvirt to get vms info used before any shutdown and reboot
actions
src/wok/plugins/gingerbase/control/vmsinfo.py | 34 +++++++++++++
src/wok/plugins/gingerbase/i18n.py | 1 +
src/wok/plugins/gingerbase/model/host.py | 23 +++------
src/wok/plugins/gingerbase/model/vmsinfo.py | 32 ++++++++++++
.../plugins/gingerbase/ui/js/src/gingerbase.api.js | 12 +++++
.../gingerbase/ui/js/src/gingerbase.host.js | 23 ++++-----
src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl | 2 +
src/wok/plugins/gingerbase/utils.py | 59 +++++++++++++++++++++-
8 files changed, 157 insertions(+), 29 deletions(-)
create mode 100644 src/wok/plugins/gingerbase/control/vmsinfo.py
create mode 100644 src/wok/plugins/gingerbase/model/vmsinfo.py
--
2.1.0