[libvirt-users] How to ifup nic automaticly after hotplug nic for lxc

Hi experts, When I hotplug nic into lxc, the nic in lxc seemed to be down status as following: 1224: vnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether fa:16:3e:fc:e5:96 brd ff:ff:ff:ff:ff:ff It seems mechanism such as udev is needed here. But I found udev is not supported well in lxc. So how can I get a 'up' nic after hotplug into lxc ? Very appreciate for your help. Jackie

On Tue, Sep 08, 2015 at 05:41:14PM +0800, Jackie wrote:
Hi experts,
When I hotplug nic into lxc, the nic in lxc seemed to be down status as following:
1224: vnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether fa:16:3e:fc:e5:96 brd ff:ff:ff:ff:ff:ff
It seems mechanism such as udev is needed here. But I found udev is not supported well in lxc. So how can I get a 'up' nic after hotplug into lxc ?
Correct, there is no udev support in LXC. In very recent versions of LXC, libvirt will let you define IP address info in the XML and if that is present, then it will ifup the NIC for you. If you need DHCP instead of static addressing though, there is no easy way to address this. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Got it. Thanks 在 2015年09月08日 18:09, Daniel P. Berrange 写道:
On Tue, Sep 08, 2015 at 05:41:14PM +0800, Jackie wrote:
Hi experts,
When I hotplug nic into lxc, the nic in lxc seemed to be down status as following:
1224: vnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether fa:16:3e:fc:e5:96 brd ff:ff:ff:ff:ff:ff
It seems mechanism such as udev is needed here. But I found udev is not supported well in lxc. So how can I get a 'up' nic after hotplug into lxc ? Correct, there is no udev support in LXC.
In very recent versions of LXC, libvirt will let you define IP address info in the XML and if that is present, then it will ifup the NIC for you. If you need DHCP instead of static addressing though, there is no easy way to address this.
Regards, Daniel
participants (2)
-
Daniel P. Berrange
-
Jackie