From 5ee05e06e50f9fff4688882a57917b3d7a141f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 21 Feb 2017 00:47:33 +0100 Subject: [PATCH] qubes/core2migration: update locking API Sync with 0141e1a "qubes/app: Allow keeping lock after load" --- qubes/core2migration.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qubes/core2migration.py b/qubes/core2migration.py index 831e9b0e..fc2d669e 100644 --- a/qubes/core2migration.py +++ b/qubes/core2migration.py @@ -230,12 +230,11 @@ class Core2Qubes(qubes.Qubes): del self.domains[vm] def load(self, lock=False): - qubes_store_file = open(self._store, 'r') - self._acquire_lock(qubes_store_file) + fh = self._acquire_lock() try: - qubes_store_file.seek(0) - tree = lxml.etree.parse(qubes_store_file) + fh.seek(0) + tree = lxml.etree.parse(fh) except (EnvironmentError, # pylint: disable=broad-except xml.parsers.expat.ExpatError) as err: self.log.error(err)