[libvirt] [PATCH] virsystemd: Fix error check

Commit b3e4401dc620 introduced a check to ignore an error if the guest is already terminated. However the check accidentally compared error.code with VIR_ERR_ERROR, which is an error level, not an error code. Because of this, almost every error got silently ignored. Fixes: b3e4401dc620 ("systemd: don't report an error if the guest is already terminated") Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- src/util/virsystemd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 7d6985b..604dcdd 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -468,7 +468,7 @@ int virSystemdTerminateMachine(const char *name) name) < 0) goto cleanup; - if (error.code == VIR_ERR_ERROR && + if (error.level == VIR_ERR_ERROR && STRNEQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine", error.str1)) { virReportErrorObject(&error); -- 2.5.5

On 05.08.2016 18:04, Marc Hartmayer wrote:
Commit b3e4401dc620 introduced a check to ignore an error if the guest is already terminated. However the check accidentally compared error.code with VIR_ERR_ERROR, which is an error level, not an error code. Because of this, almost every error got silently ignored.
Fixes: b3e4401dc620 ("systemd: don't report an error if the guest is already terminated")
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- src/util/virsystemd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 7d6985b..604dcdd 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -468,7 +468,7 @@ int virSystemdTerminateMachine(const char *name) name) < 0) goto cleanup;
- if (error.code == VIR_ERR_ERROR && + if (error.level == VIR_ERR_ERROR && STRNEQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine", error.str1)) { virReportErrorObject(&error);
Very nice catch! ACKed and pushed. Michal
participants (2)
-
Marc Hartmayer
-
Michal Privoznik