MAAS hostnames should be 5 easily disambiguated characters

Bug #1058998 reported by Mark Shuttleworth
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Raphaël Badin
Raphaël Badin

Bug Description

The MAAS hostnames should be 5 random letters from the set:


There are 25 letters, making for 9,765,625 combinations.

Something like:

>>> def pick_random_name():
... charset = 'abcdefghjkmnpqrtwxy346789'
... name = ''
... for l in range(5):
... name += random.choice(charset)
... return name

... then of course test to ensure the name is not used already before assigning it :)

Lookups of existing allocated names are fast - a straight lookup in the host table. At 100k node scale, with almost full utilisation, the odds of a collision are only 1 in 97. The odds of having to do more than 5 guesses are less than one in a million. So this will be fast even at scale and density.

Related branches

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 1058998] [NEW] MAAS hostnames should be 5 easily disambiguated characters

Another way of doing such allocation would be to hash the MAC address
and then use the hash mod 9,765,625 to index into the set of possible
names, resolving conflicts via a secondary hash and then linear
probing subsequent to that. This would have the minor advantage for
folk testing that they would end up with the same names on repeated
test runs.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Comments from someone who recently was in charge of a large farm of machines (I can't say who on a public bug) said that naming was important to them. So while I think this scheme is fine as a default, we still need to provide a useful API to create custom host names.

Changed in maas:
status: New → Triaged
importance: Undecided → High
Raphaël Badin (rvb)
Changed in maas:
assignee: nobody → Raphaël Badin (rvb)
status: Triaged → Fix Committed
Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1058998] Re: MAAS hostnames should be 5 easily disambiguated characters

Thanks Raph :)

Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints