[libvirt] [PATCH 2/2] conf: Allow error reporting in virDomainDiskSourceIsBlockType

Martin Kletzander mkletzan at redhat.com
Mon Aug 3 14:19:38 UTC 2015


On Sat, Jul 18, 2015 at 07:43:10AM -0400, John Ferlan wrote:
>Rather than provide a somewhat generic error message when the API
>returns false, allow the caller to supply a "report = true" option
>in order to cause virReportError's to describe which of the 3 paths
>that can cause failure.
>
>Some callers don't care about what caused the failure, they just want
>to have a true/false - for those, calling with report = false should
>be sufficient.
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/conf/domain_conf.c  | 21 ++++++++++++++++++---
> src/conf/domain_conf.h  |  2 +-
> src/lxc/lxc_cgroup.c    |  2 +-
> src/lxc/lxc_driver.c    |  6 ++----
> src/qemu/qemu_command.c |  5 +----
> src/qemu/qemu_conf.c    |  6 +++---
> 6 files changed, 26 insertions(+), 16 deletions(-)
>
>diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
>index 81bb711..913e007 100644
>--- a/src/lxc/lxc_driver.c
>+++ b/src/lxc/lxc_driver.c
>@@ -4069,11 +4069,9 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
>         goto cleanup;
>     }
>
>-    if (!virDomainDiskSourceIsBlockType(def->src)) {
>-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>-                       _("Can't setup disk for non-block device"));
>+    if (!virDomainDiskSourceIsBlockType(def->src, false))

Even though some don't like this reporting booleans, I think this one
is used properly.

But you probably meant "true" in this hunk.

ACK with that changed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150803/137e48d3/attachment-0001.sig>


More information about the libvir-list mailing list