[libvirt] [PATCH] Various error reporting fixes

Daniel Veillard veillard at redhat.com
Tue Nov 3 20:38:49 UTC 2009


On Mon, Nov 02, 2009 at 02:44:13PM -0500, Cole Robinson wrote:
> - Don't duplicate SystemError
> - Use proper error code in domain_conf
> - Fix a broken error call in qemu_conf
> - Don't use VIR_ERR_ERROR in security driver (isn't a valid code in this case)
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/conf/domain_conf.c           |    2 +-
>  src/conf/storage_conf.c          |    6 +++---
>  src/qemu/qemu_conf.c             |    6 ++----
>  src/qemu/qemu_driver.c           |    2 +-
>  src/security/security_apparmor.c |   30 +++++++++++++++---------------
>  src/security/security_driver.c   |    2 +-
>  src/security/security_selinux.c  |   10 +++++-----
>  src/xen/xen_hypervisor.c         |    4 +---
>  tests/cpuset                     |    2 +-
>  9 files changed, 30 insertions(+), 34 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ba6b28d..ca141e1 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3705,7 +3705,7 @@ virDomainCpuSetParse(virConnectPtr conn, const char **str, char sep,
>      return (ret);
>  
>    parse_error:
> -    virDomainReportError(conn, VIR_ERR_XEN_CALL,
> +    virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
>                           "%s", _("topology cpuset syntax error"));
>      return (-1);

  Whoops :-) very confusing !


> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 0470315..e8606c8 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -1773,7 +1773,7 @@ static int qemuDomainSetHostdevOwnership(virConnectPtr conn,
>      }
>      return 0;
>  #else
> -    qemudReportError(conn, NULL, NULL, "%s",
> +    qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
>                       _("unable to set host device ownership on this platform"));
>      return -1;

  good one too apparently nobody compiled this outside of linux.

   Very nice cleanup patch ACK !

   we should really get rid of all those ebuf[1024] scattered around,
or more precisely track all calls to virStrerror() and get that to only
a few in the centralized system erro routines:

paphio:~/libvirt -> grep virStrerror */*.c */*/*.c | wc -l
74

  but that's a very good first step :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list