phase2
This commit is contained in:
parent
8bba4a75b2
commit
60401254cd
3 changed files with 2 additions and 8 deletions
|
@ -29,8 +29,7 @@ def addclient(vmid, vmname, clientid, clientname, clientemail, vmpass):
|
||||||
newclient = { str(clientid):vcard }
|
newclient = { str(clientid):vcard }
|
||||||
clientsdb.update(newclient)
|
clientsdb.update(newclient)
|
||||||
#Send initial email to the user as we will use the internal auth from now on.
|
#Send initial email to the user as we will use the internal auth from now on.
|
||||||
###utils.sendmail(clientemail, '{} logged in.'.format)
|
#utils.sendmail(clientemail, '{} logged in.'.format)
|
||||||
#TODO: Sync with proxmaster-admin database (shell command could be used for this one)
|
|
||||||
ioconfig.logger.info('client[{}]> vmid {} is now owned by {} ({})'.format(clientid, vmid, clientemail, clientname))
|
ioconfig.logger.info('client[{}]> vmid {} is now owned by {} ({})'.format(clientid, vmid, clientemail, clientname))
|
||||||
|
|
||||||
#create initial vm template
|
#create initial vm template
|
||||||
|
|
2
grid.py
2
grid.py
|
@ -217,7 +217,7 @@ def generate_ipv4(region_id, how_many=1):
|
||||||
ip_max = len(region_ips) - 1
|
ip_max = len(region_ips) - 1
|
||||||
tested_ips = [] #initialize ip cache
|
tested_ips = [] #initialize ip cache
|
||||||
requested_ips = []
|
requested_ips = []
|
||||||
all_ips = utils.find_rec(grid_data, 'ipaddr')
|
all_ips = utils.find_rec(grid_data, 'ipaddr') #TODO: we cant list that for KVM so we should use another approach. perhaps as separate macaddress - ipaddress table which we will use to manipulate a static lease dhcp server. at this point this function is useless because plugins do not or cant track the address of the actual machine. proxmaster should divide each region to segments and each segment should export a static lease config which will be quieried when we search for unused addresses.
|
||||||
|
|
||||||
for ips in range(int(how_many)):
|
for ips in range(int(how_many)):
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
|
@ -85,7 +85,6 @@ def vmcreate(req):
|
||||||
|
|
||||||
response = { 'status':'CREATE', 'vmid':vm_id, 'name':vm_name, 'password':vm_pass, 'ipv4_0':vm_ipv4[0] }
|
response = { 'status':'CREATE', 'vmid':vm_id, 'name':vm_name, 'password':vm_pass, 'ipv4_0':vm_ipv4[0] }
|
||||||
|
|
||||||
disk_filename = 'vm-' + vm_id + '-disk-1'
|
|
||||||
description = vm_name + ' (' + vm_id + ')\n'
|
description = vm_name + ' (' + vm_id + ')\n'
|
||||||
description += 'owned by ' + client_name + ' (' + client_id + ')\n'
|
description += 'owned by ' + client_name + ' (' + client_id + ')\n'
|
||||||
description += 'master ip: ' + vm_ipv4[0]
|
description += 'master ip: ' + vm_ipv4[0]
|
||||||
|
@ -158,7 +157,6 @@ def vmstart(vm_id):
|
||||||
result = proxobject.nodes(slave_name).qemu(vm_id).status.start.post()
|
result = proxobject.nodes(slave_name).qemu(vm_id).status.start.post()
|
||||||
if vm_type == 'lxc':
|
if vm_type == 'lxc':
|
||||||
result = proxobject.nodes(slave_name).lxc(vm_id).status.start.post()
|
result = proxobject.nodes(slave_name).lxc(vm_id).status.start.post()
|
||||||
#ioconfig.logger.info('slave[{}]> {}'.format(slave_name, result))
|
|
||||||
response = { 'status':'START' }
|
response = { 'status':'START' }
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@ -209,7 +207,6 @@ def vmsuspend(vm_id):
|
||||||
result = proxobject.nodes(slave_name).qemu(vm_id).status.suspend.post()
|
result = proxobject.nodes(slave_name).qemu(vm_id).status.suspend.post()
|
||||||
if vm_type == 'lxc':
|
if vm_type == 'lxc':
|
||||||
result = proxobject.nodes(slave_name).lxc(vm_id).status.suspend.post()
|
result = proxobject.nodes(slave_name).lxc(vm_id).status.suspend.post()
|
||||||
#ioconfig.logger.info('slave[{}]> {}'.format(slave_name, result))
|
|
||||||
response = { 'status':'SUSPEND', 'vmid':vm_id }
|
response = { 'status':'SUSPEND', 'vmid':vm_id }
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@ -226,7 +223,6 @@ def vmresume(vm_id):
|
||||||
result = proxobject.nodes(slave_name).qemu(vm_id).status.resume.post()
|
result = proxobject.nodes(slave_name).qemu(vm_id).status.resume.post()
|
||||||
if vm_type == 'lxc':
|
if vm_type == 'lxc':
|
||||||
result = proxobject.nodes(slave_name).lxc(vm_id).status.resume.post()
|
result = proxobject.nodes(slave_name).lxc(vm_id).status.resume.post()
|
||||||
#ioconfig.logger.info('slave[{}]> {}'.format(slave_name, result))
|
|
||||||
response = { 'status':'RESUME', 'vmid':vm_id }
|
response = { 'status':'RESUME', 'vmid':vm_id }
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@ -312,5 +308,4 @@ if __name__ == '__main__':
|
||||||
#internal module tests
|
#internal module tests
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
vmvnc(656758)
|
vmvnc(656758)
|
||||||
#vmstart(656758)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue