[libvirt] [PATCH 0/3] error: Introdude and use VIR_ERR_DEPRECATED error code

Peter Krempa (3): error: Add VIR_ERR_DEPRECATED error code qemu: Use VIR_ERR_DEPRECATED in QemuAttach and DomainXMLFromNative stubs news: Mention VIR_ERR_DEPRECATED in improvements docs/news.xml | 10 ++++++++++ include/libvirt/virterror.h | 1 + src/qemu/qemu_driver.c | 4 ++-- src/util/virerror.c | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) -- 2.21.0

Allow a simple programatic check that a given feature is no longer supported by introducing a separate error code for this scenario. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- include/libvirt/virterror.h | 1 + src/util/virerror.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 102a2573bf..22bc3c2d27 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -329,6 +329,7 @@ typedef enum { VIR_ERR_INVALID_NETWORK_PORT = 105, /* invalid network port object */ VIR_ERR_NETWORK_PORT_EXIST = 106, /* the network port already exist */ VIR_ERR_NO_NETWORK_PORT = 107, /* network port not found */ + VIR_ERR_DEPRECATED = 108, /* configuration or operation is no longer supported */ # ifdef VIR_ENUM_SENTINELS VIR_ERR_NUMBER_LAST diff --git a/src/util/virerror.c b/src/util/virerror.c index dfba8c5712..26f14ddd29 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -1235,6 +1235,10 @@ const virErrorMsgTuple virErrorMsgStrings[VIR_ERR_NUMBER_LAST] = { [VIR_ERR_NO_NETWORK_PORT] = { N_("network port not found"), N_("network port not found: %s") }, + [VIR_ERR_DEPRECATED] = { + N_("operation or configuration no longer supported"), + "%s", + }, }; -- 2.21.0

We've deprecated qemuConnectDomainXMLFromNative qemuDomainQemuAttach. Switch the error code from VIR_ERR_OPERATION_UNSUPPORTED to the new VIR_ERR_DEPRECATED. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ec08dd939e..d6ab134196 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7327,7 +7327,7 @@ qemuConnectDomainXMLFromNative(virConnectPtr conn, if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0) return NULL; - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + virReportError(VIR_ERR_DEPRECATED, "%s", _("converting arbitrary QEMU command lines to libvirt domain XML is no longer supported")); return NULL; } @@ -16779,7 +16779,7 @@ qemuDomainQemuAttach(virConnectPtr conn ATTRIBUTE_UNUSED, { virCheckFlags(0, NULL); - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + virReportError(VIR_ERR_DEPRECATED, "%s", _("attaching to a QEMU process started outside of libvirt is no longer supported")); return NULL; } -- 2.21.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 681e9a60a3..68f8c704b4 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -64,6 +64,16 @@ </change> </section> <section title="Improvements"> + <change> + <summary> + Add error code for deprecated operations + </summary> + <description> + The new error code VIR_ERR_DEPRECATED allows for more reliable checks + of scenarios where libvirt deprecated a certain operation or + configuration. + </description> + </change> </section> <section title="Bug fixes"> </section> -- 2.21.0

On Fri, Jun 21, 2019 at 08:33:51 +0200, Peter Krempa wrote:
Peter Krempa (3): error: Add VIR_ERR_DEPRECATED error code qemu: Use VIR_ERR_DEPRECATED in QemuAttach and DomainXMLFromNative stubs news: Mention VIR_ERR_DEPRECATED in improvements
docs/news.xml | 10 ++++++++++ include/libvirt/virterror.h | 1 + src/qemu/qemu_driver.c | 4 ++-- src/util/virerror.c | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-)
Ping? It makes most sense to push this in this release.

s/dude/duce/ in the subject On Fri, Jun 21, 2019 at 08:33:51AM +0200, Peter Krempa wrote:
Peter Krempa (3): error: Add VIR_ERR_DEPRECATED error code qemu: Use VIR_ERR_DEPRECATED in QemuAttach and DomainXMLFromNative stubs news: Mention VIR_ERR_DEPRECATED in improvements
docs/news.xml | 10 ++++++++++ include/libvirt/virterror.h | 1 + src/qemu/qemu_driver.c | 4 ++-- src/util/virerror.c | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Peter Krempa