Skip to content

Commit

Permalink
catch error if job cancellation attempts to stop already finished blo…
Browse files Browse the repository at this point in the history
…ck-jobs
  • Loading branch information
abbbi committed Dec 12, 2024
1 parent 42e3331 commit 10d38ab
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions qmpbackup
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import signal
import argparse
from datetime import datetime
from dataclasses import asdict
from qemu.qmp import protocol, QMPClient
from qemu.qmp import protocol, QMPClient, qmp_client
from qemu.qmp.error import QMPError

from libqmpbackup.qmpcommon import QmpCommon
Expand Down Expand Up @@ -48,9 +48,13 @@ async def stop_jobs(blockdev, log, qmp, signal):
for job in jobs:
for dev in blockdev:
if job["device"] == dev.node and job["type"] == "backup":
await qmp.execute(
"block-job-cancel", arguments={"device": dev.node, "force": True}
)
try:
await qmp.execute(
"block-job-cancel",
arguments={"device": dev.node, "force": True},
)
except qmp_client.ExecuteError as err:
log.info(err)


async def main():
Expand Down

0 comments on commit 10d38ab

Please sign in to comment.