Remove bootstrap instance warning, show details #6425

Merged
merged 2 commits into from Oct 11, 2016

Conversation

Projects
None yet
5 participants
Contributor

mjs commented Oct 11, 2016

The MAAS warning about selection of a default node during bootstrap has been removed and the arch, cores and memory for the bootstrap instance are now shown instead (for all providers).This is generally useful and also informs the user about instance selection decisions made by the provider.

Example output:

$ juju bootstrap G google 
Creating Juju controller "G" on google/us-east1
Looking for packaged Juju agent version 2.0.0 for amd64
No packaged binary found, preparing local Juju agent binary
Launching controller instance(s) on google/us-east1...
 - juju-3020c2-0 (arch=amd64 mem=1.7G cores=1)
...
$ juju bootstrap M maas2
Creating Juju controller "M" on maas2
Looking for packaged Juju agent version 2.0.0 for amd64
No packaged binary found, preparing local Juju agent binary
Launching controller instance(s) on maas2...
 - 4y3h7p (arch=amd64 mem=1G cores=1)
...    

QA

Have confirmed the new output is sensible using MAAS, AWS, GCE and LXD.

provider/maas: Nix default node selection warning
This is the most likely scenario so don't warn about it.

Part of the fix for https://bugs.launchpad.net/juju/+bug/1629194.

@mjs mjs changed the title from Replace bootstrap instance warning to Remove bootstrap instance warning, show details Oct 11, 2016

LGTM!

provider/common/bootstrap_test.go
+
+func (s *FormatHardwareSuite) TestNil(c *gc.C) {
+ s.check(c, nil, "")
+ s.check(c, &instance.HardwareCharacteristics{}, "")
@babbageclunk

babbageclunk Oct 11, 2016

Member

You could split this out into TestZero. The various zero tests below are all the same as this case anyway.

@mjs

mjs Oct 11, 2016

Contributor

Actually it's not the same. TestNil checks what happens when the *HardwareCharacteristics is nil and when there is an instance but all the field values are nil.

The other tests below checks what happens when the fields have a value but they point to the value's zero value.

To make things clearer, I might split up TestNil so that there's TestNil and TestFieldsNil.

@babbageclunk

babbageclunk Oct 12, 2016

Member

Oh, oops - of course.

+ return strings.Join(out, " ")
+}
+
+func formatMemory(m uint64) string {
@hoenirvili

hoenirvili Oct 11, 2016

Contributor

I think this code seems very familiar.
Check here: https://github.com/juju/juju/blob/master/instance/instance.go#L251

If we are here, instead of writing the same semantic functions to parse memory why not make one global one(move it to utils or smth) and use it in the entire codebase?

What's your thoughts?

@mjs

mjs Oct 11, 2016

Contributor

The code you link to is for parsing a memory size from a string to an integer. This code is about formatting a memory size (as an integer in megabytes) to a string expressing either megabytes or gigabytes with one decimal place of precision.

I see your point - and I did consider putting it in a more general location - but I think this function is fairly specialised for this use case (and given the 2.0 release cutoff I don't have time to create something more generic right now).

@@ -200,6 +201,31 @@ func BootstrapInstance(ctx environs.BootstrapContext, env environs.Environ, args
return result, selectedSeries, finalize, nil
}
+func formatHardware(hw *instance.HardwareCharacteristics) string {
@hoenirvili

hoenirvili Oct 11, 2016

Contributor

Check below comment.

provider/common: Show bootstrap instance details
Show the arch, memory and cores for the bootstrap instance in a format
similar to the Juju constraints format. This is generally useful and
also informs the user about instance selection decisions made by the
provider (especially MAAS).

Fixes https://bugs.launchpad.net/juju/+bug/1629194
Contributor

mjs commented Oct 11, 2016

$$merge$$

Contributor

jujubot commented Oct 11, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit e43b052 into juju:master Oct 11, 2016

@mjs mjs deleted the mjs:1629194-bootstrap-arch-handling branch Oct 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment