예제 #1
0
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 })
예제 #2
0
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
예제 #3
0
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 + '/')
예제 #4
0
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)
                    })
예제 #5
0
파일: forms.py 프로젝트: CCI-MOC/ui
    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)
예제 #6
0
파일: views.py 프로젝트: CCI-MOC/ui
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 + '/')
예제 #7
0
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 })
예제 #8
0
    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)
예제 #9
0
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
예제 #10
0
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
예제 #11
0
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