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

Re: [libvirt] [PATCH 5/5] guestfwd: Ensure guestfwd address is IPv4



On Wed, Nov 04, 2009 at 04:22:02PM +0000, Matthew Booth wrote:
> * src/conf/domain_conf.c: Throw an error if guestfwd address isn't IPv4
> ---
>  src/conf/domain_conf.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 94bce1e..ec2a1bc 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -1482,6 +1482,13 @@ virDomainChrDefParseXML(virConnectPtr conn,
>                          goto error;
>                      }
>  
> +                    if(def->target.addr->stor.ss_family != AF_INET) {

                       ^^^^  whitespace issue

> +                        virDomainReportError(conn, VIR_ERR_NO_SUPPORT, "%s",
> +                                             _("guestfwd channel only supports "
> +                                               "IPv4 addresses"));
> +                        goto error;
> +                    }
> +
>                      if(portStr == NULL) {
>                          virDomainReportError(conn, VIR_ERR_INVALID_DOMAIN, "%s",
>                                               _("guestfwd channel does "
> -- 

NO_SUPPORT isn't really the best error code to use here - that's intended
for public API calls which aren't implemented by a driver. 

Our reporting of XML configurations which aren't valid is pretty rubbish
as we don't have a standard error code - people have been making it up as
we go along.

I think we should add a new error code:

  VIR_ERR_CONFIG_UNSUPPORTED

whcih we can then standardize on for this kind of thing

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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