Bug #5589
closed
auto-generated hostnames fail w/ libvirt dhcp
Added by Scott Seago about 11 years ago.
Updated about 11 years ago.
Description
The auto-generated hostnames for discovery are hex numbers that often begin with a digit. Libvirt dhcp can't handle hostnames that begin with a digit, so the discovery hostnames need to be prefixed with one or more letters.
Hey,
I wrote a tiny little concept of pronouncable MAC addresses, something like:
ruby -Ilib bin/pmac 3c:97:0e:b1:3e:b7
nahedimonino
The string will be longer, there's a bug in the code I need to solve eventually. If I count right, it will be twice as long :-( That's maybe too much, but I want not to drop bits, it must be 1:1 mapping. I could make this optional in Foreman, the question is - would you like the idea?
cat lib/pmac.rb
class PMAC
# source sets
VOWELS = 'aeiouy'
CONSONANTS = 'bcdfghjklmnpqrstvwxz'
PAIRS = CONSONANTS.split('').product(VOWELS.split('')).collect{|a,b| a+b} * 2
def initialize mac
@mac = mac
end
def pmac
@mac.split(/[:-]/).collect{|x| x.to_i(16)}.collect{|c| PAIRS[c.ord]}.join('')
end
end
- Status changed from New to Ready For Testing
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Also available in: Atom
PDF