1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-10 05:17:59 +03:00

qemu: monitor: Add 'force' argument for 'block-job-cancel' QMP command

In certain cases such as when aborting migration we don't really care
for completion of the blockjob. Add 'force' as parameter of
'block-job-cancel'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-04-20 14:14:51 +02:00
parent 2587f825de
commit 2716d53ee6
7 changed files with 14 additions and 9 deletions

View File

@ -14510,7 +14510,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
if (blockdev)
ret = qemuMonitorJobCancel(priv->mon, job->name, false);
else
ret = qemuMonitorBlockJobCancel(priv->mon, job->name);
ret = qemuMonitorBlockJobCancel(priv->mon, job->name, false);
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
ret = -1;
goto endjob;

View File

@ -748,7 +748,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
rv = qemuMonitorBlockJobCancel(priv->mon, job->name);
rv = qemuMonitorBlockJobCancel(priv->mon, job->name, false);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0)
return -1;

View File

@ -3403,13 +3403,14 @@ qemuMonitorBlockStream(qemuMonitor *mon,
int
qemuMonitorBlockJobCancel(qemuMonitor *mon,
const char *jobname)
const char *jobname,
bool force)
{
VIR_DEBUG("jobname=%s", jobname);
VIR_DEBUG("jobname=%s force=%d", jobname, force);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONBlockJobCancel(mon, jobname);
return qemuMonitorJSONBlockJobCancel(mon, jobname, force);
}

View File

@ -1081,7 +1081,8 @@ int qemuMonitorBlockStream(qemuMonitor *mon,
ATTRIBUTE_NONNULL(2);
int qemuMonitorBlockJobCancel(qemuMonitor *mon,
const char *jobname)
const char *jobname,
bool force)
ATTRIBUTE_NONNULL(2);
int qemuMonitorBlockJobSetSpeed(qemuMonitor *mon,

View File

@ -5217,13 +5217,15 @@ qemuMonitorJSONBlockStream(qemuMonitor *mon,
int
qemuMonitorJSONBlockJobCancel(qemuMonitor *mon,
const char *jobname)
const char *jobname,
bool force)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("block-job-cancel",
"s:device", jobname,
"B:force", force,
NULL)))
return -1;

View File

@ -325,7 +325,8 @@ int qemuMonitorJSONBlockStream(qemuMonitor *mon,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuMonitorJSONBlockJobCancel(qemuMonitor *mon,
const char *jobname)
const char *jobname,
bool force)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int

View File

@ -1218,7 +1218,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBitmapRemove, "foodev", "newnode")
GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false)
GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname")
GEN_TEST_FUNC(qemuMonitorJSONBlockJobCancel, "jobname")
GEN_TEST_FUNC(qemuMonitorJSONBlockJobCancel, "jobname", true)
static int
testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)