aboutsummaryrefslogtreecommitdiffstats
path: root/src/booking/views.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-03-16 17:54:09 +0000
committerGerrit Code Review <gerrit@opnfv.org>2020-03-16 17:54:09 +0000
commit0db3a84d9d9ed213983a517efd35c339537ef472 (patch)
treea6d7ac7ba2f2d70e18cb984bda4020c736082c62 /src/booking/views.py
parent176ec9aacbc87e6077e8807c60f95a1ccbbc26e3 (diff)
parent064f145f218385a6401fa6be2ccbbc462e915c26 (diff)
Merge "Test resource templates now use the same lab as the image generated alongside it."
Diffstat (limited to 'src/booking/views.py')
-rw-r--r--src/booking/views.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/booking/views.py b/src/booking/views.py
index 8e25952..daaf026 100644
--- a/src/booking/views.py
+++ b/src/booking/views.py
@@ -18,7 +18,7 @@ from django.shortcuts import redirect, render
from django.db.models import Q
from django.urls import reverse
-from resource_inventory.models import ResourceBundle, HostProfile, Image, Host
+from resource_inventory.models import ResourceBundle, ResourceProfile, Image, ResourceQuery
from resource_inventory.resource_manager import ResourceManager
from account.models import Lab, Downtime
from booking.models import Booking
@@ -42,11 +42,11 @@ def quick_create(request):
context = {}
r_manager = ResourceManager.getInstance()
- profiles = {}
+ templates = {}
for lab in Lab.objects.all():
- profiles[str(lab)] = r_manager.getAvailableHostTypes(lab)
+ templates[str(lab)] = r_manager.getAvailableResourceTemplates(lab, request.user)
- context['lab_profile_map'] = profiles
+ context['lab_profile_map'] = templates
context['form'] = QuickBookingForm(default_user=request.user.username, user=request.user)
@@ -130,7 +130,7 @@ class ResourceBookingsJSON(View):
def build_image_mapping(lab, user):
mapping = {}
- for profile in HostProfile.objects.filter(labs=lab):
+ for profile in ResourceProfile.objects.filter(labs=lab):
images = Image.objects.filter(
from_lab=lab,
host_type=profile
@@ -178,7 +178,7 @@ def booking_modify_image(request, booking_id):
if timezone.now() > booking.end:
return HttpResponse("unauthorized")
new_image = Image.objects.get(id=form.cleaned_data['image_id'])
- host = Host.objects.get(id=form.cleaned_data['host_id'])
+ host = ResourceQuery.get(labid=form.cleaned_data['host_id'])
host.config.image = new_image
host.config.save()
JobFactory.reimageHost(new_image, booking, host)