diff options
author | Sawyer Bergeron <sawyerbergeron@gmail.com> | 2019-01-17 11:30:35 -0500 |
---|---|---|
committer | Sawyer Bergeron <sawyerbergeron@gmail.com> | 2019-01-18 11:27:53 -0500 |
commit | e3842fee2abb084d020acf7b868af745b8a66c18 (patch) | |
tree | a65021580b41005e266a18231a4a58a8386cc3ba /dashboard/src/resource_inventory/resource_manager.py | |
parent | de2031ad28b3556a65d19151be3a8b459b151c65 (diff) |
Add Quick-Booking Workflow
Users can now quickly provision a single-host pod without having to
configure unecessary networking. This is intended to be analogous to the
workflow used during LaaS 1.0, and to speed up the process of creating a
booking for users who do not need more than a single host (for virtual
deployments)
Change-Id: Ia19cea9a42bbb1df57aad05af8f8ea821395664d
Signed-off-by: Sawyer Bergeron <sawyerbergeron@gmail.com>
Diffstat (limited to 'dashboard/src/resource_inventory/resource_manager.py')
-rw-r--r-- | dashboard/src/resource_inventory/resource_manager.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/dashboard/src/resource_inventory/resource_manager.py b/dashboard/src/resource_inventory/resource_manager.py index 9282580..812fcd7 100644 --- a/dashboard/src/resource_inventory/resource_manager.py +++ b/dashboard/src/resource_inventory/resource_manager.py @@ -17,7 +17,7 @@ from dashboard.exceptions import ( ResourceProvisioningException, ModelValidationException, ) -from resource_inventory.models import Host, HostConfiguration, ResourceBundle +from resource_inventory.models import Host, HostConfiguration, ResourceBundle, HostProfile class ResourceManager: @@ -33,6 +33,11 @@ class ResourceManager: ResourceManager.instance = ResourceManager() return ResourceManager.instance + def getAvailableHostTypes(self, lab): + hostset = Host.objects.filter(lab=lab).filter(booked=False).filter(working=True) + hostprofileset = HostProfile.objects.filter(host__in=hostset, labs=lab) + return set(hostprofileset) + # public interface def deleteResourceBundle(self, resourceBundle): for host in Host.objects.filter(bundle=resourceBundle): @@ -70,12 +75,12 @@ class ResourceManager: physical_hosts.append(physical_host) self.configureNetworking(physical_host) - except: + except Exception: self.fail_acquire(physical_hosts) raise ResourceProvisioningException("Network configuration failed.") try: physical_host.save() - except: + except Exception: self.fail_acquire(physical_hosts) raise ModelValidationException("Saving hosts failed") |