storage: make verify() asyncio aware
This commit is contained in:
parent
d57aef96e5
commit
595d983659
@ -431,6 +431,7 @@ class Storage(object):
|
|||||||
pool = self.get_pool(volume)
|
pool = self.get_pool(volume)
|
||||||
volumes[name] = pool.rename(volume, old_name, new_name)
|
volumes[name] = pool.rename(volume, old_name, new_name)
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
def verify(self):
|
def verify(self):
|
||||||
'''Verify that the storage is sane.
|
'''Verify that the storage is sane.
|
||||||
|
|
||||||
@ -440,8 +441,13 @@ class Storage(object):
|
|||||||
raise qubes.exc.QubesVMError(
|
raise qubes.exc.QubesVMError(
|
||||||
self.vm,
|
self.vm,
|
||||||
'VM directory does not exist: {}'.format(self.vm.dir_path))
|
'VM directory does not exist: {}'.format(self.vm.dir_path))
|
||||||
|
futures = []
|
||||||
for volume in self.vm.volumes.values():
|
for volume in self.vm.volumes.values():
|
||||||
self.get_pool(volume).verify(volume)
|
ret = self.get_pool(volume).verify(volume)
|
||||||
|
if asyncio.iscoroutine(ret):
|
||||||
|
futures.append(ret)
|
||||||
|
if futures:
|
||||||
|
yield from asyncio.wait(futures)
|
||||||
self.vm.fire_event('domain-verify-files')
|
self.vm.fire_event('domain-verify-files')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -677,7 +683,9 @@ class Pool(object):
|
|||||||
This can be implemented as a coroutine.'''
|
This can be implemented as a coroutine.'''
|
||||||
|
|
||||||
def verify(self, volume):
|
def verify(self, volume):
|
||||||
''' Verifies the volume. '''
|
''' Verifies the volume.
|
||||||
|
|
||||||
|
This can be implemented as a coroutine.'''
|
||||||
raise self._not_implemented("verify")
|
raise self._not_implemented("verify")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -854,8 +854,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
self.fire_event_pre('domain-pre-start', preparing_dvm=preparing_dvm,
|
self.fire_event_pre('domain-pre-start', preparing_dvm=preparing_dvm,
|
||||||
start_guid=start_guid, mem_required=mem_required)
|
start_guid=start_guid, mem_required=mem_required)
|
||||||
|
|
||||||
yield from asyncio.get_event_loop().run_in_executor(None,
|
yield from self.storage.verify()
|
||||||
self.storage.verify)
|
|
||||||
|
|
||||||
if self.netvm is not None:
|
if self.netvm is not None:
|
||||||
# pylint: disable = no-member
|
# pylint: disable = no-member
|
||||||
|
Loading…
Reference in New Issue
Block a user