[libvirt] [PATCH v2 2/2] Don't drop expired lease while reading custom leases file

Michal Privoznik mprivozn at redhat.com
Wed Oct 5 06:37:29 UTC 2016


On 03.10.2016 09:49, Michal Privoznik wrote:
> On 30.09.2016 17:11, Nehal J Wani wrote:
>> Libvirt, on its own, shouldn't decide whether an expired lease should
>> stay in the custom leases database or not. It should rather rely on
>> the 'DEL' event from dnsmasq.
>> ---
>>  src/util/virlease.c | 8 --------
>>  1 file changed, 8 deletions(-)
>>
>> diff --git a/src/util/virlease.c b/src/util/virlease.c
>> index 920ebaf..b49105d 100644
>> --- a/src/util/virlease.c
>> +++ b/src/util/virlease.c
>> @@ -57,7 +57,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
>>  {
>>      char *lease_entries = NULL;
>>      virJSONValuePtr leases_array = NULL;
>> -    long long currtime = 0;
>>      long long expirytime;
>>      int custom_lease_file_len = 0;
>>      virJSONValuePtr lease_tmp = NULL;
>> @@ -66,8 +65,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
>>      size_t i;
>>      int ret = -1;
>>  
>> -    currtime = (long long) time(NULL);
>> -
>>      /* Read entire contents */
>>      if ((custom_lease_file_len = virFileReadAll(custom_lease_file,
>>                                                  VIR_NETWORK_DHCP_LEASE_FILE_SIZE_MAX,
>> @@ -109,11 +106,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
>>                             _("failed to parse json"));
>>              goto cleanup;
>>          }
>> -        /* Check whether lease has expired or not */
>> -        if (expirytime < currtime) {
>> -            i++;
>> -            continue;
>> -        }
>>  
>>          /* Check whether lease has to be included or not */
>>          if (ip_to_delete && STREQ(ip_tmp, ip_to_delete)) {
>>
> 
> ACK
> 
> We are currently in the freeze preparing for the release. I'll keep this
> locally and push them after the release.

I've just pushed these.

Michal




More information about the libvir-list mailing list