On Thu, Dec 08, 2022 at 14:30:47 +0100, Pavel Hrdina wrote:
QEMU emits this signal when autofinalize is disabled and QEMU is
waiting
for the caller to start the finalization manually.
Note that this is not true. The block job transitions through the
pending state also when started with auto-finalization requested.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_backup.c | 1 +
src/qemu/qemu_blockjob.c | 20 +++++++++++++++++++-
src/qemu/qemu_blockjob.h | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
[...]
@@ -1563,6 +1566,18 @@ qemuBlockJobEventProcess(virQEMUDriver
*driver,
job->newstate = -1;
break;
+ case QEMU_BLOCKJOB_STATE_PENDING:
+ /* similarly as for 'ready' state we should handle it only when
+ * previous state was 'new' or 'running' as when aborting job it
can
+ * reset the internally set job state */
Well this assumption will not work for active layer block commit, which
also transitions through the _READY state. Since you are modifying block
commit that might be relevant.
Let's see how it will be used.
If it isn't to be used with active layer block commit you should most
likely mention that in the comment for the block commit code or disallow
it altogether to prevent surprises for others wanting to use it in the
future.
+ if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
+ job->state == QEMU_BLOCKJOB_STATE_RUNNING) {
+ job->state = job->newstate;
+ qemuDomainSaveStatus(vm);
+ }
+ job->newstate = -1;