Пример #1
0
def VM_start(request, project, VMid):
    print (project, VMid)                   #debugging
    if VMid[len(VMid)-1] == '/':            #strip ending /
        VMid = VMid[:len(VMid)-1]
    nova = api.get_nova(request, project)   #get nova object
    api.startVM(nova, VMid)                 #start specified Nova object
    return HttpResponseRedirect('/control/' + project + '/')    #back to control
Пример #2
0
Файл: views.py Проект: hoodsy/UI
def editControlVM(request):
	"""
	EditVM modal footer; submission of VM controlling actions
	"""
        if request.method == 'POST':
                form = VMControlForm(request.POST)
                if form.is_valid():
			VM_id = form.cleaned_data['VM_id']
			if(form.cleaned_data['action'] == 'start'):
			  api.startVM(VM_id)
			elif(form.cleaned_data['action'] == 'pause'):
			  api.pauseVM(VM_id)
			elif(form.cleaned_data['action'] == 'stop'):
			  api.stopVM(VM_id)
	return HttpResponseRedirect('/project_space/manage')