Code review comment for lp:~mpontillo/maas/lease-parser-ignore-free-leases--1.9

Revision history for this message
Mike Pontillo (mpontillo) wrote :

The way this code works is subtle. There is a difference between a "free" DHCP lease (free because it has not been renewed) and a "released" DHCP lease. And that difference is that when you don't explicitly release the address, you see something like:

lease 172.16.99.101 {
  starts 5 2017/02/03 02:05:01;
  ends 5 2017/02/03 02:05:31;
  tstp 5 2017/02/03 02:05:31;
  cltt 5 2017/02/03 02:05:01;
  binding state free;
  hardware ethernet 52:54:00:3d:e7:29;
}

So the lease is still valid, in truth, in the above case. (because it has not been renewed.) An explicitly released address will look like this:

lease 172.16.99.102 {
  starts 5 2017/02/03 02:06:06;
  cltt 5 2017/02/03 02:06:06;
  binding state free;
  hardware ethernet 52:54:00:8f:10:eb;
}

Notice that there is no 'ends' time.

So the root cause of the bug is: a free lease without an 'ends' time was considered an 'infinite' lease. This meant MAAS confusion*, because if IP address X was leased to host 'foo' and then explicitly released (and therefore did not have an 'ends' time, because the lease was cut short), and later host 'bar' leases IP address X, it will appear that two hosts have leased the same IP address. Ouch,

*: Bad pun, sorry.

« Back to merge proposal