lxc: improved way to handle with timeout in waitForNetwork.

Related to #398.
lxc: caching the method to get ip.