mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	vr: remove old ips with same mac address in dhcpentry databag (#5059)
This PR fixes #5058 when start a vm, the old entries in databag for the vm (with same mac addresses) should be removed then set again, to avoid duplicated records in dhcpentry databag and also /etc/dhcphosts.txt Testing with Isolated networks: (1) stop vm, change vm ip address, start vm vm info is updated in /etc/dhcphosts.txt and /etc/cloudstack/dhcpentry.json (2) stop vm, expunge vm. vm is removed from /etc/dhcphosts.txt and /var/lib/misc/dnsmasq.leases Testing with VPC: (1) create vm in 2 vpc tiers vm has 2 entries in /etc/dhcphosts.txt, and /etc/cloudstack/dhcpentry.json (2) stop vm, change ip addresses, change nics order, start vm entries are updated in /etc/dhcphosts.txt and /etc/cloudstack/dhcpentry.json (3) remove a nic from vm (hot unplug) vm nic is removed from /etc/dhcphosts.txt and /var/lib/misc/dnsmasq.leases entry in /etc/cloudstack/dhcpentry.json is updated.
This commit is contained in:
		
							parent
							
								
									8c7e39eb89
								
							
						
					
					
						commit
						b25823213b
					
				| @ -28,7 +28,7 @@ def merge(dbag, data): | |||||||
|     else: |     else: | ||||||
|         remove_keys = set() |         remove_keys = set() | ||||||
|         for key, entry in dbag.iteritems(): |         for key, entry in dbag.iteritems(): | ||||||
|             if key != 'id' and entry['mac_address'] == data['mac_address'] and data['remove']: |             if key != 'id' and entry['mac_address'] == data['mac_address']: | ||||||
|                 remove_keys.add(key) |                 remove_keys.add(key) | ||||||
|                 break |                 break | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user