On Wed, Jan 21, 2015 at 03:15:31PM +0100, Ján Tomko wrote:
On 01/19/2015 02:36 PM, Daniel P. Berrange wrote:
> The virDBusMethodCall method has a DBusError as one of its
> parameters. If the caller wants to pass a non-NULL value
> for this, it immediately makes the calling code require
> DBus at build time. This has led to breakage of non-DBus
> builds several times. It is desirable that only the virdbus.c
> file should need WITH_DBUS conditionals, so we must ideally
> remove the DBusError parameter from the method.
>
> We can't simply raise a libvirt error, since the whole point
> of this parameter is to give the callers a way to check if
> the error is one they want to ignore, without having the logs
> polluted with an error message. So, we add a virErrorPtr
> parameter which the caller can then either ignore or raise
> using virSetError.
>
> Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
> ---
> src/util/virdbus.c | 31 +++++++++++++++++++------------
> src/util/virdbus.h | 4 ++--
> src/util/virfirewall.c | 29 ++++++-----------------------
> src/util/virsystemd.c | 15 +++++++--------
> 4 files changed, 34 insertions(+), 45 deletions(-)
>
> @@ -820,11 +808,9 @@ virFirewallApplyRuleFirewallD(virFirewallRulePtr rule,
> */
> if (ignoreErrors) {
> VIR_DEBUG("Ignoring error '%s': '%s'",
> - error.name, error.message);
> + error.str1, error.message);
> } else {
> - virReportError(VIR_ERR_INTERNAL_ERROR,
> - _("Unable to apply rule '%s'"),
> - error.message);
> + virSetError(&error);
If ignoreErrors is false, we should be reporting the error, not just setting
it. virRaiseErrorFull seems to be the only virError call writing to the log.
Oh, hmm, yes that is a problem.
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|