Close a project

This commit is contained in:
Julien Duponchelle committed 2015-01-23 14:07:10 +01:00
1 parent 986a7f55ef
commit 3f5c2390cd
5 files changed
+76 -8

No files matched your search

+1
View File
@@ -27,6 +27,7 @@ class BaseVM:
self._uuid = uuid
self._project = project
self._manager = manager
project.add_vm(self)
log.debug("{module}: {name} [{uuid}] initialized".format(module=self.manager.module_name,
name=self.name,
+18 -1
View File
@@ -46,6 +46,7 @@ class Project:
if location is None:
self._location = tempfile.mkdtemp()
self._vms = set()
self._vms_to_destroy = set()
self._path = os.path.join(self._location, self._uuid)
try:
@@ -68,6 +69,11 @@ class Project:
return self._path
@property
def vms(self):
return self._vms
def vm_working_directory(self, vm):
"""
Return a working directory for a specific VM.
@@ -98,10 +104,21 @@ class Project:
"location": self._location
}
def add_vm(self, vm):
"""
Add a VM to the project. In theory this should be called by
the VM initializer.
:params vm: A VM instance
"""
self._vms.add(vm)
def close(self):
"""Close the project, but keep informations on disk"""
pass
for vm in self._vms:
vm.close()
def commit(self):
"""Write project changes on disk"""