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>
This commit is contained in:
Luyao Huang 2015-10-29 17:47:33 +08:00 committed by Laine Stump
parent 7c8250d765
commit d41a64a194

View File

@ -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);