app: setup_pools() must be a coroutine
This is needed as a consequence of d8b6d3ef
("Make add_pool/remove_pool
coroutines, allow Pool.{setup,destroy} as coroutines"), but there hasn't
been any problem so far because no storage driver implemented pool
setup() as a coroutine.
This commit is contained in:
parent
5b52d23478
commit
1d89acf698
@ -1242,10 +1242,11 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
|
|
||||||
raise KeyError(label)
|
raise KeyError(label)
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
def setup_pools(self):
|
def setup_pools(self):
|
||||||
""" Run implementation specific setup for each storage pool. """
|
""" Run implementation specific setup for each storage pool. """
|
||||||
for pool in self.pools.values():
|
yield from qubes.utils.void_coros_maybe(
|
||||||
pool.setup()
|
pool.setup() for pool in self.pools.values())
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def add_pool(self, name, **kwargs):
|
def add_pool(self, name, **kwargs):
|
||||||
|
@ -60,7 +60,7 @@ class AdminAPITestCase(qubes.tests.QubesTestCase):
|
|||||||
app = qubes.Qubes('/tmp/qubes-test.xml', load=False)
|
app = qubes.Qubes('/tmp/qubes-test.xml', load=False)
|
||||||
app.vmm = unittest.mock.Mock(spec=qubes.app.VMMConnection)
|
app.vmm = unittest.mock.Mock(spec=qubes.app.VMMConnection)
|
||||||
app.load_initial_values()
|
app.load_initial_values()
|
||||||
app.setup_pools()
|
self.loop.run_until_complete(app.setup_pools())
|
||||||
app.default_kernel = '1.0'
|
app.default_kernel = '1.0'
|
||||||
app.default_netvm = None
|
app.default_netvm = None
|
||||||
self.template = app.add_new_vm('TemplateVM', label='black',
|
self.template = app.add_new_vm('TemplateVM', label='black',
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
'''qubes-create - Create new Qubes OS store'''
|
'''qubes-create - Create new Qubes OS store'''
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
import qubes
|
import qubes
|
||||||
import qubes.tools
|
import qubes.tools
|
||||||
@ -37,8 +38,9 @@ def main(args=None):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
qubes.Qubes.create_empty_store(args.app,
|
asyncio.get_event_loop().run_until_complete(
|
||||||
offline_mode=args.offline_mode).setup_pools()
|
qubes.Qubes.create_empty_store(
|
||||||
|
args.app, offline_mode=args.offline_mode).setup_pools())
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user