vmcreate function phase 2
This commit is contained in:
parent
8c91b9dee6
commit
e1e2c72a7c
3 changed files with 3 additions and 6 deletions
2
grid.py
2
grid.py
|
@ -23,7 +23,7 @@ def queryvm(req_cube_id):
|
||||||
""" returns slave_name, vm_id and vm_type for the requested cubeid """
|
""" returns slave_name, vm_id and vm_type for the requested cubeid """
|
||||||
data = querydb(req_cube_id)
|
data = querydb(req_cube_id)
|
||||||
#print(data)
|
#print(data)
|
||||||
return data['slave'], data['type'], data['vmid'], data['host'], data['clientemail']
|
return data['slave'], data['type'], data['vmid'], data['hostname'], data['clientemail']
|
||||||
|
|
||||||
|
|
||||||
def querydb(cubeid):
|
def querydb(cubeid):
|
||||||
|
|
|
@ -83,8 +83,6 @@ def vmcreate(req):
|
||||||
}
|
}
|
||||||
proxobject = auth(slave_name)
|
proxobject = auth(slave_name)
|
||||||
real_slave_name = proxobject.cluster.status.get()[0]['name']
|
real_slave_name = proxobject.cluster.status.get()[0]['name']
|
||||||
#print(real_slave_name)
|
|
||||||
|
|
||||||
description = vm_name + ' (' + str(cubeid) + '/' + str(vm_id) + ')\n' + 'owned by ' + req['clientname'] + ' (' + req['clientid'] + ')\n'
|
description = vm_name + ' (' + str(cubeid) + '/' + str(vm_id) + ')\n' + 'owned by ' + req['clientname'] + ' (' + req['clientid'] + ')\n'
|
||||||
|
|
||||||
if req['vps_type'] == 'kvm':
|
if req['vps_type'] == 'kvm':
|
||||||
|
@ -124,12 +122,11 @@ def vmcreate(req):
|
||||||
|
|
||||||
print(str(create_result))
|
print(str(create_result))
|
||||||
|
|
||||||
#TODO: setup based on req['vps_recipe']
|
|
||||||
#start the machihe
|
#start the machihe
|
||||||
#time.sleep(7) #wait few seconds for the slave to prepare the machine for initial run
|
#time.sleep(7) #wait few seconds for the slave to prepare the machine for initial run
|
||||||
#vmstart(cubeid)
|
#vmstart(cubeid)
|
||||||
|
|
||||||
response = { 'status':'CREATE', 'cube':cubeid, 'name':vm_name, 'password':vm_pass }
|
response = { 'status': 'CREATE', 'cube': cubeid, 'hostname': vm_name, 'password': vm_pass, 'slave': real_slave_name }
|
||||||
grid.writedb(deploy)
|
grid.writedb(deploy)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ logger = ioconfig.logger
|
||||||
|
|
||||||
def welcome():
|
def welcome():
|
||||||
"""displays motd in log as welcome message"""
|
"""displays motd in log as welcome message"""
|
||||||
logger.info('# proxmaster ][ (c) 2015-2016 afx #')
|
logger.info('# proxmaster ][ (c) 2015-2017 deflax.net #')
|
||||||
|
|
||||||
|
|
||||||
def selector(fn, req, vmid=0):
|
def selector(fn, req, vmid=0):
|
||||||
|
|
Loading…
Reference in a new issue