From b119b2c36bd14fec93a52aae462956c89f4c8dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 20 May 2016 23:56:02 +0200 Subject: [PATCH] storage/file: simplify search for origin volume of snapshot/read-only Check directly vm.template, throwing AttributeError when not found. There may be some value in converting it to more descriptive error, but since that's mostly for internal users (not user facing actions) don't bother for now. QubesOS/qubes-issues#1842 --- qubes/storage/file.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qubes/storage/file.py b/qubes/storage/file.py index 8fc7f02f..2fa33f32 100644 --- a/qubes/storage/file.py +++ b/qubes/storage/file.py @@ -239,10 +239,8 @@ class FilePool(Pool): if volume_type in ['snapshot', 'read-only']: name = volume_config['name'] - origin_vm = vm - while hasattr(origin_vm, 'template') and \ - origin_vm.volume_config[name]['volume_type'] == \ - volume_type: + origin_vm = vm.template + while origin_vm.volume_config[name]['volume_type'] == volume_type: origin_vm = origin_vm.template expected_origin_type = {