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 = {}
|
result = {}
|
||||||
if vm_type == 'kvm':
|
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['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(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='mem,maxmem')
|
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(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='netin,netout')
|
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(node=slave_name, vmid=vm_id, timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
result['hdd'] = proxobject.nodes(slave_name).qemu(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
||||||
|
|
||||||
if vm_type == 'lxc':
|
if vm_type == 'lxc':
|
||||||
result = proxobject.nodes(slave_name).lxc(vm_id).rrd.get()
|
result['cpu'] = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='cpu')
|
||||||
repsonse = { 'status':'RRD', 'vmid':vm_id, rrd:result }
|
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):
|
def vmvnc(vm_id):
|
||||||
""" invoke vnc ticket """
|
""" invoke vnc ticket """
|
||||||
slave_id, vm_type = grid.query_vm(vm_id)
|
slave_id, vm_type = grid.query_vm(vm_id)
|
||||||
|
|
|
@ -231,7 +231,7 @@ class RRDResource(object):
|
||||||
""" Generate rrd pngs """
|
""" Generate rrd pngs """
|
||||||
logger.info('grid> rrd ' + str(vmid))
|
logger.info('grid> rrd ' + str(vmid))
|
||||||
resp.status, response = selector('vmrrd', req, vmid)
|
resp.status, response = selector('vmrrd', req, vmid)
|
||||||
req.context['result' = response
|
req.context['result'] = response
|
||||||
|
|
||||||
class VNCResource(object):
|
class VNCResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
|
@ -281,7 +281,7 @@ res_stop = StopResource()
|
||||||
api.add_route('/vmstop/{vmid}', res_stop)
|
api.add_route('/vmstop/{vmid}', res_stop)
|
||||||
|
|
||||||
res_rrd = RRDResource()
|
res_rrd = RRDResource()
|
||||||
api.add_route('vmrrd/{vmid}', res_rrd)
|
api.add_route('/vmrrd/{vmid}', res_rrd)
|
||||||
|
|
||||||
res_vnc = VNCResource()
|
res_vnc = VNCResource()
|
||||||
api.add_route('/vmvnc/{vmid}', res_vnc)
|
api.add_route('/vmvnc/{vmid}', res_vnc)
|
||||||
|
|
Loading…
Reference in a new issue