|
@@ -206,6 +206,18 @@ class Volume:
|
|
|
'''
|
|
|
raise self._not_implemented("export")
|
|
|
|
|
|
+ def export_end(self, path):
|
|
|
+ """ Cleanup after exporting data.
|
|
|
+
|
|
|
+ This method is called after exporting the volume data (using
|
|
|
+ :py:meth:`export`), when the *path* is not needed anymore.
|
|
|
+
|
|
|
+ This can be implemented as a coroutine.
|
|
|
+
|
|
|
+ :param path: path to cleanup, returned by :py:meth:`export`
|
|
|
+ """
|
|
|
+ # do nothing by default (optional method)
|
|
|
+
|
|
|
def import_data(self, size):
|
|
|
''' Returns a path to overwrite volume data.
|
|
|
|
|
@@ -643,6 +655,19 @@ class Storage:
|
|
|
|
|
|
return self.vm.volumes[volume].export()
|
|
|
|
|
|
+ @asyncio.coroutine
|
|
|
+ def export_end(self, volume, export_path):
|
|
|
+ """ Cleanup after exporting data from the volume
|
|
|
+
|
|
|
+ :param volume: volume that was exported
|
|
|
+ :param export_path: path returned by the export() call
|
|
|
+ """
|
|
|
+ assert isinstance(volume, (Volume, str)), \
|
|
|
+ "You need to pass a Volume or pool name as str"
|
|
|
+ if not isinstance(volume, Volume):
|
|
|
+ volume = self.vm.volumes[volume]
|
|
|
+ yield from qubes.utils.coro_maybe(volume.export_end(export_path))
|
|
|
+
|
|
|
@asyncio.coroutine
|
|
|
def import_data(self, volume, size):
|
|
|
'''
|