diff --git a/plugin.py b/plugin.py index ed28bcb..9c6cb02 100644 --- a/plugin.py +++ b/plugin.py @@ -79,7 +79,7 @@ def vmcreate(req): for ip in vm_ipv4: ipv4_dict[str(ipidx)] = str(ip) ipidx += 1 - response = { 'status':'CREATING', 'vmid':vm_id, 'name':vm_name, 'password':'TODO', 'ipv4_0':vm_ipv4[0] } + response = { 'status':'CREATE', 'vmid':vm_id, 'name':vm_name, 'password':'TODO', 'ipv4_0':vm_ipv4[0] } disk_filename = 'vm-' + vm_id + '-disk-1' description = vm_name + ' (' + vm_id + ')\n' @@ -156,7 +156,7 @@ def vmstart(vm_id): if vm_type == 'lxc': result = proxobject.nodes(slave_name).lxc(vm_id).status.start.post() #ioconfig.logger.info('grid[{}]> {}'.format(slave_name, result)) - response = { 'status':'STARTING' } + response = { 'status':'START' } return response @@ -190,7 +190,7 @@ def vmstop(vm_id): if vm_type == 'lxc': result = proxobject.nodes(slave_name).lxc(vm_id).status.stop.post() #ioconfig.logger.info('grid[{}]> {}'.format(slave_name, result)) - response = { 'status':'STOPPING', 'vmid':vm_id } + response = { 'status':'STOP', 'vmid':vm_id } return response @@ -207,7 +207,7 @@ def vmshutdown(vm_id): if vm_type == 'lxc': result = proxobject.nodes(slave_name).lxc(vm_id).status.shutdown.post() #ioconfig.logger.info('grid[{}]> {}'.format(slave_name, result)) - response = { 'status':'ACPI SHUTDOWN', 'vmid':vm_id } + response = { 'status':'SHUTDOWN', 'vmid':vm_id } return response @@ -274,7 +274,7 @@ def vmvnc(vm_id): 'listen_port': listenport } - vnc_options = { 'idle-timeout': 20, + vnc_options = { 'idle-timeout': 10, 'verbose': True } @@ -282,9 +282,10 @@ def vmvnc(vm_id): external_url = ioconfig.parser.get('general', 'novnc_url') prefix = external_url + "/?host=" + myip + "&port=" + listenport + "&encrypt=0&true_color=1&password=" - ioconfig.logger.info('grid[{}]> {}'.format(slave_name, prefix + ticket['ticket'])) + vnc_url = prefix + ticket['ticket'] + ioconfig.logger.info('grid[{}]> {}'.format(slave_name, vnc_url)) - response = { 'status':'VNC', 'vmid':vm_id } + response = { 'status':'VNC', 'fqdn':external_url, 'host':myip, 'port':listenport, 'encrypt':'0', 'true_color':'1', 'ticket':ticket['ticket'] } return response