If the running firewalld doesn't support getPolicies() then we fallback to the "libvirt" zone. Throwing an error log is excessive since we gracefully fallback. Avoids these logs: error : virGDBusCallMethod:242 : error from service: \ GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod Fixes: ab56f84976e0 ("util: add virFirewallDGetPolicies()") Signed-off-by: Eric Garver <eric@xxxxxxxxxxx> --- src/util/virfirewalld.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c index ad879164c3a8..d11e974cc2d5 100644 --- a/src/util/virfirewalld.c +++ b/src/util/virfirewalld.c @@ -240,6 +240,7 @@ virFirewallDGetPolicies(char ***policies, size_t *npolicies) GDBusConnection *sysbus = virGDBusGetSystemBus(); g_autoptr(GVariant) reply = NULL; g_autoptr(GVariant) array = NULL; + g_autoptr(virError) error = NULL; *npolicies = 0; *policies = NULL; @@ -247,10 +248,12 @@ virFirewallDGetPolicies(char ***policies, size_t *npolicies) if (!sysbus) return -1; + error = g_new0(virError, 1); + if (virGDBusCallMethod(sysbus, &reply, G_VARIANT_TYPE("(as)"), - NULL, + error, VIR_FIREWALL_FIREWALLD_SERVICE, "/org/fedoraproject/FirewallD1", "org.fedoraproject.FirewallD1.policy", @@ -258,6 +261,12 @@ virFirewallDGetPolicies(char ***policies, size_t *npolicies) NULL) < 0) return -1; + if (error->level == VIR_ERR_ERROR) { + if (!virGDBusErrorIsUnknownMethod(error)) + virReportErrorObject(error); + return -1; + } + g_variant_get(reply, "(@as)", &array); *policies = g_variant_dup_strv(array, npolicies); -- 2.37.3