On Wed, 2017-10-04 at 16:13 -0700, Stephen Hemminger wrote:
> On Thu, 05 Oct 2017 00:20:28 +0200
> Thomas Haller <[email protected]> wrote:
> 
> > On Wed, 2017-10-04 at 11:07 -0700, Stephen Hemminger wrote:
> > > On Azure (and probably other VM environments), there is a desire
> > > to
> > > cause guest VM to renew DHCP
> > > lease in response to host infrastructure changes. These include
> > > things like spinning up
> > > lots of VM's then suspending them and later unfreezing them as
> > > needed. The other scenario
> > > is doing renew following migration.
> > > 
> > > The current kernel code has a hack to try and simulate link
> > > bounce,
> > > but it doesn't
> > > work very well and the old ISC DHCP client does nothing. Network
> > > manager might be
> > > able to do something better??  
> > 
> > Hi,
> > 
> > 
> > link bounce might not work with NetworkManager, in the current
> > form.
> > 
> > NM has a 5 seconds grace period, during which it ignores carrier
> > going
> > away. It does so because the link can go down unexpectedly for
> > unknown
> > reasons.
> > Actually, after NM changes the MTU, the 5 seconds are extended to
> > 10
> > seconds, because [1].
> > So, kernel would have to bounce the link for at least 10 seconds.
> > 
> > Then there is a setting ignore-carrier (`man NetworkManager.conf`).
> > That causes NM to totally ignore when the link goes down. That
> > setting
> > is quite common, for example on the package "NetworkManager-config-
> > server" enables it by default on RHEL.
> > 
> > Appart from the above obstacles, carrier going away causes the
> > active
> > connection to disconnect. Later, another (or the same) connection
> > may
> > autoconnect again. So, that sounds like what you requested, but I
> > don't
> > think it works well.
> > 
> > 
> > Thomas
> > 
> > 
> > [1] https://bugzilla.redhat.com/show_bug.cgi?id=1487702
> 
> One alternative would be to the hyper-v daemon (doing other services)
> could invoke a hook or script to request network manager do a renew?

Hi,

Yes, something like:

for D in $(nmcli -f STATE,DEVICE -t device | sed -n 's/^connected://p'); do
  nmcli device reapply "$D";
done


But with more effort, wouldn't it be great if the hypervisor could
somehow notify the system about this generically, so that all managers
(networkd, dhclient, etc) could independently pick up the request for
renewal of the lease?
Maybe there could be a new link ifi_flags "IFF_LOWER_CHANGED". NM would
see that the link has this flag set and interpret it as command to re-
do DHCP.
Maybe triggered via

  ip link set $DEV lower-changed

which would turn on the flag. The flag cannot be cleared from user
space, kernel will reset it automatically after a timeout (one
second?). That avoids multiple scripts racing to set/clear the flag.

That is similar to bouncing the link. But without hacking the carrier
flag, which already has another meaning.


best,
Thomas

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to