[pve-devel] [PATCH 3/3] add hotplug ip configuration

Alexandre DERUMIER aderumier at odiso.com
Fri Jun 26 17:01:51 CEST 2015


Hi,

>>I am not sure if you can update the IP configuration this way, because 
>>the correct way to do it is dependent on the OS. For example 
>>on debian I would expect something like this: 
>>
>># ifdown ethX 
>># rewrite config 
>># ifup ethX 

Well, we don't need to do ifdown/ifup to change ip address,
I already do it before in patch 2/3

lxc-attach -n container -s NETWORK -- /sbin/ip link ...

>From lxc doc:
https://linuxcontainers.org/fr/lxc/manpages/man1/lxc-attach.1.html
"Or, alternatively, use the -s to use the tools installed on the host outside the container:
lxc-attach -n container -s NETWORK -- /sbin/ip link delete eth1"

So it should work why any guest os.




Now, I don't known how/write the config. (maybe lxc-attach -- echo "...config" > /etc/network/interfaces )
I don't known if update config when container is running.

I don't have checked, but currently, if container is offline and we change ip address,
do you rewrite the guest network config when vm start? or only on vm_create ?


        
So I would move that code into the LXC setup classes (PVE/LXCSetup/*.pm). 
Or do you think that is not necessary? 


>>I am also thinking about adding a PVE/LXCSetup/CloudInit.pm class. This 
>>class is used for containers supporting cloud-init, and I think cloud-init 
>>has its own way to reconfigure network at runtime? 

I think we could rewrite cloud-init config with lxc-attach, and reexecute cloud-init with lxc-attach too.

But as I said, I can already change ip online easily. 

the difficult part is to manage different configuration from differents os,
but anyway on container creation we only support debian/redhat format ..

I'm pretty sure we can manage that without cloud-init.






----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "aderumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Vendredi 26 Juin 2015 16:49:38
Objet: Re: [pve-devel] [PATCH 3/3] add hotplug ip configuration

> fixme: 
> 
> -ip removal 
> -ipv6 support 
> -permanent guest file write config ? 

Hi Alexandre, 

very interesting patches! 

I am not sure if you can update the IP configuration this way, because 
the correct way to do it is dependent on the OS. For example 
on debian I would expect something like this: 

# ifdown ethX 
# rewrite config 
# ifup ethX 

So I would move that code into the LXC setup classes (PVE/LXCSetup/*.pm). 

Or do you think that is not necessary? 

I am also thinking about adding a PVE/LXCSetup/CloudInit.pm class. This 
class is used for containers supporting cloud-init, and I think cloud-init 
has its own way to reconfigure network at runtime? 



More information about the pve-devel mailing list