From f5cef35cdf50fcdd86ec3d11425012cecf65ae51 Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Wed, 25 Nov 2015 16:01:28 +0100 Subject: [PATCH] Fix circular deps workaround in Pool.vmdir_path() --- core/storage/__init__.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/core/storage/__init__.py b/core/storage/__init__.py index 5c5bc41c..c5d3c4a1 100644 --- a/core/storage/__init__.py +++ b/core/storage/__init__.py @@ -382,22 +382,17 @@ class Pool(object): string (str) absolute path to the directory where the vm files are stored """ - # TODO: This is a hack, circular dependencies problem? - from qubes.qubes import (QubesAppVm, QubesDisposableVm, QubesHVm, - QubesNetVm, QubesTemplateHVm, QubesTemplateVm) - vm_type = type(vm) - - if vm_type in [QubesAppVm, QubesHVm]: + if vm.is_appvm(): subdir = 'appvms' - elif vm_type in [QubesTemplateVm, QubesTemplateHVm]: + elif vm.is_template(): subdir = 'vm-templates' - elif issubclass(vm_type, QubesNetVm): + elif vm.is_netvm(): subdir = 'servicevms' - elif vm_type is QubesDisposableVm: + elif vm.is_disposablevm(): subdir = 'appvms' return os.path.join(pool_dir, subdir, vm.template.name + '-dvm') else: - raise QubesException(str(vm_type) + ' unknown vm type') + raise QubesException(vm.type() + ' unknown vm type') return os.path.join(pool_dir, subdir, vm.name)