def release(self):
self.count -= 1
- if self._ecobj.get_global('PlanetlabNode', 'persist_blacklist') and self.count == 0:
- if self._blacklist:
- to_blacklist = list()
- hostnames = self.get_nodes(list(self._blacklist), ['hostname'])
- for hostname in hostnames:
- to_blacklist.append(hostname['hostname'])
-
- nepi_home = os.path.join(os.path.expanduser("~"), ".nepi")
- plblacklist_file = os.path.join(nepi_home, "plblacklist.txt")
-
- with open(plblacklist_file, 'w') as f:
- for host in to_blacklist:
- f.write("%s\n" % host)
+ if self.count == 0:
+ blacklist = self._blacklist
+ self._blacklist = set()
+ self._reserved = set()
+ if self._ecobj.get_global('PlanetlabNode', 'persist_blacklist'):
+ if blacklist:
+ to_blacklist = list()
+ hostnames = self.get_nodes(list(blacklist), ['hostname'])
+ for hostname in hostnames:
+ to_blacklist.append(hostname['hostname'])
+
+ nepi_home = os.path.join(os.path.expanduser("~"), ".nepi")
+ plblacklist_file = os.path.join(nepi_home, "plblacklist.txt")
+
+ with open(plblacklist_file, 'w') as f:
+ for host in to_blacklist:
+ f.write("%s\n" % host)
+
class PLCAPIFactory(object):
"""
super(PlanetlabSfaNode, self).do_provision()
+ def do_release(self):
+ super(PlanetlabSfaNode, self).do_release()
+ if self.state == ResourceState.RELEASED and not self._skip_provision():
+ self.debug(" Releasing SFA API ")
+ self.sfaapi.release()
+
# def _filter_based_on_attributes(self):
# """
# Retrive the list of nodes hrn that match user's constraints