Skip to contentSkip to conversation

qapi: block-core: Clarify events emitted by 'block-job-cancel'

PATCH Superseded Kashyap Chamarthy 3 participants 8 messages Nov 15, 2017 – Nov 17, 2017

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qapi: block-core: Clarify events emitted by 'block-job-cancel'

When you cancel an in-progress live block operation with QMP block-job-cancel, it emits the event: BLOCK_JOB_CANCELLED. However, when block-job-cancel is issued after drive-mirror has indicated (by emitting the event BLOCK_JOB_READY) that the source and destination remain synchronized:

    [...] # Snip `drive-mirror` invocation & outputs
    {
      "execute":"block-job-cancel",
      "arguments":{
        "device":"virtio0"
      }
    }

    {"return": {}}

It (block-job-cancel) will counterintuitively emit the event 'BLOCK_JOB_COMPLETED':

    {
      "timestamp":{
        "seconds":1510678024,
        "microseconds":526240
      },
      "event":"BLOCK_JOB_COMPLETED",
      "data":{
        "device":"virtio0",
        "len":41126400,
        "offset":41126400,
        "speed":0,
        "type":"mirror"
      }
    }

But this is expected behaviour, where the _COMPLETED event indicates that synchronization has successfully ended (and the destination has a point-in-time copy, which is at the time of cancel).

So add a small note to this effect. (Thanks: Max Reitz for reminding me of this on IRC.)

---
Changes in v2:
- "Note:" seems to be a special construct in Patchew, my usage caused a build failure. So do: s/Note:/Note that/
- Add the missing 'Signed-off-by'

---
 qapi/block-core.json | 8 ++++++++
 1 file changed, 8 insertions(+)
qapi/block-core.json +8 -0
index ab96e348e6317bb42769ae20f4a4519bac02e93a..4ecfd1fbc5bc231c69da15d489c44e3e8b0706a5 100644
@@ -2065,6 +2065,14 @@
 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
 # enumerated using query-block-jobs.
 #
+# Note that the 'block-job-cancel' command will emit the event
+# BLOCK_JOB_COMPLETED if you issue it ('block-job-cancel') after 'drive-mirror'
+# has indicated (by emitting the event BLOCK_JOB_READY) that the source and
+# destination remain synchronized.  In this case, the BLOCK_JOB_COMPLETED
+# event indicates that synchronization (from 'drive-mirror') has successfully
+# ended and the destination now has a point-in-time copy, which is at the time
+# of cancel.
+#
 # For streaming, the image file retains its backing file unless the streaming
 # operation happens to complete just as it is being cancelled.  A new streaming
 # operation can be started at a later time to finish copying all data from the
Signature · 1 line
2.9.5
#1 lore raw
Quoted 34 lines · Kashyap Chamarthy

When you cancel an in-progress live block operation with QMP block-job-cancel, it emits the event: BLOCK_JOB_CANCELLED. However, when block-job-cancel is issued after drive-mirror has indicated (by emitting the event BLOCK_JOB_READY) that the source and destination remain synchronized:

    [...] # Snip `drive-mirror` invocation & outputs
    {
      "execute":"block-job-cancel",
      "arguments":{
        "device":"virtio0"
      }
    }

    {"return": {}}

It (block-job-cancel) will counterintuitively emit the event 'BLOCK_JOB_COMPLETED':

    {
      "timestamp":{
        "seconds":1510678024,
        "microseconds":526240
      },
      "event":"BLOCK_JOB_COMPLETED",
      "data":{
        "device":"virtio0",
        "len":41126400,
        "offset":41126400,
        "speed":0,
        "type":"mirror"
      }
    }
Quoted 7 lines

But this is expected behaviour, where the _COMPLETED event indicates that synchronization has successfully ended (and the destination has a point-in-time copy, which is at the time of cancel).

So add a small note to this effect. (Thanks: Max Reitz for reminding me of this on IRC.)

I suppose this difference probably isn't covered in what was the bitmaps.md doc file (we don't bother covering mirror there, only backup); is it covered sufficiently in live-block-operations.rst ?

--js

#2 lore raw
Quoted 8 lines · John Snow
Quoted 5 lines · Kashyap Chamarthy

When you cancel an in-progress live block operation with QMP block-job-cancel, it emits the event: BLOCK_JOB_CANCELLED. However, when block-job-cancel is issued after drive-mirror has indicated (by emitting the event BLOCK_JOB_READY) that the source and destination remain synchronized:

[...]

Quoted 11 lines
Quoted 7 lines

But this is expected behaviour, where the _COMPLETED event indicates that synchronization has successfully ended (and the destination has a point-in-time copy, which is at the time of cancel).

So add a small note to this effect. (Thanks: Max Reitz for reminding me of this on IRC.)

I suppose this difference probably isn't covered in what was the bitmaps.md doc file (we don't bother covering mirror there, only backup);

Your supposition is correct: Looking at the now-renamed 'bitmaps.rst'[1], it isn't covered there.

Quoted 1 line

is it covered sufficiently in live-block-operations.rst ?

I looked in there[2] too. Short answer: no. Long: In the "Live disk synchronization — drive-mirror and blockdev-mirror" section, I simply seemed to declare:

"Issuing the command ``block-job-cancel`` after it emits the event ``BLOCK_JOB_CANCELLED``"

As if that's the *only* event it emits, which is clearly not the case. So while at it, wonder if should I also update it ('live-block-operations.rst') too.

[1] https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/bitmaps.rst
[2] https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/live-block-operations.rst#l513

Signature · 1 line
/kashyap
#3 lore raw
Quoted 20 lines · Kashyap Chamarthy
Quoted 8 lines · John Snow
Quoted 5 lines · Kashyap Chamarthy

When you cancel an in-progress live block operation with QMP block-job-cancel, it emits the event: BLOCK_JOB_CANCELLED. However, when block-job-cancel is issued after drive-mirror has indicated (by emitting the event BLOCK_JOB_READY) that the source and destination remain synchronized:

[...]

Quoted 8 lines
Quoted 7 lines

But this is expected behaviour, where the _COMPLETED event indicates that synchronization has successfully ended (and the destination has a point-in-time copy, which is at the time of cancel).

So add a small note to this effect. (Thanks: Max Reitz for reminding me of this on IRC.)

Quoted 7 lines
Quoted 3 lines

I suppose this difference probably isn't covered in what was the bitmaps.md doc file (we don't bother covering mirror there, only backup);

Your supposition is correct: Looking at the now-renamed 'bitmaps.rst'[1], it isn't covered there.

Makes sense, I don't think we need to correct this, and

Quoted 6 lines
Quoted 1 line

is it covered sufficiently in live-block-operations.rst ?

I looked in there[2] too. Short answer: no. Long: In the "Live disk synchronization — drive-mirror and blockdev-mirror" section, I simply seemed to declare:

Quoted 7 lines

"Issuing the command ``block-job-cancel`` after it emits the event ``BLOCK_JOB_CANCELLED``"

As if that's the *only* event it emits, which is clearly not the case. So while at it, wonder if should I also update it ('live-block-operations.rst') too.

It's an interesting gotcha that I wasn't really acutely aware of myself, so having it in the doc format for API programmers who aren't necessarily digging through our source sounds like a pleasant courtesy.

Quoted 3 lines

[1] https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/bitmaps.rst
[2] https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/live-block-operations.rst#l513

Thanks Kashyap :)

#4 lore raw
Quoted 4 lines · John Snow
Quoted 1 line · Kashyap Chamarthy

On Wed, Nov 15, 2017 at 02:15:57PM -0500, John Snow wrote:

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

is it covered sufficiently in live-block-operations.rst ?

I looked in there[2] too. Short answer: no. Long: In the "Live disk synchronization — drive-mirror and blockdev-mirror" section, I simply seemed to declare:

"Issuing the command ``block-job-cancel`` after it emits the event ``BLOCK_JOB_CANCELLED``"

Quoted 8 lines
Quoted 4 lines

As if that's the *only* event it emits, which is clearly not the case. So while at it, wonder if should I also update it ('live-block-operations.rst') too.

It's an interesting gotcha that I wasn't really acutely aware of myself, so having it in the doc format for API programmers who aren't necessarily digging through our source sounds like a pleasant courtesy.

Indeed, will do. (Just for my own clarity, did you imply: don't update it in block-core.json? FWIW, my first instinct is to check the QAPI documentation for such things, that's why I wrote there first :-))

Thanks for looking.

[...]

Signature · 1 line
/kashyap
#5 lore raw
Quoted 22 lines · Kashyap Chamarthy
Quoted 4 lines · John Snow
Quoted 1 line · Kashyap Chamarthy

On Wed, Nov 15, 2017 at 02:15:57PM -0500, John Snow wrote:

[...]

Quoted 14 lines
Quoted 13 lines
Quoted 1 line

is it covered sufficiently in live-block-operations.rst ?

I looked in there[2] too. Short answer: no. Long: In the "Live disk synchronization — drive-mirror and blockdev-mirror" section, I simply seemed to declare:

"Issuing the command ``block-job-cancel`` after it emits the event ``BLOCK_JOB_CANCELLED``"

As if that's the *only* event it emits, which is clearly not the case. So while at it, wonder if should I also update it ('live-block-operations.rst') too.

Quoted 8 lines
Quoted 3 lines

It's an interesting gotcha that I wasn't really acutely aware of myself, so having it in the doc format for API programmers who aren't necessarily digging through our source sounds like a pleasant courtesy.

Indeed, will do. (Just for my own clarity, did you imply: don't update it in block-core.json? FWIW, my first instinct is to check the QAPI documentation for such things, that's why I wrote there first :-))

No, definitely update both.

Quoted 4 lines

Thanks for looking.

[...]

#6 lore raw
In reply to Kashyap Chamarthy

Am 16.11.2017 um 10:14 hat Kashyap Chamarthy geschrieben:

Quoted 22 lines · John Snow
Quoted 4 lines · Kashyap Chamarthy
Quoted 1 line · John Snow

[...]

Quoted 14 lines
Quoted 13 lines
Quoted 1 line

is it covered sufficiently in live-block-operations.rst ?

I looked in there[2] too. Short answer: no. Long: In the "Live disk synchronization — drive-mirror and blockdev-mirror" section, I simply seemed to declare:

"Issuing the command ``block-job-cancel`` after it emits the event ``BLOCK_JOB_CANCELLED``"

As if that's the *only* event it emits, which is clearly not the case. So while at it, wonder if should I also update it ('live-block-operations.rst') too.

Quoted 7 lines
Quoted 3 lines

It's an interesting gotcha that I wasn't really acutely aware of myself, so having it in the doc format for API programmers who aren't necessarily digging through our source sounds like a pleasant courtesy.

Indeed, will do. (Just for my own clarity, did you imply: don't update it in block-core.json? FWIW, my first instinct is to check the QAPI documentation for such things, that's why I wrote there first :-))

Will that be a separate patch or do you intend to send a v3?

Kevin

#7 lore raw
Quoted 2 lines · Kevin Wolf

Am 16.11.2017 um 10:14 hat Kashyap Chamarthy geschrieben:

Quoted 1 line · John Snow

[...]

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

It's an interesting gotcha that I wasn't really acutely aware of myself, so having it in the doc format for API programmers who aren't necessarily digging through our source sounds like a pleasant courtesy.

Indeed, will do. (Just for my own clarity, did you imply: don't update it in block-core.json? FWIW, my first instinct is to check the QAPI documentation for such things, that's why I wrote there first :-))

Will that be a separate patch or do you intend to send a v3?

I can send a separate one if you prefer, but I was intending to send a v3 with both files fixed as it's just a related trivial change. Is that okay?

Signature · 1 line
/kashyap