diff options
author | ssmith <ssmith@iol.unh.edu> | 2020-05-27 19:19:03 -0400 |
---|---|---|
committer | ssmith <ssmith@iol.unh.edu> | 2020-05-28 15:12:37 -0400 |
commit | 945bfa360ed4c30f8a9b684dd49441afeeb4c9c1 (patch) | |
tree | ec0091a0124b585b15e52fffb2e2f100362b540c /src/resource_inventory/resource_manager.py | |
parent | 9ebe025e1385a0a4fa8e24ad62cc1c0f8808fb9c (diff) |
Some small fixes to launch Akraino
Signed-off-by: Sean Smith <ssmith@iol.unh.edu>
Change-Id: If64d15afa456b7bdf25d40015decb37b1a20da54
Diffstat (limited to 'src/resource_inventory/resource_manager.py')
-rw-r--r-- | src/resource_inventory/resource_manager.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py index 4d539bd..9300040 100644 --- a/src/resource_inventory/resource_manager.py +++ b/src/resource_inventory/resource_manager.py @@ -82,7 +82,7 @@ class ResourceManager: networks[network.name] = vlan return networks - def instantiateTemplate(self, resource_template, config=None): + def instantiateTemplate(self, resource_template): """ Convert a ResourceTemplate into a ResourceBundle. @@ -114,14 +114,16 @@ class ResourceManager: def configureNetworking(self, resource, vlan_map): for physical_interface in resource.interfaces.all(): # assign interface configs - iface_configs = InterfaceConfiguration.objects.filter(profile=physical_interface.profile, resource_config=resource.config) - if iface_configs.count() != 1: - continue + + iface_configs = InterfaceConfiguration.objects.filter( + profile=physical_interface.profile, + resource_config=resource.config + ) + iface_config = iface_configs.first() physical_interface.acts_as = iface_config physical_interface.acts_as.save() - #if not iface_config: - # continue + physical_interface.config.clear() for connection in iface_config.connections.all(): physicalNetwork = PhysicalNetwork.objects.create( @@ -139,7 +141,11 @@ class ResourceManager: # private interface def acquireHost(self, resource_config): - resources = resource_config.profile.get_resources(lab=resource_config.template.lab, unreserved=True) + resources = resource_config.profile.get_resources( + lab=resource_config.template.lab, + unreserved=True + ) + try: resource = resources[0] # TODO: should we randomize and 'load balance' the servers? resource.config = resource_config |