From aeb83d1a45b221ce2c00a2c3389fbc90073c143f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 21 Nov 2013 04:36:53 +0100 Subject: [PATCH] hvm: do not reset root.img to template state when debug mode enabled --- core-modules/01QubesHVm.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core-modules/01QubesHVm.py b/core-modules/01QubesHVm.py index 2fa7d5a9..f79dfe9e 100644 --- a/core-modules/01QubesHVm.py +++ b/core-modules/01QubesHVm.py @@ -263,7 +263,16 @@ class QubesHVm(QubesVm): return if os.path.exists (self.volatile_img): - os.remove (self.volatile_img) + if self.debug: + if os.path.getmtime(self.template.root_img) > os.path.getmtime(self.volatile_img): + if kwargs.get("verbose", False): + print >>sys.stderr, "--> WARNING: template have changed, resetting root.img" + else: + if kwargs.get("verbose", False): + print >>sys.stderr, "--> Debug mode: not resetting root.img" + print >>sys.stderr, "--> Debug mode: if you want to force root.img reset, either update template VM, or remove volatile.img file" + return + os.remove (self.volatile_img) f_volatile = open (self.volatile_img, "w") f_root = open (self.template.root_img, "r")