
On 08/21/2013 07:12 AM, Peter Krempa wrote:
Re-arrange the code so that the returned bitmap is always initialized to NULL even on early failures and return an error message as some callers are already expecting it. Fix up the rest not to shadow the error. ---
Version 2: - squashed cleanup of callers into this patch
po/POTFILES.in | 1 + src/conf/domain_conf.c | 5 +---- src/conf/network_conf.c | 3 --- src/nodeinfo.c | 5 +---- src/qemu/qemu_driver.c | 2 -- src/util/virbitmap.c | 18 +++++++++--------- src/xenxs/xen_sxpr.c | 5 +---- tests/cpuset | 2 +- 8 files changed, 14 insertions(+), 27 deletions(-)
error: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to parse bitmap '%s'"), str); virBitmapFree(*bitmap); *bitmap = NULL;
+++ b/tests/cpuset @@ -42,7 +42,7 @@ sed "s/vcpu placement='static'>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1 $abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1 cat <<\EOF > exp || fail=1 error: Failed to define domain from xml-invalid -error: XML error: topology cpuset syntax error +error: internal error: Failed to parse bitmap 'aaa'
Ugg - I don't like easy-to-trigger user-visible error messages that state "internal error". I think VIR_ERR_INVALID_ARG works better. ACK with that tweak. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org