[pve-devel] possible problem with drive-mirror and block-job-completed

Alexandre DERUMIER aderumier at odiso.com
Wed Oct 1 16:09:40 CEST 2014


Hi, 
Bug report here: 

http://forum.proxmox.com/threads/19733-storage-migration-virtio-failed?p=101317#post101317 

Rbd -> rbd drive mirror. 




Currently, we are using qmp block-job-complete just after drive-mirror,

but block-job-complete need to be sure that drives are correctly sync

static void mirror_complete(BlockJob *job, Error **errp)
{
    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
    Error *local_err = NULL;
    int ret;

    ret = bdrv_open_backing_file(s->target, NULL, &local_err);
    if (ret < 0) {
        error_propagate(errp, local_err);
        return;
    }
    if (!s->synced) {

 ------------------------> HANG HERE <--------------------------------

        error_set(errp, QERR_BLOCK_JOB_NOT_READY, job->bs->device_name);
        return;
    }

    /* check the target bs is not blocked and block all operations on it */
    if (s->replaces) {
        s->to_replace = check_to_replace_node(s->replaces, &local_err);
        if (!s->to_replace) {
            error_propagate(errp, local_err);
            return;
        }

        error_setg(&s->replace_blocker,
                   "block device is in use by block-job-complete");
        bdrv_op_block_all(s->to_replace, s->replace_blocker);
        bdrv_ref(s->to_replace);
    }

    s->should_complete = true;
    block_job_resume(job);
}


>From qemu doc:

a event is sent when disk are sync
"
* MIRROR_STATE_CHANGE: new event, triggered every time the
block-job-complete becomes available/unavailable.  Contains the device
name (like device: 'ide0-hd0'), and the state (synced: true/false).
"

So, the good way is to get the event and do the block-job-complete when we receive it.



Now, I really don't known how to implemented event manage that with current proxmox code.



More information about the pve-devel mailing list