mirror of
				https://github.com/vdsm/virtual-dsm.git
				synced 2025-11-04 08:54:51 +08:00 
			
		
		
		
	feat: Persistant MAC address (#646)
This commit is contained in:
		
							parent
							
								
									8652544982
								
							
						
					
					
						commit
						5896928030
					
				@ -212,8 +212,14 @@ getInfo() {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [ -z "$VM_NET_MAC" ]; then
 | 
					  if [ -z "$VM_NET_MAC" ]; then
 | 
				
			||||||
 | 
					    local file="$STORAGE/dsm.mac"
 | 
				
			||||||
 | 
					    if [ -f "$file" ]; then
 | 
				
			||||||
 | 
					      VM_NET_MAC=$(<"$file")
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
      # Generate MAC address based on Docker container ID in hostname
 | 
					      # Generate MAC address based on Docker container ID in hostname
 | 
				
			||||||
      VM_NET_MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:11:32:\3:\4:\5/')
 | 
					      VM_NET_MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:11:32:\3:\4:\5/')
 | 
				
			||||||
 | 
					      echo "${VM_NET_MAC^^}" > "$file"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  VM_NET_MAC="${VM_NET_MAC^^}"
 | 
					  VM_NET_MAC="${VM_NET_MAC^^}"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user