mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
ch_monitor: Add pty json builder function
Add function to build the the json structure to configure a PTY in cloud-hypervisor. The devices themselves still aren't allowed in configurations yet though. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: William Douglas <william.douglas@intel.com>
This commit is contained in:
parent
3b164e6897
commit
93accefd9e
@ -89,6 +89,30 @@ virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
virCHMonitorBuildPTYJson(virJSONValue *content, virDomainDef *vmdef)
|
||||
{
|
||||
virJSONValue *ptys = virJSONValueNewObject();
|
||||
|
||||
if (vmdef->nconsoles) {
|
||||
g_autoptr(virJSONValue) pty = virJSONValueNewObject();
|
||||
if (virJSONValueObjectAppendString(pty, "mode", "Pty") < 0)
|
||||
return -1;
|
||||
if (virJSONValueObjectAppend(content, "console", &pty) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vmdef->nserials) {
|
||||
g_autoptr(virJSONValue) pty = virJSONValueNewObject();
|
||||
if (virJSONValueObjectAppendString(ptys, "mode", "Pty") < 0)
|
||||
return -1;
|
||||
if (virJSONValueObjectAppend(content, "serial", &pty) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
virCHMonitorBuildKernelRelatedJson(virJSONValue *content, virDomainDef *vmdef)
|
||||
{
|
||||
@ -370,6 +394,9 @@ virCHMonitorBuildVMJson(virDomainDef *vmdef, char **jsonstr)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCHMonitorBuildPTYJson(content, vmdef) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virCHMonitorBuildCPUJson(content, vmdef) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user