From nobody Sat Feb 7 08:23:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1631123666214131.23597909254693; Wed, 8 Sep 2021 10:54:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-mN5n9kWNMOq1Un5a4uhQ1w-1; Wed, 08 Sep 2021 13:54:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C6DFCC627; Wed, 8 Sep 2021 17:54:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36FB21002391; Wed, 8 Sep 2021 17:54:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7A542180142F; Wed, 8 Sep 2021 17:54:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 188HruB6020136 for ; Wed, 8 Sep 2021 13:53:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0036B1014604; Wed, 8 Sep 2021 17:53:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F00771014B0E for ; Wed, 8 Sep 2021 17:53:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D786C88647F for ; Wed, 8 Sep 2021 17:53:55 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-JaplXJh8NKOC63_A4eJbSQ-1; Wed, 08 Sep 2021 13:53:51 -0400 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2021 10:53:41 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2021 10:53:40 -0700 X-MC-Unique: mN5n9kWNMOq1Un5a4uhQ1w-1 X-MC-Unique: JaplXJh8NKOC63_A4eJbSQ-1 X-IronPort-AV: E=McAfee;i="6200,9189,10101"; a="281572027" X-IronPort-AV: E=Sophos;i="5.85,278,1624345200"; d="scan'208";a="281572027" X-IronPort-AV: E=Sophos;i="5.85,278,1624345200"; d="scan'208";a="479272665" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 5/9] ch_monitor: Add pty json builder function Date: Wed, 8 Sep 2021 11:01:19 -0700 Message-Id: <20210908180123.820369-6-william.douglas@intel.com> In-Reply-To: <20210908180123.820369-1-william.douglas@intel.com> References: <20210908180123.820369-1-william.douglas@intel.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, William Douglas X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1631123667593100001 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: William Douglas --- src/ch/ch_monitor.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 28c70c7281..a01c031064 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -89,6 +89,30 @@ virCHMonitorBuildCPUJson(virJSONValue *content, virDomai= nDef *vmdef) return -1; } =20 +static int +virCHMonitorBuildPTYJson(virJSONValue *content, virDomainDef *vmdef) +{ + virJSONValue *ptys =3D virJSONValueNewObject(); + + if (vmdef->nconsoles) { + g_autoptr(virJSONValue) pty =3D virJSONValueNewObject(); + if (virJSONValueObjectAppendString(pty, "mode", "Pty") < 0) + return -1; + if (virJSONValueObjectAppend(content, "console", &pty) < 0) + return -1; + } + + if (vmdef->nserials) { + g_autoptr(virJSONValue) pty =3D 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 *vm= def) { @@ -370,6 +394,9 @@ virCHMonitorBuildVMJson(virDomainDef *vmdef, char **jso= nstr) goto cleanup; } =20 + if (virCHMonitorBuildPTYJson(content, vmdef) < 0) + goto cleanup; + if (virCHMonitorBuildCPUJson(content, vmdef) < 0) goto cleanup; =20 --=20 2.31.1