qemuBlockReopenFormatMon: Adapt to new argument format of 'blockdev-reopen'

This function was added prior 'blockdev-reopen' being stable and qemu
changed the arguments to actually contain an array of block node
definitions to reopen.

In our case we are just changing between read-only and read-write modes
and thus we can keep operating on the nodes one-by-one.

Modify the code to add the wrapper array.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2021-02-22 17:55:12 +01:00
parent 6f5980ee39
commit c1d17ca64b

View File

@ -3291,8 +3291,18 @@ qemuBlockReopenFormatMon(qemuMonitor *mon,
virStorageSource *src)
{
g_autoptr(virJSONValue) reopenprops = NULL;
g_autoptr(virJSONValue) srcprops = NULL;
g_autoptr(virJSONValue) reopenoptions = virJSONValueNewArray();
if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
if (!(srcprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
return -1;
if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
return -1;
if (virJSONValueObjectCreate(&reopenprops,
"a:options", &reopenoptions,
NULL) < 0)
return -1;
if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)