From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489711247358.9553230029587; Tue, 2 Oct 2018 07:15:11 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id AEABC30C62D1; Tue, 2 Oct 2018 14:15: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 6331054573; Tue, 2 Oct 2018 14:15: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 A94F7180B5B7; Tue, 2 Oct 2018 14:15:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EF6BA020239 for ; Tue, 2 Oct 2018 10:15:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6148A1C939; Tue, 2 Oct 2018 14:15:06 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC87827BBE for ; Tue, 2 Oct 2018 14:15:04 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:40 +0200 Message-Id: <20181002141446.20943-2-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 1/7] util: Add 'level' argument to virReportErrorHelper() 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 02 Oct 2018 14:15:09 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Up until now it's been assumed that every single error reported through the helper would have VIR_ERR_ERROR level, but this will no longer be the case going forward so we need to make it a little more flexible. Signed-off-by: Andrea Bolognani --- src/access/viraccessdriverpolkit.c | 2 +- src/access/viraccessmanager.c | 2 +- src/datatypes.h | 30 ++++++++++++++++++++++++++---- src/libvirt.c | 1 + src/util/virbuffer.c | 4 ++-- src/util/virconf.c | 6 ++++-- src/util/virerror.c | 4 +++- src/util/virerror.h | 11 ++++++----- src/util/virkeyfile.c | 6 ++++-- src/util/virxml.c | 2 +- 10 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdrive= rpolkit.c index 6954d74a15..1f87e7e152 100644 --- a/src/access/viraccessdriverpolkit.c +++ b/src/access/viraccessdriverpolkit.c @@ -34,7 +34,7 @@ VIR_LOG_INIT("access.accessdriverpolkit"); =20 #define virAccessError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ + virReportErrorHelper(VIR_FROM_THIS, code, VIR_ERR_ERROR, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) =20 #define VIR_ACCESS_DRIVER_POLKIT_ACTION_PREFIX "org.libvirt.api" diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c index e7b5bf38da..f4230b253a 100644 --- a/src/access/viraccessmanager.c +++ b/src/access/viraccessmanager.c @@ -37,7 +37,7 @@ VIR_LOG_INIT("access.accessmanager"); =20 #define virAccessError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ + virReportErrorHelper(VIR_FROM_THIS, code, VIR_ERR_ERROR, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) =20 struct _virAccessManager { diff --git a/src/datatypes.h b/src/datatypes.h index e1b38706dc..87d6aa9a80 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -49,7 +49,7 @@ extern virClassPtr virAdmClientClass; # define virCheckConnectReturn(obj, retval) \ do { \ if (!virObjectIsClass(obj, virConnectClass)) { \ - virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, VIR_= ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -59,7 +59,7 @@ extern virClassPtr virAdmClientClass; # define virCheckConnectGoto(obj, label) \ do { \ if (!virObjectIsClass(obj, virConnectClass)) { \ - virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, VIR_= ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -71,7 +71,7 @@ extern virClassPtr virAdmClientClass; virDomainPtr _dom =3D (obj); \ if (!virObjectIsClass(_dom, virDomainClass) || \ !virObjectIsClass(_dom->conn, virConnectClass)) { \ - virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \ + virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, VIR= _ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -83,7 +83,7 @@ extern virClassPtr virAdmClientClass; virDomainPtr _dom =3D (obj); \ if (!virObjectIsClass(_dom, virDomainClass) || \ !virObjectIsClass(_dom->conn, virConnectClass)) { \ - virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \ + virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, VIR= _ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -97,6 +97,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_net->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_NETWORK, \ VIR_ERR_INVALID_NETWORK, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -110,6 +111,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_net->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_NETWORK, \ VIR_ERR_INVALID_NETWORK, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -123,6 +125,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_iface->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_INTERFACE, \ VIR_ERR_INVALID_INTERFACE, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -137,6 +140,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_pool->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_STORAGE, \ VIR_ERR_INVALID_STORAGE_POOL, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -151,6 +155,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_pool->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_STORAGE, \ VIR_ERR_INVALID_STORAGE_POOL, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -164,6 +169,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_vol->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_STORAGE, \ VIR_ERR_INVALID_STORAGE_VOL, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -177,6 +183,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_vol->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_STORAGE, \ VIR_ERR_INVALID_STORAGE_VOL, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -190,6 +197,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_node->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_NODEDEV, \ VIR_ERR_INVALID_NODE_DEVICE, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -204,6 +212,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_dev->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_NODEDEV, \ VIR_ERR_INVALID_NODE_DEVICE, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -217,6 +226,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_secret->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_SECRET, \ VIR_ERR_INVALID_SECRET, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -231,6 +241,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_secret->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_SECRET, \ VIR_ERR_INVALID_SECRET, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -245,6 +256,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_st->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_STREAMS, \ VIR_ERR_INVALID_STREAM, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -258,6 +270,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_st->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_STREAMS, \ VIR_ERR_INVALID_STREAM, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -271,6 +284,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_nw->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_NWFILTER, \ VIR_ERR_INVALID_NWFILTER, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -285,6 +299,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_nw->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_NWFILTER, \ VIR_ERR_INVALID_NWFILTER_BINDING, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -300,6 +315,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_snap->domain->conn, virConnectClass)) { \ virReportErrorHelper(VIR_FROM_DOMAIN_SNAPSHOT, \ VIR_ERR_INVALID_DOMAIN_SNAPSHOT, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -358,6 +374,7 @@ extern virClassPtr virAdmClientClass; do { \ if (!virObjectIsClass(obj, virAdmConnectClass)) { \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -368,6 +385,7 @@ extern virClassPtr virAdmClientClass; do { \ if (!virObjectIsClass(obj, virAdmConnectClass)) { \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -380,6 +398,7 @@ extern virClassPtr virAdmClientClass; if (!virObjectIsClass(_srv, virAdmServerClass) || \ !virObjectIsClass(_srv->conn, virAdmConnectClass)) { \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -392,6 +411,7 @@ extern virClassPtr virAdmClientClass; if (!virObjectIsClass(_srv, virAdmServerClass) || \ !virObjectIsClass(_srv->conn, virAdmConnectClass)) { \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ @@ -405,6 +425,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_clt->srv, virAdmServerClass) || \ !virObjectIsClass(_clt->srv->conn, virAdmConnectClass)) { \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ virDispatchError(NULL); \ @@ -418,6 +439,7 @@ extern virClassPtr virAdmClientClass; !virObjectIsClass(_clt->srv, virAdmServerClass) || \ !virObjectIsClass(_clt->srv->conn, virAdmConnectClass)) { \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \ + VIR_ERR_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ __FUNCTION__); \ goto label; \ diff --git a/src/libvirt.c b/src/libvirt.c index 0a738aefb1..3e0bb26b9f 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -988,6 +988,7 @@ virConnectOpenInternal(const char *name, #endif false)) { virReportErrorHelper(VIR_FROM_NONE, VIR_ERR_CONFIG_UNSUPPORTED, + VIR_ERR_ERROR, __FILE__, __FUNCTION__, __LINE__, _("libvirt was built without the '%s' dri= ver"), ret->uri->scheme); diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c index 8a2108f2f2..6306b3f072 100644 --- a/src/util/virbuffer.c +++ b/src/util/virbuffer.c @@ -339,8 +339,8 @@ virBufferCheckErrorInternal(const virBuffer *buf, virReportOOMErrorFull(domcode, filename, funcname, linenr); errno =3D ENOMEM; } else { - virReportErrorHelper(domcode, VIR_ERR_INTERNAL_ERROR, filename, - funcname, linenr, "%s", + virReportErrorHelper(domcode, VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERRO= R, + filename, funcname, linenr, "%s", _("Invalid buffer API usage")); errno =3D EINVAL; } diff --git a/src/util/virconf.c b/src/util/virconf.c index 88a869517e..8a382e8b6e 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -110,10 +110,12 @@ virConfErrorHelper(const char *file, const char *func= , size_t line, =20 /* Construct the string 'filename:line: info' if we have that. */ if (ctxt && ctxt->filename) { - virReportErrorHelper(VIR_FROM_CONF, error, file, func, line, + virReportErrorHelper(VIR_FROM_CONF, error, VIR_ERR_ERROR, + file, func, line, _("%s:%d: %s"), ctxt->filename, ctxt->line, i= nfo); } else { - virReportErrorHelper(VIR_FROM_CONF, error, file, func, line, + virReportErrorHelper(VIR_FROM_CONF, error, VIR_ERR_ERROR, + file, func, line, "%s", info); } } diff --git a/src/util/virerror.c b/src/util/virerror.c index 683e51aa19..517e0bde28 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -1518,6 +1518,7 @@ virErrorMsg(virErrorNumber error, const char *info) * * @domcode: the virErrorDomain indicating where it's coming from * @errorcode: the virErrorNumber code for the error + * @level: the virErrorLevel level for the error * @filename: Source file error is dispatched from * @funcname: Function error is dispatched from * @linenr: Line number error is dispatched from @@ -1529,6 +1530,7 @@ virErrorMsg(virErrorNumber error, const char *info) */ void virReportErrorHelper(int domcode, int errorcode, + virErrorLevel level, const char *filename, const char *funcname, size_t linenr, @@ -1549,7 +1551,7 @@ void virReportErrorHelper(int domcode, =20 virerr =3D virErrorMsg(errorcode, (errorMessage[0] ? errorMessage : NU= LL)); virRaiseErrorFull(filename, funcname, linenr, - domcode, errorcode, VIR_ERR_ERROR, + domcode, errorcode, level, virerr, errorMessage, NULL, -1, -1, virerr, errorMessage); errno =3D save_errno; diff --git a/src/util/virerror.h b/src/util/virerror.h index 31577c5c8c..6e089db0d0 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -51,11 +51,12 @@ void virRaiseErrorObject(const char *filename, virErrorPtr err); =20 void virReportErrorHelper(int domcode, int errcode, + virErrorLevel level, const char *filename, const char *funcname, size_t linenr, const char *fmt, ...) - ATTRIBUTE_FMT_PRINTF(6, 7); + ATTRIBUTE_FMT_PRINTF(7, 8); =20 void virReportSystemErrorFull(int domcode, int theerrno, @@ -160,10 +161,10 @@ void virReportSystemErrorFull(int domcode, (fmt), __VA_ARGS__) =20 # define virReportUnsupportedError() \ - virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_NO_SUPPORT, \ + virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_NO_SUPPORT, VIR_ERR_ERROR,= \ __FILE__, __FUNCTION__, __LINE__, __FUNCTION__) # define virReportRestrictedError(...) \ - virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_OPERATION_DENIED, \ + virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_OPERATION_DENIED, VIR_ERR_= ERROR, \ __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) /* The sizeof(...) comparison here is a hack to catch typos * in the name of the enum by triggering a compile error, as well @@ -171,7 +172,7 @@ void virReportSystemErrorFull(int domcode, * or struct type, instead of an enum. It should get optimized away * since sizeof() is known at compile time */ # define virReportEnumRangeError(typname, value) \ - virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INTERNAL_ERROR, \ + virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INTERNAL_ERROR, VIR_ERR_ER= ROR, \ __FILE__, __FUNCTION__, __LINE__, \ "Unexpected enum value %d for %s", \ value, sizeof((typname)1) !=3D 0 ? #typname : #ty= pname); @@ -185,7 +186,7 @@ void virReportOOMErrorFull(int domcode, virReportOOMErrorFull(VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__) =20 # define virReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ + virReportErrorHelper(VIR_FROM_THIS, code, VIR_ERR_ERROR, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) =20 # define virReportErrorObject(obj) \ diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c index 1006a88837..4a0a7f5ee8 100644 --- a/src/util/virkeyfile.c +++ b/src/util/virkeyfile.c @@ -93,10 +93,12 @@ virKeyFileErrorHelper(const char *file, const char *fun= c, size_t line, { /* Construct the string 'filename:line: info' if we have that. */ if (ctxt && ctxt->filename) { - virReportErrorHelper(VIR_FROM_CONF, error, file, func, line, + virReportErrorHelper(VIR_FROM_CONF, error, VIR_ERR_ERROR, + file, func, line, _("%s:%zu: %s '%s'"), ctxt->filename, ctxt->l= ine, info, ctxt->cur); } else { - virReportErrorHelper(VIR_FROM_CONF, error, file, func, line, + virReportErrorHelper(VIR_FROM_CONF, error, VIR_ERR_ERROR, + file, func, line, "%s", info); } } diff --git a/src/util/virxml.c b/src/util/virxml.c index 998d974882..a5975e6665 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -37,7 +37,7 @@ #define VIR_FROM_THIS VIR_FROM_XML =20 #define virGenericReportError(from, code, ...) \ - virReportErrorHelper(from, code, __FILE__, \ + virReportErrorHelper(from, code, VIR_ERR_ERROR, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) =20 /* Internal data to be passed to SAX parser and used by error handler. */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489712667777.151462693716; Tue, 2 Oct 2018 07:15:12 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 5BD1630C6798; Tue, 2 Oct 2018 14:15:10 +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 1A3F8662DC; Tue, 2 Oct 2018 14:15:10 +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 A39254BB79; Tue, 2 Oct 2018 14:15:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EF77v020249 for ; Tue, 2 Oct 2018 10:15:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id E091A1C939; Tue, 2 Oct 2018 14:15:07 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1DDE26570 for ; Tue, 2 Oct 2018 14:15:06 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:41 +0200 Message-Id: <20181002141446.20943-3-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 2/7] util: Introduce virReportWarning() 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 02 Oct 2018 14:15:11 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This new macro can be used to conveniently report warnings, just like the existing virReportError() is used for errors. Signed-off-by: Andrea Bolognani --- src/util/virerror.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/virerror.h b/src/util/virerror.h index 6e089db0d0..308b49c604 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -189,6 +189,10 @@ void virReportOOMErrorFull(int domcode, virReportErrorHelper(VIR_FROM_THIS, code, VIR_ERR_ERROR, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) =20 +# define virReportWarning(code, ...) \ + virReportErrorHelper(VIR_FROM_THIS, code, VIR_ERR_WARNING, __FILE__, \ + __FUNCTION__, __LINE__, __VA_ARGS__) + # define virReportErrorObject(obj) \ virRaiseErrorObject(__FILE__, __FUNCTION__, __LINE__, obj) =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489722486713.6727038969042; Tue, 2 Oct 2018 07:15:22 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D6D3530833C2; Tue, 2 Oct 2018 14:15: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 8D5602C8B0; Tue, 2 Oct 2018 14:15:19 +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 3BEC8180BAD2; Tue, 2 Oct 2018 14:15:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EF97u020254 for ; Tue, 2 Oct 2018 10:15:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87F381C945; Tue, 2 Oct 2018 14:15:09 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80FA61C939 for ; Tue, 2 Oct 2018 14:15:08 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:42 +0200 Message-Id: <20181002141446.20943-4-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 3/7] tools: Print warnings in virsh 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 02 Oct 2018 14:15:21 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We delay dealing with actual errors until a later, more appropriate time in general, but if we wanted to do the same with warnings we'd have to introduce a lot of duplicated handling in virsh, so we just print them right away and move on with the usual processing instead. Signed-off-by: Andrea Bolognani --- tools/vsh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/vsh.c b/tools/vsh.c index 9ea3c4b96a..2ebd11d09f 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -242,6 +242,9 @@ vshErrorHandler(void *opaque ATTRIBUTE_UNUSED, { virFreeError(last_error); last_error =3D virSaveLastError(); + + if (last_error && last_error->level =3D=3D VIR_ERR_WARNING) + fprintf(stderr, "Warning: %s\n", NULLSTR(last_error->message)); } =20 /* Store a libvirt error that is from a helper API that doesn't raise erro= rs --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489718928734.0491767926553; Tue, 2 Oct 2018 07:15:18 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id E5F43A7E5; Tue, 2 Oct 2018 14:15:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9F97620BF; Tue, 2 Oct 2018 14:15:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 56FF818005AF; Tue, 2 Oct 2018 14:15:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EFBbt020268 for ; Tue, 2 Oct 2018 10:15:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id F3AD21C939; Tue, 2 Oct 2018 14:15:10 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 167F11C945 for ; Tue, 2 Oct 2018 14:15:09 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:43 +0200 Message-Id: <20181002141446.20943-5-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 4/7] util: Introduce VIR_ERR_DEPRECATED_FEATURE 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 02 Oct 2018 14:15:17 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This error code will be used whenever the user triggers execution of code that's been marked as deprecated. Signed-off-by: Andrea Bolognani --- include/libvirt/virterror.h | 1 + src/util/virerror.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 57aadb8d16..780270c4f2 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -323,6 +323,7 @@ typedef enum { VIR_ERR_DEVICE_MISSING =3D 99, /* fail to find the desired devi= ce */ VIR_ERR_INVALID_NWFILTER_BINDING =3D 100, /* invalid nwfilter binding= */ VIR_ERR_NO_NWFILTER_BINDING =3D 101, /* no nwfilter binding */ + VIR_ERR_DEPRECATED_FEATURE =3D 102, /* deprecated feature */ } virErrorNumber; =20 /** diff --git a/src/util/virerror.c b/src/util/virerror.c index 517e0bde28..f1ee47b309 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -1509,6 +1509,12 @@ virErrorMsg(virErrorNumber error, const char *info) else errmsg =3D _("Network filter binding not found: %s"); break; + case VIR_ERR_DEPRECATED_FEATURE: + if (info =3D=3D NULL) + errmsg =3D _("Deprecated feature"); + else + errmsg =3D _("Deprecated feature: %s"); + break; } return errmsg; } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489724037627.8886531253396; Tue, 2 Oct 2018 07:15:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06460804EB; Tue, 2 Oct 2018 14:15:22 +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 AFBCD607C9; Tue, 2 Oct 2018 14:15:21 +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 44921180BAD4; Tue, 2 Oct 2018 14:15:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EFCWn020275 for ; Tue, 2 Oct 2018 10:15:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80CD61C939; Tue, 2 Oct 2018 14:15:12 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95BBE26570 for ; Tue, 2 Oct 2018 14:15:11 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:44 +0200 Message-Id: <20181002141446.20943-6-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 5/7] Deprecate virConnectNumOfDomains() 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 02 Oct 2018 14:15:23 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In this case we want to deprecate the API wholesale, so we can simply report a warning in the public entry point. Signed-off-by: Andrea Bolognani --- src/libvirt-domain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 7690339521..a758539b6d 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -97,6 +97,11 @@ virConnectNumOfDomains(virConnectPtr conn) int ret =3D conn->driver->connectNumOfDomains(conn); if (ret < 0) goto error; + + virReportWarning(VIR_ERR_DEPRECATED_FEATURE, + "%s", + "virConnectNumOfDomains()"); + virDispatchError(conn); return ret; } =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489729696920.4406902050556; Tue, 2 Oct 2018 07:15:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6143E300187D; Tue, 2 Oct 2018 14:15: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 1EE995D6A6; Tue, 2 Oct 2018 14:15:27 +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 A6A5D4CAA0; Tue, 2 Oct 2018 14:15:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EFEMo020285 for ; Tue, 2 Oct 2018 10:15:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 124B026570; Tue, 2 Oct 2018 14:15:14 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22BAF1C939 for ; Tue, 2 Oct 2018 14:15:12 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:45 +0200 Message-Id: <20181002141446.20943-7-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 6/7] Deprecate missing machine type in virDomainDefineXMLFlags() 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 02 Oct 2018 14:15:28 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This time we don't want to deprecate the API itself; instead, we want warning to be reported whenever some specific condition is met. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 11 ++++++++--- src/libvirt-domain.c | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9911d56130..da0f1ed025 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19114,9 +19114,14 @@ virDomainDefParseCaps(virDomainDefPtr def, } else { if (!def->os.arch) def->os.arch =3D capsdata->arch; - if ((!def->os.machine && - VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) - goto cleanup; + if (!def->os.machine) { + virReportWarning(VIR_ERR_DEPRECATED_FEATURE, + "%s", + _("Missing machine type")); + + if (VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0) + goto cleanup; + } } =20 ret =3D 0; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index a758539b6d..be1a67d8f6 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -6216,6 +6216,7 @@ virDomainDefineXMLFlags(virConnectPtr conn, const cha= r *xml, unsigned int flags) ret =3D conn->driver->domainDefineXMLFlags(conn, xml, flags); if (!ret) goto error; + virDispatchError(conn); return ret; } =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538489727422365.31304831592763; Tue, 2 Oct 2018 07:15:27 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 92F611291; Tue, 2 Oct 2018 14:15:25 +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 4D2A8611CF; Tue, 2 Oct 2018 14:15:25 +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 DF4424CA95; Tue, 2 Oct 2018 14:15:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w92EFFOC020293 for ; Tue, 2 Oct 2018 10:15:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9229C1C939; Tue, 2 Oct 2018 14:15:15 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCD9C28D0B for ; Tue, 2 Oct 2018 14:15:14 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Oct 2018 16:14:46 +0200 Message-Id: <20181002141446.20943-8-abologna@redhat.com> In-Reply-To: <20181002141446.20943-1-abologna@redhat.com> References: <20181002141446.20943-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC 7/7] tools: Force virsh to use deprecated features 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 02 Oct 2018 14:15:26 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of trying newer APIs first and only falling back to deprecated ones if those are not available, go straight for the older APIs. Running 'virsh list' will now cause warnings to be displayed. Signed-off-by: Andrea Bolognani --- tools/virsh-domain-monitor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 3a2636377d..f2f2944a8a 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1609,6 +1609,8 @@ virshDomainListCollect(vshControl *ctl, unsigned int = flags) int mansave; virshControlPtr priv =3D ctl->privData; =20 + goto fallback; + /* try the list with flags support (0.9.13 and later) */ if ((ret =3D virConnectListAllDomains(priv->conn, &list->domains, flags)) >=3D 0) { --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list