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

Re: [libvirt] [PATCH 2/8] lxc: Cleanup improper VIR_ERR_NO_SUPPORT use



On Tue, Aug 23, 2011 at 05:39:39PM +0800, Osier Yang wrote:
> s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/
> 
> Special case is changes on lxcDomainInterfaceStats, if it's not
> implemented on the platform, prints error like:
> 
>     lxcError(VIR_ERR_OPERATION_INVALID, "%s",
>              _("interface stats not implemented on this platform"));
> 
> As the function is supported by driver actually, error like
> VIR_ERR_NO_SUPPORT is confused.
> ---
>  src/lxc/lxc_driver.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index a596945..5587b06 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -421,7 +421,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
>          goto cleanup;
>  
>      if ((def->nets != NULL) && !(driver->have_netns)) {
> -        lxcError(VIR_ERR_NO_SUPPORT,
> +        lxcError(VIR_ERR_OPERATION_INVALID,
>                   "%s", _("System lacks NETNS support"));
>          goto cleanup;
>      }
> @@ -728,7 +728,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
>      }
>  
>      if (driver->cgroup == NULL) {
> -        lxcError(VIR_ERR_NO_SUPPORT,
> +        lxcError(VIR_ERR_OPERATION_INVALID,
>                   "%s", _("cgroups must be configured on the host"));
>          goto cleanup;
>      }
> @@ -1710,7 +1710,7 @@ static int lxcDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
>      }
>  
>      if ((vm->def->nets != NULL) && !(driver->have_netns)) {
> -        lxcError(VIR_ERR_NO_SUPPORT,
> +        lxcError(VIR_ERR_OPERATION_INVALID,
>                   "%s", _("System lacks NETNS support"));
>          goto cleanup;
>      }
> @@ -1786,7 +1786,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
>          goto cleanup;
>  
>      if ((def->nets != NULL) && !(driver->have_netns)) {
> -        lxcError(VIR_ERR_NO_SUPPORT,
> +        lxcError(VIR_ERR_OPERATION_INVALID,
>                   "%s", _("System lacks NETNS support"));
>          goto cleanup;
>      }

These should be CONFIG_UNSUPPORTED


> @@ -2519,7 +2519,8 @@ static int
>  lxcDomainInterfaceStats(virDomainPtr dom,
>                          const char *path ATTRIBUTE_UNUSED,
>                          struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
> -    lxcError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
> +    lxcError(VIR_ERR_OPERATION_INVALID, "%s",
> +             _("interface stats not implemented on this platform"));
>      return -1;
>  }
>  #endif

NO_SUPPORT was correct here.

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 :|


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