Re: [PATCH libvirt] interface: don't error out if a bond has no interfaces

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

 



On 05/27/2015 01:30 PM, Lubomir Rintel wrote:
> It's not a problem at all and causes virt-manager to break down.
>
> Note: netcf 0.2.8 generates invalid XML for a bond with no interfaces anyway,
> so this error is in fact not reached as we fail earlier. Fix submitted upstream.

ACK.

This patch also makes bonds more consistent with bridges, which also
require the <bridge> element, but allow it to be empty.

Since this is a bugfix and straightforward, I'm pushing it now (after
adding a small bit to the commit log, and changing "ret" initialization
from 0 to -1, so that it's more in line with the rest of libvirt's
code), and will be looking at the netcf patch momentarily.

Thanks for taking the time to report this error with a patch :-)

>
> Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
> ---
>  src/conf/interface_conf.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
> index c2eb945..29769ac 100644
> --- a/src/conf/interface_conf.c
> +++ b/src/conf/interface_conf.c
> @@ -553,19 +553,15 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
>      nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
>      if (nbItf < 0) {
>          ret = -1;
> -        goto error;
> +        goto cleanup;
>      }
>  
> -    if (nbItf == 0) {
> -        virReportError(VIR_ERR_XML_ERROR,
> -                       "%s", _("bond has no interfaces"));
> -        ret = -1;
> -        goto error;
> -    }
> +    if (nbItf == 0)
> +        goto cleanup;
>  
>      if (VIR_ALLOC_N(def->data.bond.itf, nbItf) < 0) {
>          ret = -1;
> -        goto error;
> +        goto cleanup;
>      }
>      def->data.bond.nbItf = nbItf;
>  
> @@ -575,12 +571,12 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
>          if (itf == NULL) {
>              ret = -1;
>              def->data.bond.nbItf = i;
> -            goto error;
> +            goto cleanup;
>          }
>          def->data.bond.itf[i] = itf;
>      }
>  
> - error:
> + cleanup:
>      VIR_FREE(interfaces);
>      ctxt->node = bond;
>      return ret;

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