]> xenbits.xensource.com Git - libvirt.git/commitdiff
Don't drop expired lease while reading custom leases file
authorNehal J Wani <nehaljw.kkd1@gmail.com>
Fri, 30 Sep 2016 15:11:39 +0000 (15:11 +0000)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 5 Oct 2016 06:33:59 +0000 (08:33 +0200)
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.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virlease.c

index 920ebaf122dd58763e2dc472ab73116a15baf489..b49105d2fd12d06c46a66bca40b45abd258675b8 100644 (file)
@@ -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)) {