qemu_monitor_json: allow configuring autofinalize for block commit

Deleting external snapshots will require configuring autofinalize to
synchronize the block jobs for disks withing single snapshot in order to
be able safely abort of one of the jobs fails.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Pavel Hrdina 2022-12-13 16:40:02 +01:00
parent 07b54c3d5a
commit b308dc4b77
6 changed files with 14 additions and 10 deletions

View File

@ -3364,7 +3364,8 @@ qemuBlockCommit(virDomainObj *vm,
job->name,
topSource->nodeformat,
baseSource->nodeformat,
backingPath, bandwidth);
backingPath, bandwidth,
VIR_TRISTATE_BOOL_YES);
qemuDomainObjExitMonitor(vm);

View File

@ -2795,16 +2795,17 @@ qemuMonitorBlockCommit(qemuMonitor *mon,
const char *topNode,
const char *baseNode,
const char *backingName,
unsigned long long bandwidth)
unsigned long long bandwidth,
virTristateBool autofinalize)
{
VIR_DEBUG("device=%s, jobname=%s, topNode=%s, baseNode=%s, backingName=%s, bandwidth=%llu",
VIR_DEBUG("device=%s, jobname=%s, topNode=%s, baseNode=%s, backingName=%s, bandwidth=%llu, autofinalize=%d",
device, NULLSTR(jobname), NULLSTR(topNode),
NULLSTR(baseNode), NULLSTR(backingName), bandwidth);
NULLSTR(baseNode), NULLSTR(backingName), bandwidth, autofinalize);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONBlockCommit(mon, device, jobname, topNode, baseNode,
backingName, bandwidth);
backingName, bandwidth, autofinalize);
}

View File

@ -973,7 +973,8 @@ int qemuMonitorBlockCommit(qemuMonitor *mon,
const char *topNode,
const char *baseNode,
const char *backingName,
unsigned long long bandwidth)
unsigned long long bandwidth,
virTristateBool autofinalize)
ATTRIBUTE_NONNULL(2);
int qemuMonitorArbitraryCommand(qemuMonitor *mon,

View File

@ -4028,11 +4028,11 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
const char *topNode,
const char *baseNode,
const char *backingName,
unsigned long long speed)
unsigned long long speed,
virTristateBool autofinalize)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virTristateBool autofinalize = VIR_TRISTATE_BOOL_YES;
virTristateBool autodismiss = VIR_TRISTATE_BOOL_NO;
cmd = qemuMonitorJSONMakeCommand("block-commit",

View File

@ -315,7 +315,8 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
const char *topNode,
const char *baseNode,
const char *backingName,
unsigned long long bandwidth)
unsigned long long bandwidth,
virTristateBool autofinalize)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int

View File

@ -1211,7 +1211,7 @@ GEN_TEST_FUNC(qemuMonitorJSONRemoveNetdev, "net0")
GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0")
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targetnode", 1024, 1234, 31234, true, true)
GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "jobname", "backingnode", "backingfilename", 1024)
GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "basenode", "backingfilename", 1024)
GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "basenode", "backingfilename", 1024, VIR_TRISTATE_BOOL_YES)
GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, NULL, "/foo/bar")
GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false)
GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", "export", true, "bitmap")