aboutsummaryrefslogtreecommitdiffstats
path: root/src/resource_inventory
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2019-05-08 12:26:20 -0400
committerSawyer Bergeron <sbergeron@iol.unh.edu>2019-05-08 12:26:20 -0400
commitc808a76d52ba7de96f6fcd6eaad35c1dc2f41e53 (patch)
treea9bb4e38062a58e866358cb31310b2b772bd1890 /src/resource_inventory
parent2fec9e57b50fee61e896f820d28aa363982413e9 (diff)
Fix vlan leak
Change-Id: Ida98327266df6cfbd4398b897ebcbcc4dc5df24d Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/resource_inventory')
-rw-r--r--src/resource_inventory/resource_manager.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py
index d3d3ed4..652e4e3 100644
--- a/src/resource_inventory/resource_manager.py
+++ b/src/resource_inventory/resource_manager.py
@@ -104,7 +104,7 @@ class ResourceManager:
try:
physical_host = self.acquireHost(generic_host, genericResourceBundle.lab.name)
except ResourceAvailabilityException:
- self.fail_acquire(physical_hosts, vlan_map)
+ self.fail_acquire(physical_hosts, vlan_map, genericResourceBundle)
raise ResourceAvailabilityException("Could not provision hosts, not enough available")
try:
physical_host.bundle = resource_bundle
@@ -114,12 +114,12 @@ class ResourceManager:
self.configureNetworking(physical_host, vlan_map)
except Exception:
- self.fail_acquire(physical_hosts, vlan_map)
+ self.fail_acquire(physical_hosts, vlan_map, genericResourceBundle)
raise ResourceProvisioningException("Network configuration failed.")
try:
physical_host.save()
except Exception:
- self.fail_acquire(physical_hosts)
+ self.fail_acquire(physical_hosts, vlan_map, genericResourceBundle)
raise ModelValidationException("Saving hosts failed")
return resource_bundle
@@ -167,9 +167,8 @@ class ResourceManager:
else:
vlan_manager.release_vlans(vlan_id)
- def fail_acquire(self, hosts, vlans):
- grb = hosts[0].template.resource.bundle
- vlan_manager = hosts[0].lab.vlan_manager
+ def fail_acquire(self, hosts, vlans, grb):
+ vlan_manager = grb.lab.vlan_manager
self.releaseNetworks(grb, vlan_manager, vlans)
for host in hosts:
self.releaseHost(host)