Beispiel #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("")
Beispiel #2
0
 def processVMTemplatesInfo(serverUUID):
 #def processVMTemplatesInfo(serverUUID, callbackURL):
     #ServiceThread.startMethodInNewThread(InformationDispatcher.listVMTemplatesInfo, [serverUUID, callbackURL])
     
     #if not callbackURL and threading.currentThread().callBackURL:
     #    callbackURL = threading.currentThread().callBackURL
     #vm_templates = SyncThread.startMethodAndJoin(InformationDispatcher.listVMTemplatesInfo, serverUUID, callbackURL)
     #return vm_templates
     
     return InformationDispatcher.listVMTemplatesInfo(serverUUID)
Beispiel #3
0
    def processVMTemplatesInfo(serverUUID):
        #def processVMTemplatesInfo(serverUUID, callbackURL):
        #ServiceThread.startMethodInNewThread(InformationDispatcher.listVMTemplatesInfo, [serverUUID, callbackURL])

        #if not callbackURL and threading.currentThread().callBackURL:
        #    callbackURL = threading.currentThread().callBackURL
        #vm_templates = SyncThread.startMethodAndJoin(InformationDispatcher.listVMTemplatesInfo, serverUUID, callbackURL)
        #return vm_templates

        return InformationDispatcher.listVMTemplatesInfo(serverUUID)
Beispiel #4
0
    def processInformation(remoteHashValue, projectUUID ,sliceUUID):
		return InformationDispatcher.listResources(remoteHashValue, projectUUID, sliceUUID)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
0
 def processInformation(remoteHashValue, projectUUID, sliceUUID):
     return InformationDispatcher.listResources(remoteHashValue,
                                                projectUUID, sliceUUID)