weizhouapache commented on a change in pull request #4529:
URL: https://github.com/apache/cloudstack/pull/4529#discussion_r540819877



##########
File path: systemvm/debian/opt/cloud/bin/cs/CsDhcp.py
##########
@@ -60,6 +61,9 @@ def process(self):
         if self.cloud.commit():
             restart_dnsmasq = True
 
+        if self.dhcp_leases.commit():
+            restart_dnsmasq = True

Review comment:
       > From what I could see at 
https://github.com/apache/cloudstack/blob/master/systemvm/debian/opt/cloud/bin/cs/CsFile.py#L58,
 a commit returns a boolean value of whether the file has changed, so if it 
tries to add a host which already exists in the file, it shouldn't restart 
dnsmasq
   
   @davidjumani from my testing, dnsmasq will be restarted each time when start 
a vm. it's better to reload it.
   ```
   2020-12-11 09:44:56,927 INFO     Processing JSON file 
vm_dhcp_entry.json.c0a11309-5ec0-4166-8c17-ae2c56a44b8e
   2020-12-11 09:44:57,244 INFO     Nothing to commit. The 
/etc/dnsmasq.d/cloud.conf file did not change
   2020-12-11 09:44:57,244 INFO     Wrote edited file 
/var/lib/misc/dnsmasq.leases
   2020-12-11 09:44:57,245 INFO     Attempting to delete entries from 
dnsmasq.leases file for VMs which are not on dhcphosts file
   2020-12-11 09:44:57,245 INFO     Deleted 0 entries from dnsmasq.leases file
   2020-12-11 09:44:57,245 INFO     Executing: systemctl restart dnsmasq
   2020-12-11 09:44:57,366 INFO     Service dnsmasq restart
   2020-12-11 09:44:58,253 INFO     Processing JSON file 
vm_metadata.json.250b5ba8-fd86-4dcb-86ef-2bc6c634d224
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to