From nobody Thu May 2 11:00:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625007540773848.4472936746337; Tue, 29 Jun 2021 15:59:00 -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-227-MF8Yhe4dNJqnIaE9N_mU2A-1; Tue, 29 Jun 2021 18:58:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8F5E804143; Tue, 29 Jun 2021 22:58:51 +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 730BA5DA61; Tue, 29 Jun 2021 22:58:51 +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 284281809C97; Tue, 29 Jun 2021 22:58:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwjUI004431 for ; Tue, 29 Jun 2021 18:58:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96EB820341B9; Tue, 29 Jun 2021 22:58:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92AE5204402A for ; Tue, 29 Jun 2021 22:58:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 7DCA5858287 for ; Tue, 29 Jun 2021 22:58:45 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-QZBLjt6OPUuV4c8-gCvb6A-2; Tue, 29 Jun 2021 18:58:42 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:42 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:42 -0700 X-MC-Unique: MF8Yhe4dNJqnIaE9N_mU2A-1 X-MC-Unique: QZBLjt6OPUuV4c8-gCvb6A-2 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293891993" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293891993" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883933" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 01/10] ch_monitor: Make unused function static Date: Tue, 29 Jun 2021 16:05:44 -0700 Message-Id: <20210629230553.66273-2-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.4 X-loop: libvir-list@redhat.com Cc: 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.79 on 10.5.11.14 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 Content-Type: text/plain; charset="utf-8" The virCHMonitorGet function wasn't in use and was declared as non-static (though not in a header file). This function isn't going to be used outside of the monitor though so remove the initial declaration and define the function to be static. Future work should adjust this function to allow reading VM state needed for PTY enablement. Signed-off-by: William Douglas --- src/ch/ch_monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 1648d05017..f76bc2b423 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -54,7 +54,6 @@ VIR_ONCE_GLOBAL_INIT(virCHMonitor); =20 int virCHMonitorShutdownVMM(virCHMonitor *mon); int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint); -int virCHMonitorGet(virCHMonitor *mon, const char *endpoint); =20 static int virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef) @@ -613,7 +612,7 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char = *endpoint) return ret; } =20 -int +static int virCHMonitorGet(virCHMonitor *mon, const char *endpoint) { g_autofree char *url =3D NULL; --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625007555006708.3448450133063; Tue, 29 Jun 2021 15:59:15 -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-569-HtpdAe_JP_y8FZ7qeKGf-Q-1; Tue, 29 Jun 2021 18:59:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D40DD1084F53; Tue, 29 Jun 2021 22:59:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B717718AAB; Tue, 29 Jun 2021 22:59:06 +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 86ADD4EA38; Tue, 29 Jun 2021 22:59:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwle8004440 for ; Tue, 29 Jun 2021 18:58:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id E57952044024; Tue, 29 Jun 2021 22:58:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E0A2120341B9 for ; Tue, 29 Jun 2021 22:58:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 C7F4818812C2 for ; Tue, 29 Jun 2021 22:58:46 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-dGFJNfsANCSxL_H31l8coQ-3; Tue, 29 Jun 2021 18:58:44 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:43 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:43 -0700 X-MC-Unique: HtpdAe_JP_y8FZ7qeKGf-Q-1 X-MC-Unique: dGFJNfsANCSxL_H31l8coQ-3 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293891994" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293891994" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883936" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 02/10] ch_monitor: Update virCHMonitorGet to handle accept a response Date: Tue, 29 Jun 2021 16:05:45 -0700 Message-Id: <20210629230553.66273-3-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.4 X-loop: libvir-list@redhat.com Cc: 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.79 on 10.5.11.11 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 Content-Type: text/plain; charset="utf-8" The virCHMonitorGet function needed to be able to return data from the hypervisor. This functionality is needed in order for the driver to support PTY enablement and getting details about the VM state. Signed-off-by: William Douglas --- src/ch/ch_monitor.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index f76bc2b423..93a5f8fdb4 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -612,12 +612,33 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const cha= r *endpoint) return ret; } =20 +struct curl_data { + char *content; + size_t size; +}; + +static size_t +curl_callback(void *contents, size_t size, size_t nmemb, void *userp) +{ + size_t content_size =3D size * nmemb; + struct curl_data *data =3D (struct curl_data *)userp; + + data->content =3D g_malloc0(content_size + 1); + memcpy(data->content, contents, content_size); + data->content[content_size] =3D 0; + data->size =3D content_size; + + return content_size; +} + static int -virCHMonitorGet(virCHMonitor *mon, const char *endpoint) +virCHMonitorGet(virCHMonitor *mon, const char *endpoint, virJSONValue **re= sponse) { g_autofree char *url =3D NULL; int responseCode =3D 0; int ret =3D -1; + struct curl_slist *headers =3D NULL; + struct curl_data data; =20 url =3D g_strdup_printf("%s/%s", URL_ROOT, endpoint); =20 @@ -629,12 +650,24 @@ virCHMonitorGet(virCHMonitor *mon, const char *endpoi= nt) curl_easy_setopt(mon->handle, CURLOPT_UNIX_SOCKET_PATH, mon->socketpat= h); curl_easy_setopt(mon->handle, CURLOPT_URL, url); =20 + if (response) { + headers =3D curl_slist_append(headers, "Accept: application/json"); + headers =3D curl_slist_append(headers, "Content-Type: application/= json"); + curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(mon->handle, CURLOPT_WRITEFUNCTION, curl_callback= ); + curl_easy_setopt(mon->handle, CURLOPT_WRITEDATA, (void *)&data); + } + responseCode =3D virCHMonitorCurlPerform(mon->handle); =20 virObjectUnlock(mon); =20 - if (responseCode =3D=3D 200 || responseCode =3D=3D 204) + if (responseCode =3D=3D 200 || responseCode =3D=3D 204) { ret =3D 0; + if (response) { + *response =3D virJSONValueFromString(data.content); + } + } =20 return ret; } --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625007557999341.1525206621611; Tue, 29 Jun 2021 15:59:17 -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-337-gamLEbzlMNCfNdvw0YMoNQ-1; Tue, 29 Jun 2021 18:59:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AF915074C; Tue, 29 Jun 2021 22:59:09 +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 3E8F95DAA5; Tue, 29 Jun 2021 22:59:09 +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 0772F1806D0D; Tue, 29 Jun 2021 22:59:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwo09004458 for ; Tue, 29 Jun 2021 18:58:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id A288ADAF2A; Tue, 29 Jun 2021 22:58:50 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 584AFDEE77 for ; Tue, 29 Jun 2021 22:58:47 +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 E2874108C0A1 for ; Tue, 29 Jun 2021 22:58:46 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-O5sYcn6sNSOYf1lERbg2Cg-1; Tue, 29 Jun 2021 18:58:44 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:43 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:43 -0700 X-MC-Unique: gamLEbzlMNCfNdvw0YMoNQ-1 X-MC-Unique: O5sYcn6sNSOYf1lERbg2Cg-1 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293891996" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293891996" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883940" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 03/10] ch_monitor: Use virCHMonitorGet to access cloud-hypervisor API Date: Tue, 29 Jun 2021 16:05:46 -0700 Message-Id: <20210629230553.66273-4-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: 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.79 on 10.5.11.14 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 Content-Type: text/plain; charset="utf-8" Now that virCHMonitorGet is capable of handling data returned by the cloud-hypervisor API, make use of this via virCHMonitorGetInfo to call into the vm.info endpoint. Signed-off-by: William Douglas --- src/ch/ch_monitor.c | 15 +++++++++++++++ src/ch/ch_monitor.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 93a5f8fdb4..5e7d6e3189 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -745,3 +745,18 @@ virCHMonitorResumeVM(virCHMonitor *mon) { return virCHMonitorPutNoContent(mon, URL_VM_RESUME); } + +/** + * virCHMonitorGetInfo: + * @mon: Pointer to the monitor + * @info: Get VM info + * + * Retrive the VM info and store in @info + * + * Returns 0 on success. + */ +int +virCHMonitorGetInfo(virCHMonitor *mon, virJSONValue **info) +{ + return virCHMonitorGet(mon, URL_VM_INFO, info); +} diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index e717e11cbc..e39b4eb8b2 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -23,6 +23,7 @@ #include =20 #include "virobject.h" +#include "virjson.h" #include "domain_conf.h" =20 #define URL_ROOT "http://localhost/api/v1" @@ -34,6 +35,7 @@ #define URL_VM_REBOOT "vm.reboot" #define URL_VM_Suspend "vm.pause" #define URL_VM_RESUME "vm.resume" +#define URL_VM_INFO "vm.info" =20 typedef struct _virCHMonitor virCHMonitor; =20 @@ -58,3 +60,4 @@ int virCHMonitorShutdownVM(virCHMonitor *mon); int virCHMonitorRebootVM(virCHMonitor *mon); int virCHMonitorSuspendVM(virCHMonitor *mon); int virCHMonitorResumeVM(virCHMonitor *mon); +int virCHMonitorGetInfo(virCHMonitor *mon, virJSONValue **info); --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625007565303214.67904366599635; Tue, 29 Jun 2021 15:59:25 -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-557-wd5En7-BMdK9X8xDk5eohQ-1; Tue, 29 Jun 2021 18:59:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51AE880414C; Tue, 29 Jun 2021 22:59:16 +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 0F8FF5DA61; Tue, 29 Jun 2021 22:59:16 +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 CC0BA1800FDB; Tue, 29 Jun 2021 22:59:15 +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 15TMwq0w004476 for ; Tue, 29 Jun 2021 18:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0746711558BE; Tue, 29 Jun 2021 22:58:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3E5C10130E5 for ; Tue, 29 Jun 2021 22:58:48 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 C869D800B36 for ; Tue, 29 Jun 2021 22:58:47 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-nJpM2E3nPjG6OCpwpQEfNA-4; Tue, 29 Jun 2021 18:58:45 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:44 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:44 -0700 X-MC-Unique: wd5En7-BMdK9X8xDk5eohQ-1 X-MC-Unique: nJpM2E3nPjG6OCpwpQEfNA-4 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293891998" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293891998" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883943" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 04/10] ch_monitor: Add pty json builder function Date: Tue, 29 Jun 2021 16:05:47 -0700 Message-Id: <20210629230553.66273-5-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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: 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.79 on 10.5.11.14 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 Content-Type: text/plain; charset="utf-8" Add function to build the the json structure to configure a PTY in cloud-hypervisor. The configuration only supports a single serial or console device. Signed-off-by: William Douglas --- src/ch/ch_monitor.c | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 5e7d6e3189..d4289b75ce 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -89,6 +89,65 @@ virCHMonitorBuildCPUJson(virJSONValue *content, virDomai= nDef *vmdef) return -1; } =20 +static int +virCHMonitorBuildPTYJson(virJSONValue *content, virDomainDef *vmdef) +{ + virJSONValue *ptyc =3D virJSONValueNewObject(); + virJSONValue *ptys =3D virJSONValueNewObject(); + + if (vmdef->nconsoles || vmdef->nserials) { + if ((vmdef->nconsoles && + vmdef->consoles[0]->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_P= TY) + && (vmdef->nserials && + vmdef->serials[0]->source->type =3D=3D VIR_DOMAIN_CHR_TYPE= _PTY)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only a single console or serial can be confi= gured for this domain")); + goto cleanup; + } else if (vmdef->nconsoles > 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only a single console can be configured for = this domain")); + goto cleanup; + } else if (vmdef->nserials > 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only a single serial can be configured for t= his domain")); + goto cleanup; + } + } + + if (vmdef->nconsoles) { + if (vmdef->consoles[0]->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_PT= Y) { + if (virJSONValueObjectAppendString(ptyc, "mode", "Pty") < 0) + goto cleanup; + if (virJSONValueObjectAppend(content, "console", &ptyc) < 0) + goto cleanup; + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Console can only be enabled for a PTY")); + goto cleanup; + } + } + + if (vmdef->nserials) { + if (vmdef->serials[0]->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_PTY= ) { + if (virJSONValueObjectAppendString(ptys, "mode", "Pty") < 0) + goto cleanup; + if (virJSONValueObjectAppend(content, "serial", &ptys) < 0) + goto cleanup; + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Serial can only be enabled for a PTY")); + goto cleanup; + } + } + + return 0; + + cleanup: + virJSONValueFree(ptyc); + virJSONValueFree(ptys); + return -1; +} + static int virCHMonitorBuildKernelRelatedJson(virJSONValue *content, virDomainDef *vm= def) { --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625007605529592.0268696212803; Tue, 29 Jun 2021 16:00:05 -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-564-6gynwRo2MfyTD2CFEB1sVA-1; Tue, 29 Jun 2021 18:59:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 932EE1084F5B; Tue, 29 Jun 2021 22:59:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 74F7C6091B; Tue, 29 Jun 2021 22:59:09 +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 18BE84EA3C; Tue, 29 Jun 2021 22:59:09 +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 15TMwq7d004477 for ; Tue, 29 Jun 2021 18:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0A7461012C5E; Tue, 29 Jun 2021 22:58:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03A1011558BB for ; Tue, 29 Jun 2021 22:58:48 +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 3D91E185A79C for ; Tue, 29 Jun 2021 22:58:48 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-SWrHnBwnOHqcStkypN1bkg-2; Tue, 29 Jun 2021 18:58:45 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:45 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:45 -0700 X-MC-Unique: 6gynwRo2MfyTD2CFEB1sVA-1 X-MC-Unique: SWrHnBwnOHqcStkypN1bkg-2 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293892000" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293892000" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883949" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 05/10] ch_monitor: Make use of the PTY json builder Date: Tue, 29 Jun 2021 16:05:48 -0700 Message-Id: <20210629230553.66273-6-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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: 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.79 on 10.5.11.13 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 Content-Type: text/plain; charset="utf-8" Call into the PTY json builder for configured serial and console devices though the devices themselves still aren't allowed in configuration. Signed-off-by: William Douglas --- src/ch/ch_monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index d4289b75ce..2ade6967fb 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -429,6 +429,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 From nobody Thu May 2 11:00:27 2024 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 1625007558112799.2089404869108; Tue, 29 Jun 2021 15:59:18 -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-578-ZFhwrzvyMIWuRDLjHZxZFA-1; Tue, 29 Jun 2021 18:59:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C19A8100B3B9; Tue, 29 Jun 2021 22:59:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A16605DA61; Tue, 29 Jun 2021 22:59:09 +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 419334EA3B; Tue, 29 Jun 2021 22:59:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwquw004473 for ; Tue, 29 Jun 2021 18:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id E300F21EE574; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAA0021EE56D for ; Tue, 29 Jun 2021 22:58:49 +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 F2124108C0A2 for ; Tue, 29 Jun 2021 22:58:48 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-Ho3zHaMEPW6PY1BR4rTOHg-1; Tue, 29 Jun 2021 18:58:46 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:46 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:46 -0700 X-MC-Unique: ZFhwrzvyMIWuRDLjHZxZFA-1 X-MC-Unique: Ho3zHaMEPW6PY1BR4rTOHg-1 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293892002" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293892002" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883955" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 06/10] ch_process: Handle enabled console devices Date: Tue, 29 Jun 2021 16:05:49 -0700 Message-Id: <20210629230553.66273-7-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.6 X-loop: libvir-list@redhat.com Cc: 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.79 on 10.5.11.14 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 Content-Type: text/plain; charset="utf-8" Add functionality to allow libvirt console to connect to the cloud-hypervisor created PTY associated with a VM. This will need to be run once the VM is created by cloud-hypervisor. Signed-off-by: William Douglas --- src/ch/ch_process.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 93b1f7f97e..90344f14ea 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -28,6 +28,7 @@ #include "ch_process.h" #include "viralloc.h" #include "virerror.h" +#include "virjson.h" #include "virlog.h" =20 #define VIR_FROM_THIS VIR_FROM_CH @@ -52,6 +53,69 @@ virCHProcessConnectMonitor(virCHDriver *driver, return monitor; } =20 +static void +virCHProcessUpdateConsoleDevice(virDomainObj *vm, + virJSONValue *config, + const char *device) +{ + const char *path; + virDomainChrDef *chr =3D NULL; + virJSONValue *dev, *file; + + if (!config) + return; + + dev =3D virJSONValueObjectGet(config, device); + if (!dev) + return; + + file =3D virJSONValueObjectGet(dev, "file"); + if (!file) + return; + + path =3D virJSONValueGetString(file); + if (!path) + return; + + if (STREQ(device, "console")) { + chr =3D vm->def->consoles[0]; + } else if (STREQ(device, "serial")) { + chr =3D vm->def->serials[0]; + } + + if (chr && chr->source) + chr->source->data.file.path =3D g_strdup(path); +} + +static void +virCHProcessUpdateConsole(virDomainObj *vm, + virJSONValue *info) +{ + virJSONValue *config; + + config =3D virJSONValueObjectGet(info, "config"); + if (!config) + return; + + virCHProcessUpdateConsoleDevice(vm, config, "console"); + virCHProcessUpdateConsoleDevice(vm, config, "serial"); +} + +static int +virCHProcessUpdateInfo(virDomainObj *vm) +{ + virJSONValue *info; + virCHDomainObjPrivate *priv =3D vm->privateData; + if (virCHMonitorGetInfo(priv->monitor, &info) < 0) + return -1; + + virCHProcessUpdateConsole(vm, info); + + virJSONValueFree(info); + + return 0; +} + /** * virCHProcessStart: * @driver: pointer to driver structure --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 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 1625007603800455.812231818266; Tue, 29 Jun 2021 16:00:03 -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-569-xEgmlxIgNmeZXRySpxCIuQ-1; Tue, 29 Jun 2021 18:59:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDDBC18414A3; Tue, 29 Jun 2021 22:59:06 +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 C13E16091B; Tue, 29 Jun 2021 22:59:06 +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 8F9761809CB6; Tue, 29 Jun 2021 22:59:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwqR8004471 for ; Tue, 29 Jun 2021 18:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id E3DCA21EE575; Tue, 29 Jun 2021 22:58:51 +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 DBC4B21EE56E for ; Tue, 29 Jun 2021 22:58:50 +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 16AB3805A30 for ; Tue, 29 Jun 2021 22:58:50 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-f3-OsGTAMcGTw-Jxc7cX5A-2; Tue, 29 Jun 2021 18:58:47 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:46 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:46 -0700 X-MC-Unique: xEgmlxIgNmeZXRySpxCIuQ-1 X-MC-Unique: f3-OsGTAMcGTw-Jxc7cX5A-2 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293892005" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293892005" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883960" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 07/10] ch_process: Update the domain with console path information Date: Tue, 29 Jun 2021 16:05:50 -0700 Message-Id: <20210629230553.66273-8-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.6 X-loop: libvir-list@redhat.com Cc: 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.79 on 10.5.11.13 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 Content-Type: text/plain; charset="utf-8" Add call to update the domain with console path information from cloud-hypervisor as part of the last stages of initializing the domain. Signed-off-by: William Douglas --- src/ch/ch_process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 90344f14ea..f6ae1677fd 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -156,6 +156,9 @@ int virCHProcessStart(virCHDriver *driver, =20 vm->pid =3D priv->monitor->pid; vm->def->id =3D vm->pid; + + virCHProcessUpdateInfo(vm); + virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason); =20 return 0; --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 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 1625007543213732.3609431553779; Tue, 29 Jun 2021 15:59:03 -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-138-o0tTWqISM0e84LZeoFy7Sg-1; Tue, 29 Jun 2021 18:59:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29A905074B; Tue, 29 Jun 2021 22:58:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F346A1A26A; Tue, 29 Jun 2021 22:58:52 +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 930324E9F5; Tue, 29 Jun 2021 22:58:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwpJp004463 for ; Tue, 29 Jun 2021 18:58:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 132CB204403E; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0ECAA2044024 for ; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 E9AE88556F2 for ; Tue, 29 Jun 2021 22:58:50 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-404-O15e7HtiNQGZYcwiMDTxzg-1; Tue, 29 Jun 2021 18:58:47 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:47 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:47 -0700 X-MC-Unique: o0tTWqISM0e84LZeoFy7Sg-1 X-MC-Unique: O15e7HtiNQGZYcwiMDTxzg-1 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293892008" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293892008" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883966" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 08/10] ch_domain: Allow controller and chr devices Date: Tue, 29 Jun 2021 16:05:51 -0700 Message-Id: <20210629230553.66273-9-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.4 X-loop: libvir-list@redhat.com Cc: 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.23 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 Content-Type: text/plain; charset="utf-8" With the console and serial device handling fully functional, allow the required device types to be specified in the domain configuration. Signed-off-by: William Douglas --- src/ch/ch_domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c index a6b87e28e5..89a8ad8f45 100644 --- a/src/ch/ch_domain.c +++ b/src/ch/ch_domain.c @@ -215,6 +215,8 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev, case VIR_DOMAIN_DEVICE_NET: case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_VSOCK: + case VIR_DOMAIN_DEVICE_CONTROLLER: + case VIR_DOMAIN_DEVICE_CHR: break; =20 case VIR_DOMAIN_DEVICE_LEASE: @@ -224,12 +226,10 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *d= ev, case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_HOSTDEV: case VIR_DOMAIN_DEVICE_WATCHDOG: - case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_GRAPHICS: case VIR_DOMAIN_DEVICE_HUB: case VIR_DOMAIN_DEVICE_REDIRDEV: case VIR_DOMAIN_DEVICE_SMARTCARD: - case VIR_DOMAIN_DEVICE_CHR: case VIR_DOMAIN_DEVICE_MEMBALLOON: case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_RNG: --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 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 1625007562278918.6963581039149; Tue, 29 Jun 2021 15:59:22 -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-156-cZYjapOnN8a23ZgAxYYKjQ-1; Tue, 29 Jun 2021 18:59:19 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20C06100B3B7; Tue, 29 Jun 2021 22:59:12 +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 035C32C016; Tue, 29 Jun 2021 22:59:12 +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 C089F1801254; Tue, 29 Jun 2021 22:59:11 +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 15TMwq8w004478 for ; Tue, 29 Jun 2021 18:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D1231011013; Tue, 29 Jun 2021 22:58:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 085C010EB291 for ; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 5F29A801212 for ; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-yK5g39WMMpm8Wrgyu0MVxA-3; Tue, 29 Jun 2021 18:58:48 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:48 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:47 -0700 X-MC-Unique: cZYjapOnN8a23ZgAxYYKjQ-1 X-MC-Unique: yK5g39WMMpm8Wrgyu0MVxA-3 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293892009" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293892009" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883971" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 09/10] ch_driver: Add handler for console API Date: Tue, 29 Jun 2021 16:05:52 -0700 Message-Id: <20210629230553.66273-10-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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: 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.79 on 10.5.11.11 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 Content-Type: text/plain; charset="utf-8" Add the handler function to find and open the console character device that will be used by the console API. Signed-off-by: William Douglas --- src/ch/ch_driver.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index ac958d73a8..b0b8e19120 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -30,6 +30,7 @@ #include "viraccessapicheck.h" #include "viralloc.h" #include "virbuffer.h" +#include "virchrdev.h" #include "vircommand.h" #include "virerror.h" #include "virfile.h" @@ -816,6 +817,82 @@ static int chDomainGetInfo(virDomainPtr dom, return ret; } =20 +static int +chDomainOpenConsole(virDomainPtr dom, + const char *dev_name, + virStreamPtr st, + unsigned int flags) +{ + virDomainObj *vm =3D NULL; + int ret =3D -1; + size_t i; + virDomainChrDef *chr =3D NULL; + virCHDomainObjPrivate *priv; + + virCheckFlags(VIR_DOMAIN_CONSOLE_SAFE | VIR_DOMAIN_CONSOLE_FORCE, -1); + + if (!(vm =3D chDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + priv =3D vm->privateData; + + if (dev_name) { + for (i =3D 0; !chr && i < vm->def->nconsoles; i++) { + if (vm->def->consoles[i]->info.alias && + STREQ(dev_name, vm->def->consoles[i]->info.alias)) + chr =3D vm->def->consoles[i]; + } + for (i =3D 0; !chr && i < vm->def->nserials; i++) { + if (STREQ(dev_name, vm->def->serials[i]->info.alias)) + chr =3D vm->def->serials[i]; + } + for (i =3D 0; !chr && i < vm->def->nparallels; i++) { + if (STREQ(dev_name, vm->def->parallels[i]->info.alias)) + chr =3D vm->def->parallels[i]; + } + } else { + if (vm->def->nconsoles && + vm->def->consoles[0]->source->type =3D=3D VIR_DOMAIN_CHR_TYP= E_PTY) + chr =3D vm->def->consoles[0]; + else if (vm->def->nserials && + vm->def->serials[0]->source->type =3D=3D VIR_DOMAIN_CHR= _TYPE_PTY) + chr =3D vm->def->serials[0]; + } + + if (!chr) { + virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find character = device %s"), + NULLSTR(dev_name)); + goto cleanup; + } + + if (chr->source->type !=3D VIR_DOMAIN_CHR_TYPE_PTY) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("character device %s is not using a PTY"), + dev_name ? dev_name : NULLSTR(chr->info.alias)); + goto cleanup; + } + + /* handle mutually exclusive access to console devices */ + ret =3D virChrdevOpen(priv->chrdevs, chr->source, st, + (flags & VIR_DOMAIN_CONSOLE_FORCE) !=3D 0); + + if (ret =3D=3D 1) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Active console session exists for this domain"= )); + ret =3D -1; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int chStateCleanup(void) { if (ch_driver =3D=3D NULL) --=20 2.31.1 From nobody Thu May 2 11:00:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625007563022988.7962041796004; Tue, 29 Jun 2021 15:59:23 -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-227-OPfIJpPqPZGu18Kk9nWGDQ-1; Tue, 29 Jun 2021 18:59:20 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A45B18414AD; Tue, 29 Jun 2021 22:59:13 +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 3A4D460C17; Tue, 29 Jun 2021 22:59:13 +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 E25091801258; Tue, 29 Jun 2021 22:59:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15TMwqQo004472 for ; Tue, 29 Jun 2021 18:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id E620D21EE569; Tue, 29 Jun 2021 22:58:51 +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 DE6C521EE56F for ; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 6A41980B91C for ; Tue, 29 Jun 2021 22:58:51 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-585-ksB88UrXMVqjHK8F8ZVptA-1; Tue, 29 Jun 2021 18:58:49 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:48 -0700 Received: from wdouglas-dev.jf.intel.com (HELO desk.jf.intel.com) ([10.7.200.157]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 15:58:48 -0700 X-MC-Unique: OPfIJpPqPZGu18Kk9nWGDQ-1 X-MC-Unique: ksB88UrXMVqjHK8F8ZVptA-1 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="293892011" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="293892011" X-IronPort-AV: E=Sophos;i="5.83,310,1616482800"; d="scan'208";a="643883975" From: William Douglas To: libvir-list@redhat.com Subject: [PATCH 10/10] ch_driver: Turn on the domainOpenConsole API Date: Tue, 29 Jun 2021 16:05:53 -0700 Message-Id: <20210629230553.66273-11-william.douglas@intel.com> In-Reply-To: <20210629230553.66273-1-william.douglas@intel.com> References: <20210629230553.66273-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.6 X-loop: libvir-list@redhat.com Cc: 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.79 on 10.5.11.12 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 Content-Type: text/plain; charset="utf-8" With all the rest of the enablement work out of the way, add the final call for the cloud-hypervisor driver to handle domainOpenConsole. Signed-off-by: William Douglas --- src/ch/ch_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index b0b8e19120..a11357f83a 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -990,6 +990,7 @@ static virHypervisorDriver chHypervisorDriver =3D { .domainGetXMLDesc =3D chDomainGetXMLDesc, /* 7.5.0 */ .domainGetInfo =3D chDomainGetInfo, /* 7.5.0 */ .domainIsActive =3D chDomainIsActive, /* 7.5.0 */ + .domainOpenConsole =3D chDomainOpenConsole, /* 7.6.0 */ .nodeGetInfo =3D chNodeGetInfo, /* 7.5.0 */ }; =20 --=20 2.31.1