diff --git a/clientsdb.py b/clientsdb.py index 327bb0a..bc6414f 100644 --- a/clientsdb.py +++ b/clientsdb.py @@ -29,8 +29,7 @@ def addclient(vmid, vmname, clientid, clientname, clientemail, vmpass): newclient = { str(clientid):vcard } clientsdb.update(newclient) #Send initial email to the user as we will use the internal auth from now on. - ###utils.sendmail(clientemail, '{} logged in.'.format) - #TODO: Sync with proxmaster-admin database (shell command could be used for this one) + #utils.sendmail(clientemail, '{} logged in.'.format) ioconfig.logger.info('client[{}]> vmid {} is now owned by {} ({})'.format(clientid, vmid, clientemail, clientname)) #create initial vm template diff --git a/grid.py b/grid.py index 282eb76..ba457c3 100644 --- a/grid.py +++ b/grid.py @@ -217,7 +217,7 @@ def generate_ipv4(region_id, how_many=1): ip_max = len(region_ips) - 1 tested_ips = [] #initialize ip cache 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)): counter = 0 diff --git a/plugin.py b/plugin.py index d28d588..b7a3f0d 100644 --- a/plugin.py +++ b/plugin.py @@ -85,7 +85,6 @@ def vmcreate(req): 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 += 'owned by ' + client_name + ' (' + client_id + ')\n' 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() if vm_type == 'lxc': result = proxobject.nodes(slave_name).lxc(vm_id).status.start.post() - #ioconfig.logger.info('slave[{}]> {}'.format(slave_name, result)) response = { 'status':'START' } return response @@ -209,7 +207,6 @@ def vmsuspend(vm_id): result = proxobject.nodes(slave_name).qemu(vm_id).status.suspend.post() if vm_type == 'lxc': 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 } return response @@ -226,7 +223,6 @@ def vmresume(vm_id): result = proxobject.nodes(slave_name).qemu(vm_id).status.resume.post() if vm_type == 'lxc': 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 } return response @@ -312,5 +308,4 @@ if __name__ == '__main__': #internal module tests time.sleep(1) vmvnc(656758) - #vmstart(656758)