def network(request, project): createVMform = forms.Create_VM() vms = api.listVMs(api.get_nova(request, project)) return render(request, 'network.html', {'project': [project] , 'vms': vms, 'createVMform': createVMform })
def VM_stop(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.stopVM(nova, VMid) #stop specified Nova object return HttpResponseRedirect('/control/' + project + '/') #back to control
def VM_active_state_toggle (request, project, VMid): print (project, VMid) if VMid[len(VMid)-1] == '/': VMid = VMid[:len(VMid)-1] nova = api.get_nova(request, project) api.VM_active_state_toggle(nova, VMid) return HttpResponseRedirect('/control/' + project + '/')
def control(request, project): vms = api.listVMs(api.get_nova(request, project)) return render(request, 'control.html', {'project': [project], 'vms': vms, 'vm_modals': html.vm_modals(request) })
def save(self, request, force_insert=False, force_update=False, commit=True): name = self.cleaned_data['name'] image = str(self.cleaned_data['image']) flavor = self.cleaned_data['flavor'] nova = api.get_nova(request, 'ui') api.createVM(nova, name, image, flavor)
def VM_active_state_toggle (request, project, VMid): print (project, VMid) print VMid[len(VMid)-1] print VMid[:len(VMid)-1] if VMid[len(VMid)-1] == '/': VMid = VMid[:len(VMid)-1] nova = api.get_nova(request, project) api.VM_active_state_toggle(nova, VMid) return HttpResponseRedirect('/control/' + project + '/')
def control(request, project): createVMform = forms.Create_VM() # UIProject.objects.filter(name = project).__dict__ vms = api.listVMs(api.get_nova(request, project)) project = [project] return render(request, 'control.html', {'project': project, 'vms': vms, 'createVMform': createVMform })
def VM_add(request, project, VMname, imageName, flavorName): print (project, VMname, imageName, flavorName) #debugging # if request.method == 'POST': # form = forms.Create_VM(request.POST) # if form.is_valid(): # print "form is valid." # nameVM = form.cleaned_data['VM_name'] # nameFlavor nova = api.get_nova(request, project) #get nova object api.createVM(nova, VMname, imageName, flavorName) #add specified Nova object return HttpResponseRedirect('/control/' + project + '/') #back to control
def VM_add_default(request, project): print (project) nova = api.get_nova(request, project) #get nova object api.createDefault(nova) return HttpResponseRedirect('/control/' + project + '/') #back to control