[libvirt] [PATCH 5/5] qemu: Implement usernet address

Laine Stump laine at laine.org
Wed Sep 13 16:02:49 UTC 2017


On 09/13/2017 06:46 AM, Michal Privoznik wrote:
> On 09/12/2017 09:16 PM, Laine Stump wrote:
>> On 09/12/2017 05:32 AM, Michal Privoznik wrote:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=1075520
>>>
>>> +                /* QEMU needs some space to have
>>> +                 * some other 'hosts' on the network. */
>>> +                if ((hasIPv4 && ip->prefix > 27) ||
>>> +                    (hasIPv6 && ip->prefix > 120)) {
>>> +                    virReportError(VIR_ERR_XML_ERROR, "%s",
>>> +                                   _("prefix too long"));
>> You should also probably check for conflict with the addresses that are
>> automatically used by slirp for DNS, default route, dhcp server, etc.
>> (Although I *hate* needing to hard code stuff like that :-/)
> Do I? If the prefix allows sufficiently enough room for them then the
> defaults shouldn't clash. Or you mean checking against host's IPs? The
> defaults according to the qemu docs are as follows:
>
> host = x.x.x.2
> dhcpstart = x.x.x.15 - x.x.x.30
> dns = x.x.x.3
> smb = x.x.x.4
>

Right. So let's say the user requests x.x.x.3 for the IP - that would
conflict with the DNS server address.

I would really hate to have those specific checks hardcoded though (in
case qemu changed the addresses for some reason. Maybe if we're lucky,
qemu itself will error out if there is a conflict. If that's the case,
then we can just leave it to them to report the error (as long as we're
able to adequately scrape the error message so we can report something
sensible).




More information about the libvir-list mailing list