[libvirt] [PATCH] util: set error if DAD is not finished

If DAD not finished in 5 seconds, user will get an unknown error like this: # virsh net-start ipv6 error: Failed to start network ipv6 error: An error occurred, but the cause is unknown Call virReportError to set an error. Signed-off-by: Luyao Huang <lhuang@redhat.com> --- I found the DAD will take 7 seconds on my machine, and i cannot create a network which use ipv6 now :( . Can we offer a way allow user to change this timeout ? maybe add a configuration file option in libvirtd.conf. src/util/virnetdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 9789e93..c8861e9 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1398,7 +1398,13 @@ virNetDevWaitDadFinish(virSocketAddrPtr *addrs, size_t count) VIR_FREE(resp); } /* Check timeout. */ - ret = dad ? -1 : 0; + if (dad) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("Duplicate Address Detection " + "not finished in %d seconds"), VIR_DAD_WAIT_TIMEOUT); + } else { + ret = 0; + } cleanup: VIR_FREE(resp); -- 1.8.3.1

On 10/29/2015 12:47 PM, Luyao Huang wrote:
If DAD not finished in 5 seconds, user will get an unknown error like this:
# virsh net-start ipv6 error: Failed to start network ipv6 error: An error occurred, but the cause is unknown
Call virReportError to set an error.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- I found the DAD will take 7 seconds on my machine, and i cannot create a network which use ipv6 now :( . Can we offer a way allow user to change this timeout ? maybe add a configuration file option in libvirtd.conf.
Could you please send the related records of your sysctl -a? Max DAD timeout should be rand() % net.ipv6.conf.default.router_solicitation_delay + net.ipv6.conf.default.dad_transmits * net.ipv6.neigh.default.retrans_time_ms I wonder whether my calculations were faulty or it is your specific configuration. -- Your sincerely, Maxim Perevedentsev

On 10/29/2015 08:32 AM, Maxim Perevedentsev wrote:
On 10/29/2015 12:47 PM, Luyao Huang wrote:
If DAD not finished in 5 seconds, user will get an unknown error like this:
# virsh net-start ipv6 error: Failed to start network ipv6 error: An error occurred, but the cause is unknown
Call virReportError to set an error.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- I found the DAD will take 7 seconds on my machine, and i cannot create a network which use ipv6 now :( . Can we offer a way allow user to change this timeout ? maybe add a configuration file option in libvirtd.conf.
Could you please send the related records of your sysctl -a? Max DAD timeout should be rand() % net.ipv6.conf.default.router_solicitation_delay + net.ipv6.conf.default.dad_transmits * net.ipv6.neigh.default.retrans_time_ms I wonder whether my calculations were faulty or it is your specific configuration.
On my system, these are set to 1, 1, and 1000, and I've found that DAD takes something between 5.7 and 6.8 seconds to complete (it was at the lower end with a single IP address, and at the high end with 70 IP addresses (or also with 20 IPs, so I don't think it's going to get substantially higher). (Too bad I didn't do this *before* I pushed, rather than relying on a successful build and reports of proper operation on your system :-/) Based on that, I think it makes sense to push a patch that sets the timeout to 20 seconds (and push Luyao's patch ragardless). Since the timeout is meant to catch an "infinite" wait, I think 20 seconds is okay; I don't want to add yet another tunable parameter unless we really need to. I'm pushing Luyao's patch now, but will wait for an ACK to push the patch I've attached here. Anyone?

On 10/29/2015 12:15 PM, Laine Stump wrote:
On my system, these are set to 1, 1, and 1000, and I've found that DAD takes something between 5.7 and 6.8 seconds to complete (it was at the lower end with a single IP address, and at the high end with 70 IP addresses (or also with 20 IPs, so I don't think it's going to get substantially higher). (Too bad I didn't do this *before* I pushed, rather than relying on a successful build and reports of proper operation on your system :-/)
Based on that, I think it makes sense to push a patch that sets the timeout to 20 seconds (and push Luyao's patch ragardless). Since the timeout is meant to catch an "infinite" wait, I think 20 seconds is okay; I don't want to add yet another tunable parameter unless we really need to.
I'm pushing Luyao's patch now, but will wait for an ACK to push the patch I've attached here. Anyone?
Looks reasonable to me, and safe for inclusion in the current release. ACK -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 10/30/2015 02:15 AM, Laine Stump wrote:
On 10/29/2015 08:32 AM, Maxim Perevedentsev wrote:
On 10/29/2015 12:47 PM, Luyao Huang wrote:
If DAD not finished in 5 seconds, user will get an unknown error like this:
# virsh net-start ipv6 error: Failed to start network ipv6 error: An error occurred, but the cause is unknown
Call virReportError to set an error.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- I found the DAD will take 7 seconds on my machine, and i cannot create a network which use ipv6 now :( . Can we offer a way allow user to change this timeout ? maybe add a configuration file option in libvirtd.conf.
Could you please send the related records of your sysctl -a? Max DAD timeout should be rand() % net.ipv6.conf.default.router_solicitation_delay + net.ipv6.conf.default.dad_transmits * net.ipv6.neigh.default.retrans_time_ms I wonder whether my calculations were faulty or it is your specific configuration.
On my system, these are set to 1, 1, and 1000, and I've found that DAD takes something between 5.7 and 6.8 seconds to complete (it was at the lower end with a single IP address, and at the high end with 70 IP addresses (or also with 20 IPs, so I don't think it's going to get substantially higher). (Too bad I didn't do this *before* I pushed, rather than relying on a successful build and reports of proper operation on your system :-/)
Based on that, I think it makes sense to push a patch that sets the timeout to 20 seconds (and push Luyao's patch ragardless). Since the timeout is meant to catch an "infinite" wait, I think 20 seconds is okay; I don't want to add yet another tunable parameter unless we really need to.
yes, change the timeout to 20 seconds is a good way to avoid this issue. I was trying to figure out why DAD take so long time on my machine. And thanks a lot for your quick review. Luyao

On 10/29/2015 08:32 PM, Maxim Perevedentsev wrote:
On 10/29/2015 12:47 PM, Luyao Huang wrote:
If DAD not finished in 5 seconds, user will get an unknown error like this:
# virsh net-start ipv6 error: Failed to start network ipv6 error: An error occurred, but the cause is unknown
Call virReportError to set an error.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- I found the DAD will take 7 seconds on my machine, and i cannot create a network which use ipv6 now :( . Can we offer a way allow user to change this timeout ? maybe add a configuration file option in libvirtd.conf.
Could you please send the related records of your sysctl -a? Max DAD timeout should be rand() % net.ipv6.conf.default.router_solicitation_delay + net.ipv6.conf.default.dad_transmits * net.ipv6.neigh.default.retrans_time_ms I wonder whether my calculations were faulty or it is your specific configuration.
I haven't change them before, and they are: net.ipv6.conf.default.router_solicitation_delay = 1 net.ipv6.conf.default.dad_transmits = 1 net.ipv6.neigh.default.retrans_time_ms = 1000 Thanks your quick reply. Luyao
participants (5)
-
Eric Blake
-
Laine Stump
-
lhuang
-
Luyao Huang
-
Maxim Perevedentsev