MAAS hostnames should be 5 easily disambiguated characters

Bug #1058998 reported by Mark Shuttleworth on 2012-09-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
High
Raphaël Badin
1.2
High
Raphaël Badin

Bug Description

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

   abcdefghjkmnpqrtwxy346789

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

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.

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) on 2012-11-14
Changed in maas:
assignee: nobody → Raphaël Badin (rvb)
status: Triaged → Fix Committed
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