qemu: monitor: Add handler for blockdev-reopen

Introduce the monitor code for using blockdev-reopen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-02-13 09:00:37 +01:00
parent ecdd929761
commit 9f436e067d
4 changed files with 41 additions and 0 deletions

View File

@ -4353,6 +4353,19 @@ qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
}
int
qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
virJSONValuePtr *props)
{
VIR_DEBUG("props=%p (node-name=%s)", *props,
NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONBlockdevReopen(mon, props);
}
int
qemuMonitorBlockdevDel(qemuMonitorPtr mon,
const char *nodename)

View File

@ -1322,6 +1322,9 @@ int qemuMonitorBlockdevCreate(qemuMonitorPtr mon,
int qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
virJSONValuePtr *props);
int qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
virJSONValuePtr *props);
int qemuMonitorBlockdevDel(qemuMonitorPtr mon,
const char *nodename);

View File

@ -8815,6 +8815,27 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
}
int
qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
virJSONValuePtr *props)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr pr = g_steal_pointer(props);
if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
return -1;
return 0;
}
int
qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
const char *nodename)

View File

@ -602,6 +602,10 @@ int qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
virJSONValuePtr *props)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
virJSONValuePtr *props)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
const char *nodename)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);