Fix lease return logic. #17

Merged
merged 1 commit into from Feb 26, 2012

Projects

None yet

2 participants

Contributor
ody commented Feb 8, 2012

Identified that the logic that the last lease in the file wins when
it is actually the last lease to expire. This requires we sort the
list of end times and select that last one.

Contributor
ody commented Feb 8, 2012

This request feels a bit like a 'ah duh' moment. When I previous identified that it was the last in the lease file it was a coincidence. Would be cool if someone else could test this real quick since I didn't can't this the first time around.

Owner
thbishop commented Feb 9, 2012

@ody,

Can you post a gist of your leases file? I think I may be missing something as I can't seem to manually reproduce this.

Thanks.

Contributor
ody commented Feb 16, 2012

https://gist.github.com/1846011

Macaddress 00:0c:29:1d:6f:c8 first appears at the top with an expiry of 2012/01/30 with an IP of 172.16.210.142, same macaddress again at the bottom expires 2012/02/08. Before my original change fission would have returned the old address and my VM would have gotten the later expiry one. In the specific gist my first change would have been sufficient but I have ran into a couple situations where the entries are reversed, the later expiry being at the top, which by happenstance would work the way the code originally was but obviously the way the code originally was puts me in the situation I am trying to avoid, fission saying my ip is actually one that has either expired or expires sooner than the ip I do have.

I think I maybe seeing this behavior because I use fusion/fission more like Vagrant/$cloudprovider so I am cloning and destroying vm sometimes several times a day.

@ody ody Fix lease return logic.
  Identified that the logic that the last lease in the file wins when
  it is actually the last lease to expire.  This requires we sort the
  list of end times and select that last one.
0a46bab
@thbishop thbishop merged commit 98e2231 into thbishop:master Feb 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment