From de5d420331edb091cc7b510a2ff2d14a5ab8b7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 18 Aug 2016 11:43:01 +0200 Subject: [PATCH] qubes-lvm: drop unused lvm_image_changed function It tries to parse (untrusted) volume content, so remove it to not use it accidentally. QubesOS/qubes-issues#2256 --- qubes/tools/qubes_lvm.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/qubes/tools/qubes_lvm.py b/qubes/tools/qubes_lvm.py index adcfc577..e5bf2103 100644 --- a/qubes/tools/qubes_lvm.py +++ b/qubes/tools/qubes_lvm.py @@ -22,9 +22,7 @@ from __future__ import print_function -import datetime import logging -import os import subprocess import sys import time @@ -35,23 +33,6 @@ import qubes log = logging.getLogger('qubes.storage.lvm') -def lvm_image_changed(vm): - ''' Returns true if source image changed ''' - # TODO: reimplement lvm_image_changed - vm_root = vm.root_img - tp_root = vm.template.root_img - if not os.path.exists(vm_root): - return False - cmd = 'date +"%%s" -d "' + \ - '`sudo tune2fs %s -l|grep "Last write time"|cut -d":" -f2,3,4`"' - result1 = subprocess.check_output(cmd % vm_root, shell=True).strip() - result2 = subprocess.check_output(cmd % tp_root, shell=True).strip() - - result1 = datetime.datetime.strptime(result1, '%c') - result2 = datetime.datetime.strptime(result2, '%c') - return result2 > result1 - - def pool_exists(args): """ Check if given name is an lvm thin volume. """ # TODO Implement a faster and proper working version pool_exists