[libvirt] [PATCH v2 2/3] qemuProcessHandleBlockJob: Take status into account

Jiri Denemark jdenemar at redhat.com
Wed Feb 11 16:46:55 UTC 2015


On Wed, Feb 11, 2015 at 13:51:10 +0100, Michal Privoznik wrote:
> Upon BLOCK_JOB_COMPLETED event delivery, we check if the job has
> completed (in qemuMonitorJSONHandleBlockJobImpl()). For better image,
> the event looks something like this:
> 
> "timestamp": {"seconds": 1423582694, "microseconds": 372666}, "event":
> "BLOCK_JOB_COMPLETED", "data": {"device": "drive-virtio-disk0", "len":
> 8412790784, "offset": 409993216, "speed": 8796093022207, "type":
> "mirror", "error": "No space left on device"}}
> 
> If "len" does not equal "offset" it's considered an error, and we can
> clearly see "error" field filled in. However, later in the event
> processing this case was handled no differently to case of job being
> aborted via separate API. It's time that we start differentiate these
> two because of the future work.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_process.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 7dc7d2b..c739775 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -1103,7 +1103,8 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
>          case VIR_DOMAIN_BLOCK_JOB_CANCELED:
>              virStorageSourceFree(disk->mirror);
>              disk->mirror = NULL;
> -            disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
> +            disk->mirrorState = status == VIR_DOMAIN_BLOCK_JOB_FAILED ?
> +                VIR_DOMAIN_DISK_MIRROR_STATE_ABORT : VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
>              disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
>              save = true;
>              break;

Heh, thanks to a limited context, it took me a bit to realize how status
can be *_FAILED when it is *_CANCELED :-)

ACK

Jirka




More information about the libvir-list mailing list