From nobody Mon May 6 01:23:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612534743; cv=none; d=zohomail.com; s=zohoarc; b=aSPkHMpqz2ww8q2dipdHyncke8MMVoV9O339gBljE87M6ZR1IImF7FaOLQFoP/MWYzbE7iVUK4wuINi/lxnspU9CdTqkt23c3vpidYpsoyc34zelIBd6JdF7xVY0+Ps5Q5hoamxdUwi17RSer5lSLO/jjoC+RjD4yEMnc2QZ/sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612534743; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bfWFxYo0vQtwbrHQmIER6GCXwPWWntOgP3Q82fW8jQE=; b=VEIFK1e/GE+3w7fUKrZmJHUs7CFgH9n1x7AaRX4li856y59cDFPrkTM/9VO+wf+8YlIsf1w2EjxvAavB97ODWaYEdAJ7Q0EC+YiI9mgFJqGAZ8mmuXcjGaVHKL2dU6WugDufco/J4JBRTQiqIQelR8r5TTC37E7UaFMXh5M/CC0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1612534743976363.6606395488859; Fri, 5 Feb 2021 06:19:03 -0800 (PST) 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-603-YqbbTLxfN9q7DBj-L8xUOw-1; Fri, 05 Feb 2021 09:18:50 -0500 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 BC404801978; Fri, 5 Feb 2021 14:18:43 +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 3572F5D9CC; Fri, 5 Feb 2021 14:18:43 +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 C0A0A18095CB; Fri, 5 Feb 2021 14:18:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 115EIc1u011864 for ; Fri, 5 Feb 2021 09:18:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0C3DC5C290; Fri, 5 Feb 2021 14:18:38 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35CCF5C1B4; Fri, 5 Feb 2021 14:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612534743; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bfWFxYo0vQtwbrHQmIER6GCXwPWWntOgP3Q82fW8jQE=; b=CgfkpunBoWYba1kYMX7RO+4VEKAv8hxSpjT26LOrVfqVcFcsZPmTUJ0tujJIiW65ocY7IZ 8KwcT01cO+Oim7h+PVPu+EqcmVaMMMV/Y23lboArFUvxEGFS0VGHCyS/Gn7oOTo39cllZ3 t+4RsE8VBBkOHIznRqEKduPUMSS+JuM= X-MC-Unique: YqbbTLxfN9q7DBj-L8xUOw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] conf: record deprecation messages against the domain Date: Fri, 5 Feb 2021 14:18:26 +0000 Message-Id: <20210205141831.1005395-2-berrange@redhat.com> In-Reply-To: <20210205141831.1005395-1-berrange@redhat.com> References: <20210205141831.1005395-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) These messages will be stored in the live status XML. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.c | 28 +++++++++++++++++++++++++--- src/conf/domain_conf.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 07e6f39256..a873c0ada2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1788,6 +1788,15 @@ bool virDomainObjTaint(virDomainObjPtr obj, } =20 =20 +void virDomainObjDeprecation(virDomainObjPtr obj, + const char *msg) +{ + obj->deprecations =3D g_renew(char *, obj->deprecations, + obj->ndeprecations + 1); + obj->deprecations[obj->ndeprecations++] =3D g_strdup(msg); +} + + static void virDomainGraphicsAuthDefClear(virDomainGraphicsAuthDefPtr def) { @@ -21225,7 +21234,8 @@ virDomainObjParseXML(xmlDocPtr xml, int reason =3D 0; void *parseOpaque =3D NULL; g_autofree char *tmp =3D NULL; - g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *taintNodes =3D NULL; + g_autofree xmlNodePtr *depNodes =3D NULL; =20 if (!(obj =3D virDomainObjNew(xmlopt))) return NULL; @@ -21272,10 +21282,10 @@ virDomainObjParseXML(xmlDocPtr xml, } obj->pid =3D (pid_t)val; =20 - if ((n =3D virXPathNodeSet("./taint", ctxt, &nodes)) < 0) + if ((n =3D virXPathNodeSet("./taint", ctxt, &taintNodes)) < 0) goto error; for (i =3D 0; i < n; i++) { - char *str =3D virXMLPropString(nodes[i], "flag"); + char *str =3D virXMLPropString(taintNodes[i], "flag"); if (str) { int flag =3D virDomainTaintTypeFromString(str); if (flag < 0) { @@ -21289,6 +21299,13 @@ virDomainObjParseXML(xmlDocPtr xml, } } =20 + if ((n =3D virXPathNodeSet("./deprecation", ctxt, &depNodes)) < 0) + goto error; + for (i =3D 0; i < n; i++) { + g_autofree char *str =3D virXMLNodeContentString(depNodes[i]); + virDomainObjDeprecation(obj, str); + } + if (xmlopt->privateData.parse && xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0) goto error; @@ -29122,6 +29139,11 @@ virDomainObjFormat(virDomainObjPtr obj, virDomainTaintTypeToString(i)); } =20 + for (i =3D 0; i < obj->ndeprecations; i++) { + virBufferEscapeString(&buf, "%s\n", + obj->deprecations[i]); + } + if (xmlopt->privateData.format && xmlopt->privateData.format(&buf, obj) < 0) return NULL; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8b1c8643be..ea6370c03d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2801,6 +2801,8 @@ struct _virDomainObj { void (*privateDataFreeFunc)(void *); =20 int taint; + size_t ndeprecations; + char **deprecations; =20 unsigned long long original_memlock; /* Original RLIMIT_MEMLOCK, zero = if no * restore will be required later= */ @@ -3058,6 +3060,8 @@ void virDomainObjEndAPI(virDomainObjPtr *vm); =20 bool virDomainObjTaint(virDomainObjPtr obj, virDomainTaintFlags taint); +void virDomainObjDeprecation(virDomainObjPtr obj, + const char *msg); =20 void virDomainObjBroadcast(virDomainObjPtr vm); int virDomainObjWait(virDomainObjPtr vm); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0636b0d8c9..512da526fc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -547,6 +547,7 @@ virDomainObjAssignDef; virDomainObjBroadcast; virDomainObjCheckActive; virDomainObjCopyPersistentDef; +virDomainObjDeprecation; virDomainObjEndAPI; virDomainObjFormat; virDomainObjGetDefs; --=20 2.29.2 From nobody Mon May 6 01:23:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612534756; cv=none; d=zohomail.com; s=zohoarc; b=C/avPg4duhNlw5b7UVsU9c7KcHQNlNI57QawUQ5wm6FmQ/MotDmPwi/6SnOVw+HWcxIsSOIfqZ6o+StfREtRcZoGzr2Y12uAYCUx77to+t13Z8JMPxd7yfXNnuCETGZVTZDf+S/BmgdJp5P6ZTpE0fzd6GHAF+41kWGPSUz4uvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612534756; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YPnagbMtQjOkqmrbGB7BZXvLdouK7n5MFmlJX2bESlk=; b=JjVhF7N9lQDkxgU+hrF5aOw5SnSNKMbo1CP1WpURHAALkLAeERqQp4VCIZvC5mKyTOGW0qJUrbNnJIxo8JXFHGtAKJ/T6jHIjtXwf2nMEijZDQYWiCSWfIf9k+8BfcZyxLkci3dnZ3VW5P0bLiJP3BSbzIDgLs9Ew2G7iuaiVFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1612534756465384.7526460762184; Fri, 5 Feb 2021 06:19:16 -0800 (PST) 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-161-xlqfh4uEN9e-ysADuGAqxQ-1; Fri, 05 Feb 2021 09:19:11 -0500 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 9E281100CCC0; Fri, 5 Feb 2021 14:19:05 +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 6CC7D19C47; Fri, 5 Feb 2021 14:19:05 +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 3425F18095CD; Fri, 5 Feb 2021 14:19:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 115EIdLh011878 for ; Fri, 5 Feb 2021 09:18:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4EF935C261; Fri, 5 Feb 2021 14:18:39 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D5B05C1B4; Fri, 5 Feb 2021 14:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612534755; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YPnagbMtQjOkqmrbGB7BZXvLdouK7n5MFmlJX2bESlk=; b=jRRf0u5f3rli52sJOzHrXxYI0DuT7U77YPmKurYLuk1QTSAZYPAF4dFbC6USI6sLPVQ8dH iglEtBsTar/uYorpGEFEwjzci3ga5qKYb9KjzLBLgtrJ6N1DO8c+PxtsnycWTRlk41oBmp eyj0EFib56Ux3BljIhHhmueGAR3zFhM= X-MC-Unique: xlqfh4uEN9e-ysADuGAqxQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] qemu: record deprecation messages against the domain Date: Fri, 5 Feb 2021 14:18:27 +0000 Message-Id: <20210205141831.1005395-3-berrange@redhat.com> In-Reply-To: <20210205141831.1005395-1-berrange@redhat.com> References: <20210205141831.1005395-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) These messages are only valid while the domain is running. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_domain.c | 5 +++++ src/qemu/qemu_process.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0f09e321fb..d362764060 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6236,6 +6236,11 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, va_end(args); } =20 + if (taint =3D=3D VIR_DOMAIN_TAINT_DEPRECATED_CONFIG && + extramsg) { + virDomainObjDeprecation(obj, extramsg); + } + VIR_WARN("Domain id=3D%d name=3D'%s' uuid=3D%s is tainted: %s%s%s%s", obj->def->id, obj->def->name, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 30cfa4d485..91f74b95bb 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7857,6 +7857,11 @@ void qemuProcessStop(virQEMUDriverPtr driver, } } =20 + for (i =3D 0; i < vm->ndeprecations; i++) + g_free(vm->deprecations[i]); + g_free(vm->deprecations); + vm->ndeprecations =3D 0; + vm->deprecations =3D NULL; vm->taint =3D 0; vm->pid =3D -1; virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason); --=20 2.29.2 From nobody Mon May 6 01:23:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612534758; cv=none; d=zohomail.com; s=zohoarc; b=l41tm5wnEGQZQNsFmyLyg8jUlwDOW4MZu7zQnD2bx4vrJyDzo7zAKxajO5xchWLJjJ1wQREkOJB1QOVe3YAH0+JcEC6QdUlgIgTpGEzX3FvQmM/oaZ18cEscrx1q0O+gTYWsylVRmO2RQrigrQTmyLrJt4DcCR5A4qJWOUy4h0o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612534758; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vCweLWNASDVMQeqXCudVdjiGbS2fWgNiCOhXFp0m3vM=; b=f+Y8sW+BC5HM3Bq/wIL3VCs4Md72dxld68FYkH5dj+a43QYW4DTjlml5fFREkqgXmMomLpSprLD2PVZCNW8GpM7tbQyjM27WmXilEQffnzooH69JikWp9s7CHgpXPai6q1YMefGFprtdEihZcgB6/RsOmHbfmGsaWgMwzel/DfY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1612534758872747.8998418444604; Fri, 5 Feb 2021 06:19:18 -0800 (PST) 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-255-FF_ie6J8M5OPrtQies0DLg-1; Fri, 05 Feb 2021 09:19:14 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D971C100CCC2; Fri, 5 Feb 2021 14:19:08 +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 B7F185C257; Fri, 5 Feb 2021 14:19:08 +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 8045157DFE; Fri, 5 Feb 2021 14:19:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 115EIenZ011883 for ; Fri, 5 Feb 2021 09:18:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 799195C261; Fri, 5 Feb 2021 14:18:40 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA91F5C1B4; Fri, 5 Feb 2021 14:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612534757; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vCweLWNASDVMQeqXCudVdjiGbS2fWgNiCOhXFp0m3vM=; b=LOOxs9Pgr7saqLslpUkl/WZnouVIaYff7+WP7tXiIY6P/DPrhRl9Ytkd+PjyfCzXwQx/q/ Dh/6echucBvsFMOedBbHUWpXfscsebUZ0Hp6bAWA4CeUgLePnx4j8wu0Cn66uCeIfmsC3E n9+SkqPEUTW9x9pJI2JPWrxmWZeNVBE= X-MC-Unique: FF_ie6J8M5OPrtQies0DLg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] src: define virDomainGetMessages API Date: Fri, 5 Feb 2021 14:18:28 +0000 Message-Id: <20210205141831.1005395-4-berrange@redhat.com> In-Reply-To: <20210205141831.1005395-1-berrange@redhat.com> References: <20210205141831.1005395-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) This API allows fetching a list of informational messages recorded against the domain. This provides a way to give information about tainting of the guest due to undesirable actions/configs, as well as provide details of deprecated features. The output of this API is explicitly targetted at humans, not machines, so it is inappropriate to attempt to pattern match on the strings and take action off them, not least because the messages are marked for translation. Should there be a demand for machine targetted information, this would have to be addressed via a new API, and is not planned at this point in time. Signed-off-by: Daniel P. Berrang=C3=A9 --- include/libvirt/libvirt-domain.h | 9 ++++++ src/driver-hypervisor.h | 6 ++++ src/libvirt-domain.c | 54 ++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ 4 files changed, 74 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index de2456812c..8011cf9fe1 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -5119,4 +5119,13 @@ int virDomainAuthorizedSSHKeysSet(virDomainPtr domai= n, unsigned int nkeys, unsigned int flags); =20 +typedef enum { + VIR_DOMAIN_MESSAGE_DEPRECATION =3D (1 << 0), + VIR_DOMAIN_MESSAGE_TAINTING =3D (1 << 1), +} virDomainMessageType; + +int virDomainGetMessages(virDomainPtr domain, + char ***msgs, + unsigned int flags); + #endif /* LIBVIRT_DOMAIN_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 9e8fe89921..05d7dfb5c7 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1400,6 +1400,11 @@ typedef int unsigned int nkeys, unsigned int flags); =20 +typedef int +(*virDrvDomainGetMessages)(virDomainPtr domain, + char ***msgs, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; =20 @@ -1665,4 +1670,5 @@ struct _virHypervisorDriver { virDrvDomainBackupGetXMLDesc domainBackupGetXMLDesc; virDrvDomainAuthorizedSSHKeysGet domainAuthorizedSSHKeysGet; virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet; + virDrvDomainGetMessages domainGetMessages; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index dba89a7d3a..ae318f4a1a 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -13102,3 +13102,57 @@ virDomainAuthorizedSSHKeysSet(virDomainPtr domain, virDispatchError(conn); return -1; } + + +/** + * virDomainGetMessages: + * @domain: a domain object + * @msgs: pointer to a variable to store messages + * @flags: zero or more virDomainMessageType flags + * + * Fetch a list of all messages recorded against the VM and + * store them into @msgs array which is allocated upon + * successful return and is NULL terminated. The caller is + * responsible for freeing @msgs when no longer needed. + * + * If @flags is zero then all messages are reported. The + * virDomainMessageType constants can be used to restrict + * results to certain types of message. + * + * Note it is hypervisor dependant whether messages are + * available for shutoff guests, or running guests, or + * both. Thus a client should be prepared to re-fetch + * messages when a guest transitions between running + * and shutoff states. + * + * Returns: number of messages stored in @msgs, + * -1 otherwise. + */ +int +virDomainGetMessages(virDomainPtr domain, + char ***msgs, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "msgs=3D%p, flags=3D0x%x", msgs, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + virCheckNonNullArgGoto(msgs, error); + + if (conn->driver->domainGetMessages) { + int ret; + ret =3D conn->driver->domainGetMessages(domain, msgs, flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index cf31f937d5..d851333eb0 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -879,4 +879,9 @@ LIBVIRT_6.10.0 { virDomainAuthorizedSSHKeysSet; } LIBVIRT_6.0.0; =20 +LIBVIRT_7.1.0 { + global: + virDomainGetMessages; +} LIBVIRT_6.10.0; + # .... define new API here using predicted next version number .... --=20 2.29.2 From nobody Mon May 6 01:23:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612534759; cv=none; d=zohomail.com; s=zohoarc; b=a77Lc6QtqjEdpXo6J5eLxjrR12QfBSkw9G819oSaLnpvimC9ivPOa6MgFH0ujsFoWFcHil/GvWRHbwPpUY+lLCPP3ulGj0HtQtFa3CqXG7WfgH1GvjxakoKCwS3h1AZFYRjBEhFkX2nF9wTMFmVkSQ5dBp4htkEYUiF31x8HVPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612534759; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=giutuqEandbUTSNxj7/Jyc9gk36altHGv4UyExupCdM=; b=mK2sMJuv9wBZfadBVcQbO2Cm/9c06ckfDfHsMZ6DVIN//nao4TrhzDM8RyVUrj0DoB1op0Nk2Nt2ARZ5G3AYo9mSgwyNXY+AZq3yOFhnVc3YEhFIFOpqMtLxvcx/6iqXhqwhBpj3kshJf7psPQ9vewM6Eog+Xyu+jB0WAYG2wFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1612534759921187.60257147641494; Fri, 5 Feb 2021 06:19:19 -0800 (PST) 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-435-fqWO5WVcO6q3kO_sGFmvPw-1; Fri, 05 Feb 2021 09:19:15 -0500 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 F1BFACC623; Fri, 5 Feb 2021 14:19:08 +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 CF0D160C5F; Fri, 5 Feb 2021 14:19:08 +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 93AFD1809C8F; Fri, 5 Feb 2021 14:19:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 115EIfn6011897 for ; Fri, 5 Feb 2021 09:18:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id AAAC95C261; Fri, 5 Feb 2021 14:18:41 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id E384A5C1B4; Fri, 5 Feb 2021 14:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612534758; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=giutuqEandbUTSNxj7/Jyc9gk36altHGv4UyExupCdM=; b=D1egejaEOf8lGeoi7AXOPaBEcM3p3Z6/jQgvF/IcLHrKPk1jXlfEjJyicVhQZV0dAg6H4B 3G6++eD2uc0brdbuI+NLZeCZE+IXhwaoeu25HHQ3QGjaWoGk//fsUGjKIVbQGQ9Y1qKDUk 0cTs7E/7q275/Xp7jMiXn21MrpxlXdM= X-MC-Unique: fqWO5WVcO6q3kO_sGFmvPw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] remote: add RPC support for the virDomainGetMessages API Date: Fri, 5 Feb 2021 14:18:29 +0000 Message-Id: <20210205141831.1005395-5-berrange@redhat.com> In-Reply-To: <20210205141831.1005395-1-berrange@redhat.com> References: <20210205141831.1005395-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/remote_daemon_dispatch.c | 45 +++++++++++++++++++++++++++++ src/remote/remote_driver.c | 44 ++++++++++++++++++++++++++++ src/remote/remote_protocol.x | 21 +++++++++++++- src/remote_protocol-structs | 11 +++++++ 4 files changed, 120 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index b7ef1f4b26..e9f2a0ce5b 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -7463,3 +7463,48 @@ remoteDispatchDomainAuthorizedSshKeysSet(virNetServe= rPtr server G_GNUC_UNUSED, =20 return rv; } + +static int +remoteDispatchDomainGetMessages(virNetServerPtr server G_GNUC_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg G_GNUC_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_messages_args *args, + remote_domain_get_messages_ret *ret) +{ + int rv =3D -1; + virConnectPtr conn =3D remoteGetHypervisorConn(client); + int nmsgs =3D 0; + char **msgs =3D NULL; + virDomainPtr dom =3D NULL; + + if (!conn) + goto cleanup; + + if (!(dom =3D get_nonnull_domain(conn, args->dom))) + goto cleanup; + + if ((nmsgs =3D virDomainGetMessages(dom, &msgs, args->flags)) < 0) + goto cleanup; + + if (nmsgs > REMOTE_DOMAIN_MESSAGES_MAX) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Number of msgs %d, which exceeds max limit: %d"), + nmsgs, REMOTE_DOMAIN_MESSAGES_MAX); + goto cleanup; + } + + ret->msgs.msgs_val =3D g_steal_pointer(&msgs); + ret->msgs.msgs_len =3D nmsgs; + + rv =3D nmsgs; + + cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + if (nmsgs > 0) + virStringListFreeCount(msgs, nmsgs); + virObjectUnref(dom); + + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 8d6790ccf2..a83cd866e7 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8098,6 +8098,49 @@ remoteDomainAuthorizedSSHKeysSet(virDomainPtr domain, } =20 =20 +static int +remoteDomainGetMessages(virDomainPtr domain, + char ***msgs, + unsigned int flags) +{ + int rv =3D -1; + size_t i; + struct private_data *priv =3D domain->conn->privateData; + remote_domain_get_messages_args args; + remote_domain_get_messages_ret ret; + + remoteDriverLock(priv); + + make_nonnull_domain(&args.dom, domain); + args.flags =3D flags; + memset(&ret, 0, sizeof(ret)); + + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MESSAGES, + (xdrproc_t) xdr_remote_domain_get_messages_args, (char *)&arg= s, + (xdrproc_t) xdr_remote_domain_get_messages_ret, (char *)&ret)= =3D=3D -1) { + goto cleanup; + } + + if (ret.msgs.msgs_len > REMOTE_DOMAIN_MESSAGES_MAX) { + virReportError(VIR_ERR_RPC, "%s", + _("remoteDomainGetMessages: " + "returned number of msgs exceeds limit")); + goto cleanup; + } + + *msgs =3D g_new0(char *, ret.msgs.msgs_len + 1); + for (i =3D 0; i < ret.msgs.msgs_len; i++) + (*msgs)[i] =3D g_strdup(ret.msgs.msgs_val[i]); + + rv =3D ret.msgs.msgs_len; + + cleanup: + remoteDriverUnlock(priv); + xdr_free((xdrproc_t)xdr_remote_domain_get_messages_ret, + (char *) &ret); + return rv; +} + /* get_nonnull_domain and get_nonnull_network turn an on-wire * (name, uuid) pair into virDomainPtr or virNetworkPtr object. * These can return NULL if underlying memory allocations fail, @@ -8531,6 +8574,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainBackupGetXMLDesc =3D remoteDomainBackupGetXMLDesc, /* 6.0.0 */ .domainAuthorizedSSHKeysGet =3D remoteDomainAuthorizedSSHKeysGet, /* 6= .10.0 */ .domainAuthorizedSSHKeysSet =3D remoteDomainAuthorizedSSHKeysSet, /* 6= .10.0 */ + .domainGetMessages =3D remoteDomainGetMessages, /* 7.1.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 2df38cef77..d3724bc305 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -283,6 +283,9 @@ const REMOTE_NETWORK_PORT_PARAMETERS_MAX =3D 16; /* Upper limit on number of SSH keys */ const REMOTE_DOMAIN_AUTHORIZED_SSH_KEYS_MAX =3D 2048; =20 +/* Upper limit on number of messages */ +const REMOTE_DOMAIN_MESSAGES_MAX =3D 2048; + =20 /* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */ typedef opaque remote_uuid[VIR_UUID_BUFLEN]; @@ -3799,6 +3802,16 @@ struct remote_domain_authorized_ssh_keys_set_args { unsigned int flags; }; =20 +struct remote_domain_get_messages_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_get_messages_ret { + remote_nonnull_string msgs; +}; + + /*----- Protocol. -----*/ =20 /* Define the program number, protocol version and procedure numbers here.= */ @@ -6714,5 +6727,11 @@ enum remote_procedure { * @generate: none * @acl: domain:write */ - REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET =3D 425 + REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET =3D 425, + + /** + * @generate: none + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_GET_MESSAGES =3D 426 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 9bcd14603d..c0c034ac6a 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -3162,6 +3162,16 @@ struct remote_domain_authorized_ssh_keys_set_args { } keys; u_int flags; }; +struct remote_domain_get_messages_args { + remote_nonnull_domain dom; + u_int flags; +}; +struct remote_domain_get_messages_ret { + struct { + u_int msgs_len; + remote_nonnull_string * msgs_val; + } msgs; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3588,4 +3598,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_EVENT_MEMORY_FAILURE =3D 423, REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_GET =3D 424, REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET =3D 425, + REMOTE_PROC_DOMAIN_GET_MESSAGES =3D 426, }; --=20 2.29.2 From nobody Mon May 6 01:23:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612534804; cv=none; d=zohomail.com; s=zohoarc; b=MSb8AhMr3eOK92QzTn32w/bjLd10LVG1u3U1/og2i1YOGxDUhltSp5YNi7M1NStHMtl41Tt1RFZYvay2D+L72KDKRuWisWcz2Fuw9xzV8CF4Hj2YGI8Q3K0Q6uxeSZZknxSvOWIntSwCSAPgFobA4utaiMOAKdCPoUN7p94K5cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612534804; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xKCO0rcHke+VZu1hF99+D7JKKNGkbCWRf5vnkSUggQo=; b=BeNYvWt860+1dMQO+vH6iomnPUj8Ie2ojXiKWYV3jR3i9JzJHPNu8lrKb871gsYPoKjdnJHi7rVSyGuneNTZQ6xph84QUGW/v0GuuJqvhr48M0/F67MJiRSeckCcCw2VJql0cuXJ8HAiLQsJB93DssfzINQVdlDTG23J4NK8Bno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161253480453797.43251361062937; Fri, 5 Feb 2021 06:20:04 -0800 (PST) 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-229-TeaAFS66PMG0Po2HuMpJJA-1; Fri, 05 Feb 2021 09:19:18 -0500 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 40068192CC46; Fri, 5 Feb 2021 14:19:12 +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 1A63560C5D; Fri, 5 Feb 2021 14:19: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 CA8B349; Fri, 5 Feb 2021 14:19:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 115EIghO011907 for ; Fri, 5 Feb 2021 09:18:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id C91A05C257; Fri, 5 Feb 2021 14:18:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0533E5C1B4; Fri, 5 Feb 2021 14:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612534803; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xKCO0rcHke+VZu1hF99+D7JKKNGkbCWRf5vnkSUggQo=; b=aGYrwt5nrSYEBQF3l92lOcZ7dl/xhtNws9WDaAW1M5RCIM8Dv0nQzVaDVxABPxS9HQ57wl iD+7OZUDaPe/c3me4lMeJGVvlI8oBTN79DPLiseLmU6A1JiBG8NL92z96wY2ZELg7ZTItV gCzZ5wTEudpMmcT7aMlcS6SDbKqUVHY= X-MC-Unique: TeaAFS66PMG0Po2HuMpJJA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] qemu: implement virDomainGetMessages API Date: Fri, 5 Feb 2021 14:18:30 +0000 Message-Id: <20210205141831.1005395-6-berrange@redhat.com> In-Reply-To: <20210205141831.1005395-1-berrange@redhat.com> References: <20210205141831.1005395-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.c | 17 ++++++++++++ src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 2 ++ src/qemu/qemu_domain.h | 3 ++ src/qemu/qemu_driver.c | 59 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a873c0ada2..f78fc992c1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -90,6 +90,23 @@ VIR_ENUM_IMPL(virDomainTaint, "deprecated-config", ); =20 +VIR_ENUM_IMPL(virDomainTaintMessage, + VIR_DOMAIN_TAINT_LAST, + N_("custom configuration parameters specified"), + N_("custom monitor control commands issued"), + N_("running with undesirable elevated privileges"), + N_("network configuration using opaque shell scripts"), + N_("potentially unsafe disk format probing"), + N_("managing externally launched configuration"), + N_("potentially unsafe use of host CPU passthrough"), + N_("configuration potentially modified by hook script"), + N_("use of host cdrom passthrough"), + N_("custom device tree blob used"), + N_("custom guest agent control commands issued"), + N_("hypervisor feature autodetection override"), + N_("use of deprecated configuration settings"), +); + VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST, "none", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ea6370c03d..1ef4266d13 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3631,6 +3631,7 @@ bool virDomainVsockDefEquals(const virDomainVsockDef = *a, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 VIR_ENUM_DECL(virDomainTaint); +VIR_ENUM_DECL(virDomainTaintMessage); VIR_ENUM_DECL(virDomainVirt); VIR_ENUM_DECL(virDomainBoot); VIR_ENUM_DECL(virDomainFeature); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 512da526fc..730289a1f8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -628,6 +628,8 @@ virDomainStateTypeToString; virDomainStorageNetworkParseHost; virDomainStorageSourceParse; virDomainStorageSourceParseBase; +virDomainTaintMessageTypeFromString; +virDomainTaintMessageTypeToString; virDomainTaintTypeFromString; virDomainTaintTypeToString; virDomainTimerModeTypeFromString; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 7453881a31..42b6fda91a 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -572,6 +572,9 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, const char *msg, ...) G_GNUC_PRINTF(5, 6); =20 +char **qemuDomainObjGetTainting(virQEMUDriverPtr driver, + virDomainObjPtr obj); + void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, qemuDomainLogContextPtr logCtxt, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c34af6b7d1..fee4cb81ed 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20367,6 +20367,64 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom, } =20 =20 +static int +qemuDomainGetMessages(virDomainPtr dom, + char ***msgs, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + int rv =3D -1; + size_t i, n; + int nmsgs; + + virCheckFlags(VIR_DOMAIN_MESSAGE_DEPRECATION | + VIR_DOMAIN_MESSAGE_TAINTING, -1); + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + return -1; + + if (virDomainGetMessagesEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + *msgs =3D NULL; + nmsgs =3D 0; + n =3D 0; + + if (!flags || (flags & VIR_DOMAIN_MESSAGE_TAINTING)) { + nmsgs +=3D __builtin_popcount(vm->taint); + *msgs =3D g_renew(char *, *msgs, nmsgs+1); + + for (i =3D 0; i < VIR_DOMAIN_TAINT_LAST; i++) { + if (vm->taint & (1 << i)) { + (*msgs)[n++] =3D g_strdup_printf( + "%s: %s", _("tainted"), + _(virDomainTaintMessageTypeToString(i))); + } + } + } + + if (!flags || (flags & VIR_DOMAIN_MESSAGE_DEPRECATION)) { + nmsgs +=3D vm->ndeprecations; + *msgs =3D g_renew(char *, *msgs, nmsgs+1); + + for (i =3D 0; i < vm->ndeprecations; i++) { + (*msgs)[n++] =3D g_strdup_printf( + "%s: %s", + _("deprecated configuration"), + vm->deprecations[i]); + } + } + + (*msgs)[nmsgs] =3D NULL; + + rv =3D nmsgs; + + cleanup: + virDomainObjEndAPI(&vm); + return rv; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -20608,6 +20666,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainBackupGetXMLDesc =3D qemuDomainBackupGetXMLDesc, /* 6.0.0 */ .domainAuthorizedSSHKeysGet =3D qemuDomainAuthorizedSSHKeysGet, /* 6.1= 0.0 */ .domainAuthorizedSSHKeysSet =3D qemuDomainAuthorizedSSHKeysSet, /* 6.1= 0.0 */ + .domainGetMessages =3D qemuDomainGetMessages, /* 7.1.0 */ }; =20 =20 --=20 2.29.2 From nobody Mon May 6 01:23:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612534762; cv=none; d=zohomail.com; s=zohoarc; b=ikKBKOwOXZfr2Gw9T8rY+e7uvdsf4xXkAh92e7sTh4AnxX3k+NQfN6kllYqgaC1s8tJCRXuqEO+hwIPOviIPK7B7FM8Ki6D1Eue6qWC/VIVgW+thPVnGVdBTHityJVo7dsDCFN/qjyzhZt8Mx97wFwtHfBW4AAqoFdN7T8s6HUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612534762; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Uq/W2IXTPpw9I/oBv2Izg5LB+JkB9vUy0ozAx8Vb/gc=; b=GFNYb7zQ7K7j1zgEH4e0P8TzKtQJ/xwSvUTIxzrhDaTZGctNjlh7Hzm7tEUDEMB7iEME3SYBhRAf+BrnzYQFhX4s7VL8FlbEgTAYcbjTZUVw1N9GQfrsjhZJH/MvnEUVi8fMdvAsSI83Md86G0KYabdDKhMzsfG87lAwqkdpets= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1612534762435518.8208861954623; Fri, 5 Feb 2021 06:19:22 -0800 (PST) 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-229-21syHWYMN5qSCzr9cPKYlA-1; Fri, 05 Feb 2021 09:19:18 -0500 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 40000CC627; Fri, 5 Feb 2021 14:19: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 1A4AF1346F; Fri, 5 Feb 2021 14:19: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 CF2B41809C91; Fri, 5 Feb 2021 14:19:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 115EIhFM011923 for ; Fri, 5 Feb 2021 09:18:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id EAC275C261; Fri, 5 Feb 2021 14:18:43 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26C035C1B4; Fri, 5 Feb 2021 14:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612534761; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Uq/W2IXTPpw9I/oBv2Izg5LB+JkB9vUy0ozAx8Vb/gc=; b=OWsZg80dzRDEs0puefEKAXkX++mKbnWCxPNStzpviwpX1vrK8Kur6rX+ZHOBrqT9ik6EIk eODj16OWzCIl6W00W+aob0A0Qf3YtdmbfO9Houycu8rXJsgMddPTwpz2RF/zik4VHl/bmf ehC6jaBFt3x9GDJ5wNP5drkIrSzLvJ8= X-MC-Unique: 21syHWYMN5qSCzr9cPKYlA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/6] tools: report messages for 'dominfo' command Date: Fri, 5 Feb 2021 14:18:31 +0000 Message-Id: <20210205141831.1005395-7-berrange@redhat.com> In-Reply-To: <20210205141831.1005395-1-berrange@redhat.com> References: <20210205141831.1005395-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) $ virsh dominfo demo Id: 2 Name: demo UUID: eadf8ef0-bf14-4c5f-9708-4a19bacf9e81 OS Type: hvm State: running CPU(s): 2 CPU time: 15.8s Max memory: 1536000 KiB Used memory: 1536000 KiB Persistent: yes Autostart: disable Managed save: no Security model: selinux Security DOI: 0 Security label: unconfined_u:unconfined_r:svirt_t:s0:c443,c956 (permissive) Messages: tainted: custom monitor control commands issued tainted: use of deprecated configuration settings deprecated configuration: machine type 'pc-1.2' Signed-off-by: Daniel P. Berrang=C3=A9 --- tools/virsh-domain-monitor.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 02ff1fbd62..df24543ef8 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1291,6 +1291,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) char *str, uuid[VIR_UUID_STRING_BUFLEN]; int has_managed_save =3D 0; virshControlPtr priv =3D ctl->privData; + char **messages =3D NULL; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -1391,6 +1392,18 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) VIR_FREE(seclabel); } } + + if (virDomainGetMessages(dom, &messages, 0) > 0) { + size_t i; + for (i =3D 0; messages[i] !=3D NULL; i++) { + if (i =3D=3D 0) { + vshPrint(ctl, "%-15s %s\n", _("Messages:"), messages[i]); + } else { + vshPrint(ctl, "%-15s %s\n", "", messages[i]); + } + } + } + virshDomainFree(dom); return ret; } --=20 2.29.2