[lxc-devel] [PATCH] lxc-net: switch After target to network-online.target

Ryan Harper ryan.harper at canonical.com
Wed Oct 28 14:35:51 UTC 2015


* Serge Hallyn <serge.hallynatubuntu.com> [2015-10-27 20:05]:
> Otherwise it may start too early and end up taking 10.0.3.1 even
> though eth0 was eventually going to end up on 10.0.3.x.
> 
> https://bugs.launchpad.net/juju-core/+bug/1510619
> 
> Reported-by: Ryan Harper <ryan.harper at ubuntu.com>
> Cc: Martin Pitt <martin.pitt at ubuntu.com>
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> ---
>  config/init/systemd/lxc-net.service.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/config/init/systemd/lxc-net.service.in b/config/init/systemd/lxc-net.service.in
> index 0467c0f..1b8ef99 100644
> --- a/config/init/systemd/lxc-net.service.in
> +++ b/config/init/systemd/lxc-net.service.in
> @@ -1,6 +1,6 @@
>  [Unit]
>  Description=LXC network bridge setup
> -After=network.target
> +After=network-online.target
>  Before=lxc.service

This was discovered on a trusty host (x86-64):

# lxc package sets up an lxcbr0 @ 10.0.3.1
1. sudo apt-get install lxc uvtool uvtool-libvirt 
2. uvt-simplestreams-libvirt --verbose sync release=wily arch=amd64
3. uvt-kvm create --memory 1024 --cpu 1 --disk 20 --bridge lxcbr0 \
                  --password mypass wily-test-lxc release=wily 

4. virsh console wily-test-lxc
5. login (ubuntu/mypass)
6. ifconfig lxcbr0 


To test the above with (after completing 1-6)

1. modify /lib/systemd/system/lxc-net.service with the above change
2. sudo systemctl daemon-reload
3. sudo rm -f /etc/default/lxc-net
4. sudo rm -rf /var/lib/cloud/instances/*
5. sudo reboot

After rebooting and logging in:

1. ifconfig lxcbr0 

This time lxcbr0 is on 10.0.4.1 instead.


Tested-by: Ryan Harper <ryan.harper at canonical.com>

-- 
Ryan Harper
Canonical, Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20151028/871cd1ad/attachment.sig>


More information about the lxc-devel mailing list