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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
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.

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]