qubes/core2migration: update locking API

Sync with 0141e1a "qubes/app: Allow keeping lock after load"
This commit is contained in:
Marek Marczykowski-Górecki 2017-02-21 00:47:33 +01:00
parent 570cbe5225
commit 5ee05e06e5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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)