vmcreate phase 3
This commit is contained in:
parent
48af0fbc50
commit
e84e2ee981
2 changed files with 10 additions and 10 deletions
|
@ -242,7 +242,7 @@ def vmrrd(cubeid):
|
||||||
rhdd = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
rhdd = proxobject.nodes(slave_name).lxc(vm_id).rrd.get(timeframe='day', cf='AVERAGE', ds='diskread,diskwrite')
|
||||||
status = str(statusquery['qmpstatus']) #TODO: maybe change this?
|
status = str(statusquery['qmpstatus']) #TODO: maybe change this?
|
||||||
|
|
||||||
ioconfig.logger.info('%s[%s]> rrd of %s %s (%s). status: %s' % (vm_owner, slave_name, vm_type, vm_id, vm_host, status))
|
#ioconfig.logger.info('%s[%s]> rrd of %s %s (%s). status: %s' % (vm_owner, slave_name, vm_type, vm_id, vm_host, status))
|
||||||
|
|
||||||
response = { 'status':status, 'cpu':rcpu, 'mem':rmem, 'net':rnet, 'hdd':rhdd }
|
response = { 'status':status, 'cpu':rcpu, 'mem':rmem, 'net':rnet, 'hdd':rhdd }
|
||||||
return response
|
return response
|
||||||
|
|
|
@ -140,7 +140,7 @@ class CreateResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp):
|
def on_post(self, req, resp):
|
||||||
"""Create a cluster node, returns array of: status, vmid, pass, ipv4, """
|
"""Create a cluster node, returns array of: status, vmid, pass, ipv4, """
|
||||||
logger.info('grid> create new cube')
|
#logger.info('grid> create new cube')
|
||||||
resp.status, response = selector('vmcreate', req)
|
resp.status, response = selector('vmcreate', req)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ class StatusResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" check vm status """
|
""" check vm status """
|
||||||
logger.info('grid> status ' + str(vmid))
|
#logger.info('grid> status ' + str(vmid))
|
||||||
resp.status, response = selector('vmstatus', req, vmid)
|
resp.status, response = selector('vmstatus', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ class DeleteResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" delete machine completely"""
|
""" delete machine completely"""
|
||||||
logger.info('grid> delete ' + str(vmid))
|
#logger.info('grid> delete ' + str(vmid))
|
||||||
resp.status, response = selector('vmdelete', req, vmid)
|
resp.status, response = selector('vmdelete', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class SuspendResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" Temporary suspend the instance """
|
""" Temporary suspend the instance """
|
||||||
logger.info('grid> suspend ' + str(vmid))
|
#logger.info('grid> suspend ' + str(vmid))
|
||||||
resp.status, response = selector('vmsuspend', req, vmid)
|
resp.status, response = selector('vmsuspend', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class ResumeResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" Unuspend the instance """
|
""" Unuspend the instance """
|
||||||
logger.info('grid> resume ' + str(vmid))
|
#logger.info('grid> resume ' + str(vmid))
|
||||||
resp.status, response = selector('vmresume', req, vmid)
|
resp.status, response = selector('vmresume', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ class StartResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" Start the instance """
|
""" Start the instance """
|
||||||
logger.info('grid> start ' + str(vmid))
|
#logger.info('grid> start ' + str(vmid))
|
||||||
resp.status, response = selector('vmstart', req, vmid)
|
resp.status, response = selector('vmstart', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class ShutdownResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" ACPI Shutdown the instance """
|
""" ACPI Shutdown the instance """
|
||||||
logger.info('grid> shutdown ' + str(vmid))
|
#logger.info('grid> shutdown ' + str(vmid))
|
||||||
resp.status, response = selector('vmshutdown', req, vmid)
|
resp.status, response = selector('vmshutdown', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ class StopResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" Stop the instance """
|
""" Stop the instance """
|
||||||
logger.info('grid> stop ' + str(vmid))
|
#logger.info('grid> stop ' + str(vmid))
|
||||||
resp.status, response = selector('vmstop', req, vmid)
|
resp.status, response = selector('vmstop', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class VNCResource(object):
|
||||||
@falcon.before(max_body(64 * 1024))
|
@falcon.before(max_body(64 * 1024))
|
||||||
def on_post(self, req, resp, vmid):
|
def on_post(self, req, resp, vmid):
|
||||||
""" Create a VNC link to the instance """
|
""" Create a VNC link to the instance """
|
||||||
logger.info('grid> vnc ' + str(vmid))
|
#logger.info('grid> vnc ' + str(vmid))
|
||||||
resp.status, response = selector('vmvnc', req, vmid)
|
resp.status, response = selector('vmvnc', req, vmid)
|
||||||
req.context['result'] = response
|
req.context['result'] = response
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue