On 11/13/2014 04:33 AM, Cédric Bosdonnat wrote:
> @@ -4667,6 +4671,58 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
>      return ret;
>  }
>  
> +static virDomainNetIpDefPtr
> +virDomainNetIpParseXML(xmlNodePtr node)
> +{
> +    /* Parse the prefix in every case */
> +    virDomainNetIpDefPtr ip = NULL;
> +    char *prefixStr = NULL;
> +    unsigned int prefixValue = 0;
> +    char *familyStr = NULL;
> +    int family = AF_UNSPEC;
> +    char *address = NULL;
> +
> +    if (!(prefixStr = virXMLPropString(node, "prefix")) ||
> +        (virStrToLong_ui(prefixStr, NULL, 10, &prefixValue) < 0)) {
> +        // Don't shout, just warn as some old config may not have a prefix
> +        VIR_WARN("Missing or invalid network prefix");

This warning is unnecessary. IPv6 address default to a prefix of 64 if
none is specified, and ipv4 addresses to 8, 16, or 24 depending on the
range of address you're in (this is specified in an RFC somewhere,
basically class A, B, and C networks), and it's quite common for the
default prefix to be the correct one. See the function
virSocketAddrGetIpPrefix() for details/example.


> -      <ip address='172.14.5.6'/>
> +      <ip address='172.14.5.6' family='ipv4'/>

Do we really want to automatically add the "ipv4" in there if it's not
there? That seems like unnecessary churn and verbosity in the config.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to