Exemplo n.º 1
0
def action_vm(request, server_id, vm_id, action):
	if (not request.user.is_superuser):
        
		return simple.direct_to_template(request,
			template = 'not_admin.html',
			extra_context = {'user':request.user},
		)

	if(action == 'list'):
          
		return simple.direct_to_template(
				request, template="servers/server_vm_details.html",
				extra_context={"vm": VTDriver.getVMbyId(vm_id), "server_id":server_id}
		)

	elif(action == 'check_status'):
		#XXX: Do this function if needed
		return simple.direct_to_template(
				request, template="servers/list_vm.html",
				extra_context={"vm": VM.objects.get(id = vm_id)}
		)
        elif(action == 'force_update_server'):
                InformationDispatcher.forceListActiveVMs(serverID=server_id)

        elif(action == 'force_update_vm'):
                InformationDispatcher.forceListActiveVMs(vmID=vm_id)
 
	else:
		#XXX: serverUUID should be passed in a different way
		VTDriver.PropagateActionToProvisioningDispatcher(vm_id, VTServer.objects.get(id=server_id).uuid, action)
    
	#return HttpResponseRedirect(reverse('edit_server', args = [server_id]))
	return HttpResponse("")
Exemplo n.º 2
0
def force_update_exp_vms(client_id='None', vm_id='None'):
    if client_id != "None":
        client_id = VTServer.objects.get(uuid=client_id).id
    if vm_id != "None":
        vm_id = VirtualMachine.objects.get(uuid=vm_id).id
    return InformationDispatcher.forceListActiveVMs(client_id, vm_id)
Exemplo n.º 3
0
def force_update_exp_vms(client_id='None', vm_id='None'):
    if client_id != "None":
        client_id = VTServer.objects.get(uuid = client_id).id
    if vm_id != "None":
        vm_id = VirtualMachine.objects.get(uuid= vm_id).id
    return InformationDispatcher.forceListActiveVMs(client_id, vm_id)