Fix Pod detail menu and re-imaging 97/70597/2
authorSean Smith <ssmith@iol.unh.edu>
Tue, 28 Jul 2020 17:53:51 +0000 (13:53 -0400)
committerSean Smith <ssmith@iol.unh.edu>
Fri, 31 Jul 2020 16:21:48 +0000 (12:21 -0400)
Signed-off-by: Sean Smith <ssmith@iol.unh.edu>
Change-Id: I483c9e9c6dc8d492cc9340ab42b6b2d518f52950

src/api/models.py
src/booking/views.py
src/templates/base/booking/booking_detail.html

index 960fc26..8de3ec7 100644 (file)
@@ -880,13 +880,13 @@ class JobFactory(object):
         """Modify an existing job to reimage the given host."""
         job = Job.objects.get(booking=booking)
         # make hardware task new
-        hardware_relation = HostHardwareRelation.objects.get(host=host, job=job)
-        hardware_relation.config.set_image(new_image.lab_id)
+        hardware_relation = HostHardwareRelation.objects.get(resource_id=host, job=job)
+        hardware_relation.config.image = new_image.lab_id
         hardware_relation.config.save()
         hardware_relation.status = JobStatus.NEW
 
         # re-apply networking after host is reset
-        net_relation = HostNetworkRelation.objects.get(host=host, job=job)
+        net_relation = HostNetworkRelation.objects.get(resource_id=host, job=job)
         net_relation.status = JobStatus.NEW
 
         # re-apply ssh access after host is reset
index 3c95e07..bd57812 100644 (file)
@@ -173,7 +173,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 = ResourceQuery.get(labid=form.cleaned_data['host_id'])
+        host = ResourceQuery.get(id=form.cleaned_data['host_id'])
         host.config.image = new_image
         host.config.save()
         JobFactory.reimageHost(new_image, booking, host)
index fea2bb6..4b70f69 100644 (file)
             </div>
             <div class="collapse show" id="pod_panel">
                 <div class="card-body">
-                    {% for host in booking.resource.hosts.all %}
-                        <h4>{{host.template.resource.name}}</h4>
+                    {% for host in booking.resource.get_resources %}
+                        <h4>{{host.bundle.template.copy_of.name}}</h4>
                         <div class="overflow-auto">
                             <table class="table m-0">
                                 <tr>
                                     <td>Hostname:</td>
-                                    <td>{{host.template.resource.name}}</td>
+                                    <td>{{host.name}}</td>
                                 </tr>
                                 <tr>
                                     <td>Machine:</td>
                                 </tr>
                                 <tr>
                                     <td>Role:</td>
-                                    <td>{{host.config.opnfvRole}}</td>
+                                    <td>{{host.template.opnfvRole}}</td>
                                 </tr>
                                 <tr>
                                     <td>Image:</td>
                                     <td id="host_image_{{host.id}}">
-                                        {{host.config.image}}
+                                        {{host.config.Image}}
                                         <button
                                             class="btn btn-primary ml-4"
                                             data-toggle="modal"