From f02f9e3a412a2270e3a9928baadf3e73dc85fc4b Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Thu, 14 Apr 2016 19:00:52 +0200 Subject: [PATCH] Add XenPool init_volume --- qubes/storage/xen.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/qubes/storage/xen.py b/qubes/storage/xen.py index 49a03be9..303cfa33 100644 --- a/qubes/storage/xen.py +++ b/qubes/storage/xen.py @@ -282,3 +282,22 @@ class XenPool(Pool): def abspath(self, file_name): return os.path.join(self.target_dir, file_name) + + def init_volume(self, volume_config): + assert 'volume_type' in volume_config, "Volume type missing " \ + + str(volume_config) + target_dir = self.target_dir + assert target_dir, "Pool target_dir not set" + volume_type = volume_config['volume_type'] + volume_config['target_dir'] = target_dir + known_types = { + 'read-write': ReadWriteFile, + 'read-only': ReadOnlyFile, + 'origin': OriginFile, + 'snapshot': SnapshotFile, + 'volatile': VolatileFile, + } + if volume_type not in known_types: + raise StoragePoolException("Unknown volume type " + volume_type) + return known_types[volume_type](**volume_config) +