From 62c81044c5cd2beea1e6e749b8c35dc7468fee5d Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Fri, 15 Apr 2016 20:33:04 +0200 Subject: [PATCH] Add XenPool.setup/destroy --- qubes/storage/kernels.py | 6 ++++++ qubes/storage/xen.py | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/qubes/storage/kernels.py b/qubes/storage/kernels.py index d7441b29..8242aafa 100644 --- a/qubes/storage/kernels.py +++ b/qubes/storage/kernels.py @@ -71,12 +71,18 @@ class LinuxKernel(Pool): 'driver': LinuxKernel.driver, } + def destroy(self): + pass + def remove(self, volume): pass def rename(self, volume, old_name, new_name): return volume + def setup(self): + pass + def start(self, volume): path = volume.path if not os.path.exists(path): diff --git a/qubes/storage/xen.py b/qubes/storage/xen.py index aad54d9b..7bb0dfb3 100644 --- a/qubes/storage/xen.py +++ b/qubes/storage/xen.py @@ -45,12 +45,6 @@ class XenPool(Pool): assert dir_path, "No pool dir_path specified" self.dir_path = os.path.normpath(dir_path) - create_dir_if_not_exists(self.dir_path) - appvms_path = os.path.join(self.dir_path, 'appvms') - create_dir_if_not_exists(appvms_path) - vm_templates_path = os.path.join(self.dir_path, 'vm-templates') - create_dir_if_not_exists(vm_templates_path) - def clone(self, source, target): ''' Clones the volume if the `source.pool` if the source is a :py:class:`XenVolume`. @@ -148,6 +142,16 @@ class XenPool(Pool): os.umask(old_umask) return volume + def destroy(self): + pass + + def setup(self): + create_dir_if_not_exists(self.dir_path) + appvms_path = os.path.join(self.dir_path, 'appvms') + create_dir_if_not_exists(appvms_path) + vm_templates_path = os.path.join(self.dir_path, 'vm-templates') + create_dir_if_not_exists(vm_templates_path) + def start(self, volume): if volume.volume_type == 'volatile': self._reset_volume(volume)