mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemuMonitorJSONAttachCharDevCommand: Format only the properties
Move the addition of the command wrapper to qemuMonitorJSONAttachCharDev and rename the function to qemuMonitorJSONAttachCharDevGetProps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
ab85f52c38
commit
d3af4392f7
@ -6609,9 +6609,10 @@ qemuMonitorJSONBuildChrChardevReconnect(virJSONValue *object,
|
||||
}
|
||||
|
||||
static virJSONValue *
|
||||
qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
||||
const virDomainChrSourceDef *chr)
|
||||
qemuMonitorJSONAttachCharDevGetProps(const char *chrID,
|
||||
const virDomainChrSourceDef *chr)
|
||||
{
|
||||
g_autoptr(virJSONValue) props = NULL;
|
||||
g_autoptr(virJSONValue) backend = virJSONValueNewObject();
|
||||
g_autoptr(virJSONValue) data = virJSONValueNewObject();
|
||||
g_autoptr(virJSONValue) addr = NULL;
|
||||
@ -6760,10 +6761,13 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
||||
virJSONValueObjectAppend(backend, "data", &data) < 0)
|
||||
return NULL;
|
||||
|
||||
return qemuMonitorJSONMakeCommand("chardev-add",
|
||||
"s:id", chrID,
|
||||
"a:backend", &backend,
|
||||
NULL);
|
||||
if (virJSONValueObjectAdd(&props,
|
||||
"s:id", chrID,
|
||||
"a:backend", &backend,
|
||||
NULL) < 0)
|
||||
return NULL;
|
||||
|
||||
return g_steal_pointer(&props);
|
||||
}
|
||||
|
||||
|
||||
@ -6774,8 +6778,12 @@ qemuMonitorJSONAttachCharDev(qemuMonitor *mon,
|
||||
{
|
||||
g_autoptr(virJSONValue) cmd = NULL;
|
||||
g_autoptr(virJSONValue) reply = NULL;
|
||||
g_autoptr(virJSONValue) props = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONAttachCharDevCommand(chrID, chr)))
|
||||
if (!(props = qemuMonitorJSONAttachCharDevGetProps(chrID, chr)))
|
||||
return -1;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommandInternal("chardev-add", &props)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user