- cco = (BlockdevCreateCo) {
- .drv = drv,
- .opts = options,
- .ret = -EINPROGRESS,
- .errp = errp,
- };
-
- co = qemu_coroutine_create(bdrv_co_create_co_entry, &cco);
- qemu_coroutine_enter(co);
- while (cco.ret == -EINPROGRESS) {
- aio_poll(qemu_get_aio_context(), true);
+ /* Create the block job */
+ /* TODO Running in the main context. Block drivers need to error out or add
+ * locking when they use a BDS in a different AioContext. */
+ s = job_create(job_id, &blockdev_create_job_driver, NULL,
+ qemu_get_aio_context(), JOB_DEFAULT | JOB_MANUAL_DISMISS,
+ NULL, NULL, errp);
+ if (!s) {
+ return;