change api commands names
This commit is contained in:
parent
97efded2d0
commit
091eee2671
2 changed files with 14 additions and 8 deletions
18
plugin.py
18
plugin.py
|
@ -241,16 +241,22 @@ def vmrrd(vm_id):
|
|||
|
||||
result = {}
|
||||
if vm_type == 'kvm':
|
||||
result['cpu'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='cpu')
|
||||
result['mem'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='mem,maxmem')
|
||||
result['net'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='netin,netout')
|
||||
result['hdd'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
||||
result['cpu'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='cpu')
|
||||
result['mem'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='mem,maxmem')
|
||||
result['net'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='netin,netout')
|
||||
result['hdd'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
||||
|
||||
if vm_type == 'lxc':
|
||||
result = proxobject.nodes(slave_name).lxc(vm_id).rrd.get()
|
||||
repsonse = { 'status':'RRD', 'vmid':vm_id, rrd:result }
|
||||
result['cpu'] = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='cpu')
|
||||
result['mem'] = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='mem,maxmem')
|
||||
result['net'] = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='netin,netout')
|
||||
result['hdd'] = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
||||
|
||||
|
||||
|
||||
repsonse = { 'status':'RRD', 'vmid':vm_id, 'rrd':result }
|
||||
return response
|
||||
|
||||
def vmvnc(vm_id):
|
||||
""" invoke vnc ticket """
|
||||
slave_id, vm_type = grid.query_vm(vm_id)
|
||||
|
|
|
@ -231,7 +231,7 @@ class RRDResource(object):
|
|||
""" Generate rrd pngs """
|
||||
logger.info('grid> rrd ' + str(vmid))
|
||||
resp.status, response = selector('vmrrd', req, vmid)
|
||||
req.context['result' = response
|
||||
req.context['result'] = response
|
||||
|
||||
class VNCResource(object):
|
||||
@falcon.before(max_body(64 * 1024))
|
||||
|
@ -281,7 +281,7 @@ res_stop = StopResource()
|
|||
api.add_route('/vmstop/{vmid}', res_stop)
|
||||
|
||||
res_rrd = RRDResource()
|
||||
api.add_route('vmrrd/{vmid}', res_rrd)
|
||||
api.add_route('/vmrrd/{vmid}', res_rrd)
|
||||
|
||||
res_vnc = VNCResource()
|
||||
api.add_route('/vmvnc/{vmid}', res_vnc)
|
||||
|
|
Loading…
Reference in a new issue