From nobody Wed May 1 17:10:40 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=1612886493; cv=none; d=zohomail.com; s=zohoarc; b=hVoSTMCs60km7AZbQyNBQ6TtLkzna6rwRqfrua8Z0AVElnIn5Kh6PpSti9LgvtYOI0xwbZzWEhBCYo2/srApyrRvnjs17f5Cut6gKKi5r0hkOdgPDJG67qi4l46/zNij1MCEMmPxqlW2/DwI2GOP8tKSHFx9VX+Ik0uagbIwmyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612886493; 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=cLFZLGqHsSiXWszf4o60YK3jGuDkoCJwMMkAoWf909PlJ7E5WZ3YYpeX4+UQ0U0IzbNGWNDUcXXHfsdUAuazYR3X8dwLIPmhBk/HRBcJA+JPHIvAdFw6uvR2PabIVyOhiGT0sDxGCjSXHlKrP94VRADrKL8gxVGQZ1WStvLsZRw= 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 1612886492732869.5449942586887; Tue, 9 Feb 2021 08:01:32 -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-120-KpK6eDzgOZSOinVUEdCKNg-1; Tue, 09 Feb 2021 11:01:26 -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 45E4785EE9F; Tue, 9 Feb 2021 16:01:19 +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 C525119C78; Tue, 9 Feb 2021 16:01:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 79A0D18095CB; Tue, 9 Feb 2021 16:01:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 119G1G5u010752 for ; Tue, 9 Feb 2021 11:01:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0B38760CCD; Tue, 9 Feb 2021 16:01:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EBB960861; Tue, 9 Feb 2021 16:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612886489; 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=hNOkTv1+dRDOd1gxsMtOL1BCdFRNwPxOAPD+icHuOj31/ItsfJJ1dNTm3JW2AF+Dapz+zw 82fcipSoDJlfCNszBqeBx7AyI/SZo/dh6rbDP6yqxrOqkD56Or2SZTzNAM+lm1ATdTwNCE Lp6BJf/whEItdgob34q9flKhO8iNZkc= X-MC-Unique: KpK6eDzgOZSOinVUEdCKNg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/6] conf: record deprecation messages against the domain Date: Tue, 9 Feb 2021 16:01:04 +0000 Message-Id: <20210209160109.1229387-2-berrange@redhat.com> In-Reply-To: <20210209160109.1229387-1-berrange@redhat.com> References: <20210209160109.1229387-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 will be stored in the live status XML. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- 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 Wed May 1 17:10:40 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=1612886493; cv=none; d=zohomail.com; s=zohoarc; b=Qyhbogab9ez2AfCYz4fWK6e12uLkPEDU460KOoQIGz/WYPWll/l/Tm0VwxgNoEF5tTRpvH30Xnsmhh62YJzxJ3TFmz3OtdxDtSKzhi4TUHvtiB7WdYv9Bk0nx8eowwnLvCpuNrqVOu5+wHOS+BGUCMYWOxjI3h7vX791InnSTp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612886493; 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=K/eMUm14s5KLUpLUydFubp3uA2qwrqgX+me8UyvQ5vTo2fGnSui41ggthr8WlHT2f1Lzjz2jhYshmOl57uTR6zDSHXmaweNdEU5uCw8Cbpn7l9zvHCwDutFRoiKdjV1mgS+Ru1BwcIevxVVEaQa0nPpadl5J+ooR4L5CFviFPkI= 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 1612886492740270.07201786343455; Tue, 9 Feb 2021 08:01:32 -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-190-kO_CQgIKOvWaQUlEx4syTA-1; Tue, 09 Feb 2021 11:01:27 -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 9412F6DD28; Tue, 9 Feb 2021 16:01:20 +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 66ADD19CA8; Tue, 9 Feb 2021 16:01:20 +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 2963018095CD; Tue, 9 Feb 2021 16:01:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 119G1HNE010764 for ; Tue, 9 Feb 2021 11:01:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5BB2760CCD; Tue, 9 Feb 2021 16:01:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D2CF60861; Tue, 9 Feb 2021 16:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612886490; 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=h5aueRBgnzHjvZ59Gv+qAcS6b4JaR+T1zYGjI5BBVoK+3nzUl6cpZlRHdFQjok0tNprGpW XqdrM7EuKQ99JTWWIuAjuAD71uIG92BKqa9yQ6czbeoCnIbUgBRTdve8/JPHc20lGHEgie B5NNN16XOk9/AQLdBp5yqi9eXzygj18= X-MC-Unique: kO_CQgIKOvWaQUlEx4syTA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/6] qemu: record deprecation messages against the domain Date: Tue, 9 Feb 2021 16:01:05 +0000 Message-Id: <20210209160109.1229387-3-berrange@redhat.com> In-Reply-To: <20210209160109.1229387-1-berrange@redhat.com> References: <20210209160109.1229387-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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) These messages are only valid while the domain is running. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- 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 Wed May 1 17:10:40 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=1612886495; cv=none; d=zohomail.com; s=zohoarc; b=WBKkhZiTV+gQx7A/diH9HeXyztV1GhCrHfan+/MSNSMKBWabx3HEBcExZIjVAgPeNoSJA/2ZOwClIx7dKHJVELYbrM7vmoUP9t4QdwepsRXZDe51nQs8L0tGHylrRhdKXl4lLdQ30sUVX9eeTo4llZOMzaAquuvtjX8bGz7CHX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612886495; 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=XIJ45HPnPfOasdtWoWo64i6uSEf/Y8yG/y6fl1X46J9lGASblaIyb+UOnqUGSPwaMzBRgLwh9/mmvYFVj3bYrKIlKXnQyZ0+r2u8qhcMDG20ZwGUoYVFkHpuY2i3rRrg9PTG5sVQjoduTsBLk+2WwsmvV8RflI5tyST7O46yWkE= 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 1612886495665869.5247742582571; Tue, 9 Feb 2021 08:01:35 -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-206-sMfdi9xAOW6TJEBbEkuc9w-1; Tue, 09 Feb 2021 11:01:29 -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 B0838192CC4B; Tue, 9 Feb 2021 16:01:23 +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 8367219727; Tue, 9 Feb 2021 16:01:23 +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 454CF57DFF; Tue, 9 Feb 2021 16:01:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 119G1IiE010785 for ; Tue, 9 Feb 2021 11:01:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9EEA860861; Tue, 9 Feb 2021 16:01:18 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBDC060CD2; Tue, 9 Feb 2021 16:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612886493; 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=hCamH/Ulgc1/71ycMBCTg0SmUowtSeolk+QEVc57xu6iZjVA2PrlWBqiaGPXtuq8n+h8J2 GbFUi3lj3/Ia7M2DBLyiBz73OnLh/MgSeCCE6nGnsPU4b/mH3jZFl13eJNRF98kN4Pz93h d0SqZBAsLzeAwVhxbiyNoDr4wtLVSWQ= X-MC-Unique: sMfdi9xAOW6TJEBbEkuc9w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/6] src: define virDomainGetMessages API Date: Tue, 9 Feb 2021 16:01:06 +0000 Message-Id: <20210209160109.1229387-4-berrange@redhat.com> In-Reply-To: <20210209160109.1229387-1-berrange@redhat.com> References: <20210209160109.1229387-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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) 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 Reviewed-by: Michal Privoznik --- 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 Wed May 1 17:10:40 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=1612886528; cv=none; d=zohomail.com; s=zohoarc; b=dJRhRUCLBoM0mfEqZRHJ4CIT50gNdv+2Ojkm/RnU4ry+9DqF1zspkTZkGw/UR2/pUsjy54ys3LaTwKF0/C+MbGJtp04dSpkAYhKtfCJ6UK4qxE8MQiki0exN1X9g/9r/7gqtfEQuLHeCz5BUREZ9pywKfx7QUYA0/Vnl99u9XkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612886528; 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=e/gzDamiCczChVwEIV1QWH2GcTJkBumhjVSDIuBWfDEUASc+nHYgW+2Zie2v4iHVcUhr6jATjVR2RHwNXfMRzT51wDBpv118v3EinXnNzHdqhLdBSfxbpL5B3qyZckaZ036byuk77y1z+uxOdut0GQzspJa2D2SOEZDKApFjoe0= 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 161288652784792.1344254230986; Tue, 9 Feb 2021 08:02:07 -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-476-h8-9rlPaPfK06l5kpWW5_Q-1; Tue, 09 Feb 2021 11:01:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19AD679EEE; Tue, 9 Feb 2021 16:01:27 +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 D927210016FE; Tue, 9 Feb 2021 16:01:26 +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 879E858077; Tue, 9 Feb 2021 16:01:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 119G1Ji0010794 for ; Tue, 9 Feb 2021 11:01:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id B0AC52B0AC; Tue, 9 Feb 2021 16:01:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E28A60861; Tue, 9 Feb 2021 16:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612886526; 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=D01/shHvTlbLhgNckf95t10IAm3Upk2dOrTor5AIQPkLfVn0FoOqC4H5zktJYd9Fze6rDv 4y4lD9CYa1/TqV7aC1YEfGm8Xcln4KMimFdTQys+Atg36zlvrxq2B+sxP6RaMzXKi0S0ta SY095ZcAYxOnbRmDvwCvH7EEzXJAf6g= X-MC-Unique: h8-9rlPaPfK06l5kpWW5_Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/6] remote: add RPC support for the virDomainGetMessages API Date: Tue, 9 Feb 2021 16:01:07 +0000 Message-Id: <20210209160109.1229387-5-berrange@redhat.com> In-Reply-To: <20210209160109.1229387-1-berrange@redhat.com> References: <20210209160109.1229387-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-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 Reviewed-by: Michal Privoznik --- 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 Wed May 1 17:10:40 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=1612886528; cv=none; d=zohomail.com; s=zohoarc; b=N0GqPvDE3ijfXmT+95JzCoqkIljB6e5hgHPjvLF9oKGIO9Cm4gOErYwwzZLbmTn2RPbUMrTmmhQCQAyMP4nFf8s/DFzLAzyyFkgl6AGuy4/pFUEq7hLRpI8Iji0D+JFiVqBgZgWM3RuQjUhlfQeYpbHNkFxhOjD1SKhh6eFXZPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612886528; 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=mOBnuSg56hgDCoVjWWqoOnx1G4swms+x7hUISnAaJKQ=; b=DVcg3BWeuT2AA0urNeDL990Pk90U6qizKG3/qBbnyJIkH7J3M0cPVFzZdJt/0e6z9JO8hUb0v2jP9g8df/3pijtzvxoPzF++rN/6OUCVReQcoAIYedwB8zA45WL9Bn0q+yQfP8MTO+6VLaoiDgz8qnRQYnKi+FxhqJnBNws/akg= 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 1612886527895303.8544048753282; Tue, 9 Feb 2021 08:02:07 -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-45-NIPiUvQIOaeAG9eTLjX1Rg-1; Tue, 09 Feb 2021 11:01:38 -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 4016E86A094; Tue, 9 Feb 2021 16:01:24 +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 1E2455D9D0; Tue, 9 Feb 2021 16:01:24 +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 D314858073; Tue, 9 Feb 2021 16:01:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 119G1KCM010800 for ; Tue, 9 Feb 2021 11:01:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id D211A60CD2; Tue, 9 Feb 2021 16:01:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C4D560861; Tue, 9 Feb 2021 16:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612886526; 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=mOBnuSg56hgDCoVjWWqoOnx1G4swms+x7hUISnAaJKQ=; b=FZ+wg1rHF8IQSqrMHrucK+3ct1QD9ftUNGzg3mWM1S7Dl/5T0AHVhE/tqliSqp1HWfJIMe 1xTT2yyY1WSZpOZomeUCclKYVN0hW0O4kCKTO3EUjhyML9gRP3n1/YmC0Z82+WJqagzyZl UO7TFW/s60oEjV/HB21cIudIfADd2uE= X-MC-Unique: NIPiUvQIOaeAG9eTLjX1Rg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 5/6] qemu: implement virDomainGetMessages API Date: Tue, 9 Feb 2021 16:01:08 +0000 Message-Id: <20210209160109.1229387-6-berrange@redhat.com> In-Reply-To: <20210209160109.1229387-1-berrange@redhat.com> References: <20210209160109.1229387-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- 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 | 58 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 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..5790fa5356 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20367,6 +20367,63 @@ 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( + _("tainted: %s"), + _(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( + _("deprecated configuration: %s"), + 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 +20665,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 Wed May 1 17:10:40 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=1612886506; cv=none; d=zohomail.com; s=zohoarc; b=PIZbz+kzjehgxjK2dP+yxB8Mk8Y/5O9gZNT5b2gCuAyNLNjAVw+rm2o2MF1U8y9n93gOPzIBvN9kPdC+p7MIWx1MwR9s8CPf86hPvpkYlWaeWNRURfjudlmjtf/xQpFkgPJxGzxHnzN++oXNHNiESVtgu9yfBQmJ+opT4RgQOio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612886506; 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=eRtzdM/Pv0+ZQndGyRNV/ICnKcKtk727IvJXNQamaZM=; b=fVFyqAKDXt1CXm4Am6ZeIcaB2Wnsgh2Z+DeQfmWfpvUKabopEZ0fh/QWf3s4H5rJn9aVjfmVtcL85CqWYJvVUlZBrJC5GdBltn3GhuvoYDObINyoh3yINKS23KgEk9PHghuKwwpSbdlO1BKu4Ku9IPDdN+H67S5aXUSCiX+tSjw= 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 1612886505685908.1827349958504; Tue, 9 Feb 2021 08:01:45 -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-405-uQHMVrQ9OvSIYBM3ytxawA-1; Tue, 09 Feb 2021 11:01:40 -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 E63E0107ACF4; Tue, 9 Feb 2021 16:01:29 +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 C3CAF177C0; Tue, 9 Feb 2021 16:01:29 +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 898131809C8F; Tue, 9 Feb 2021 16:01:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 119G1MHM010817 for ; Tue, 9 Feb 2021 11:01:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3178B60CD2; Tue, 9 Feb 2021 16:01:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4078F60861; Tue, 9 Feb 2021 16:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612886503; 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=eRtzdM/Pv0+ZQndGyRNV/ICnKcKtk727IvJXNQamaZM=; b=GlljXPbpYTcObHWmCtC1mA226gATdzsESRd0HG7owFmZkVoz8tPCoo5xVQglsw91wnm7qn JEimLJLVMbnmnNhLdpn5J47/G0rEUx9gXIySWbfKI363inHUDojSTr5WCfMvmiFS8lM5CD VF9jOXglvTMA55FKnBszjtHcy70gS1w= X-MC-Unique: uQHMVrQ9OvSIYBM3ytxawA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 6/6] tools: report messages for 'dominfo' command Date: Tue, 9 Feb 2021 16:01:09 +0000 Message-Id: <20210209160109.1229387-7-berrange@redhat.com> In-Reply-To: <20210209160109.1229387-1-berrange@redhat.com> References: <20210209160109.1229387-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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) $ 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 Reviewed-by: Michal Privoznik --- tools/virsh-domain-monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 02ff1fbd62..897339b6f9 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; + g_auto(GStrv) messages =3D NULL; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -1391,6 +1392,15 @@ 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++) { + vshPrint(ctl, "%-15s %s\n", + i =3D=3D 0 ? _("Messages:") : "", messages[i]); + } + } + virshDomainFree(dom); return ret; } --=20 2.29.2