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)