Merge lp:~rvb/gwacl/random-initializers into lp:gwacl
Proposed by
Raphaël Badin
Status: | Merged |
---|---|
Approved by: | Raphaël Badin |
Approved revision: | 175 |
Merged at revision: | 174 |
Proposed branch: | lp:~rvb/gwacl/random-initializers |
Merge into: | lp:gwacl |
Diff against target: |
75 lines (+40/-2) 3 files modified
example/management/run.go (+2/-2) names.go (+30/-0) names_test.go (+8/-0) |
To merge this branch: | bzr merge lp:~rvb/gwacl/random-initializers |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella | Approve | ||
Review via email: mp+173935@code.launchpad.net |
Commit message
Add MakeRandomRoleName and MakeRandomDiskName.
Description of the change
We need random role names and disk names in the provider. The Azure doc isn't very clear about the limitation here so rather than putting the knowledge of what these identifiers should look like inside the Azure provider, it's much better to have methods to get random names in gwacl.
The testing is minimal (I'm basically only checking that the methods return a non-empty string) but it's probably enough given the nature of the tested methods.
To post a comment you must log in.
Looks good.
[1]
+ // Azure documentation does not say what the maximum size of a disk name ifier(prefix, 50)
+ // is. Testing indicate that 50 works.
+ return makeRandomIdent
That's a lot of randomness. If prefix is, say, 10 chars long, then
this can produce ~1.8e62 different strings. A 128 bit hash (or IPv6
address, for example) only has ~3.4e38 different values.
It would also be good to have a character, like a hyphen, between the
prefix and the random part, although we could just suggest that as a
convention for callers.