Skip to content

Commit

Permalink
Make VM info caching optional in VMPool.add_vm()
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Nov 13, 2016
1 parent 64e3455 commit ee0363d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gc3libs/backends/vmpool.py
Expand Up @@ -136,7 +136,7 @@ def __setstate__(self, state):
def __str__(self):
return "VMPool('%s') : %s" % (self.name, self._vm_ids)

def add_vm(self, vm):
def add_vm(self, vm, cache=True):
"""
Add a VM object to the list of VMs.
"""
Expand All @@ -145,7 +145,8 @@ def add_vm(self, vm):
gc3libs.utils.write_contents(
os.path.join(self.path, vm.id), vm.preferred_ip)
self._vm_ids.add(vm.id)
self._vm_cache[vm.id] = vm
if cache:
self._vm_cache[vm.id] = vm
self.changed = True

def remove_vm(self, vm_id):
Expand Down

0 comments on commit ee0363d

Please sign in to comment.