MAAS hostnames should be 5 easily disambiguated characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Raphaël Badin | ||
1.2 |
Fix Released
|
High
|
Raphaël Badin |
Bug Description
The MAAS hostnames should be 5 random letters from the set:
abcdefghjkmn
There are 25 letters, making for 9,765,625 combinations.
Something like:
>>> def pick_random_name():
... charset = 'abcdefghjkmnpq
... name = ''
... for l in range(5):
... name += random.
... 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
- Gavin Panella (community): Approve
-
Diff: 244 lines (+91/-47)4 files modifiedsrc/maasserver/forms.py (+1/-1)
src/maasserver/models/node.py (+37/-10)
src/maasserver/tests/test_api.py (+6/-3)
src/maasserver/tests/test_node.py (+47/-33)
- Raphaël Badin (community): Approve
-
Diff: 244 lines (+91/-47)4 files modifiedsrc/maasserver/forms.py (+1/-1)
src/maasserver/models/node.py (+37/-10)
src/maasserver/tests/test_api.py (+6/-3)
src/maasserver/tests/test_node.py (+47/-33)
- Andres Rodriguez (community): Approve
-
Diff: 31 lines (+23/-1)1 file modifieddebian/changelog (+23/-1)
Changed in maas: | |
assignee: | nobody → Raphaël Badin (rvb) |
status: | Triaged → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |
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.