Code review comment for lp:~dave-cheney/pyjuju/go-provisioning-strawman

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

https://codereview.appspot.com/6250068/diff/5004/cmd/jujud/provisioning.go
File cmd/jujud/provisioning.go (right):

https://codereview.appspot.com/6250068/diff/5004/cmd/jujud/provisioning.go#newcode37
cmd/jujud/provisioning.go:37: st, err := state.Open(&a.Conf.StateInfo)
On 2012/06/01 01:58:27, dfc wrote:
> > What happens if the connection is broken? We'll need to reestablish
it and
> > restart from the beginning, since all the assumptions are now wrong.
Maybe
> this
> > has to be moved into the outer loop or something. Will leave details
with you
> at
> > this point.

> I looked into this more this morning and it looks like if the
underlying
> connection to ZK is interrupted then the c client reconnects behind
the scenes.
> I tested this by running the PA, then shutting down zk, then starting
it again a
> minute later. None of the watchers exited.

> I'm going to keep playing with this, but at this point, if gozk never
reports an
> error when it cant talk to the zk server, I can't think of a way to
detect
> connection failure.

We've covered this on juju-dev@. A TODO would be good here as well.

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go
File cmd/jujud/provisioning.go (right):

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode56
cmd/jujud/provisioning.go:56: // environChanges returns a channel that
will receive the new *ConfigNode
As we discussed, that logic can be simplified as we can bubble up onto
the top from any hiccups, rather than retrying in place. I'm happy both
for this branch to be changed to cover that, or for it to be integrated
with these and then refactored. I'll comment in-place and let the
decision with you.

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode57
cmd/jujud/provisioning.go:57: // when a change is detected.
// when a change in the environment configuration is detected.

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode65
cmd/jujud/provisioning.go:65: // stopEnvironWatcher stops and
invalidates the current environWatcher.
s/and invalidates//

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode69
cmd/jujud/provisioning.go:69: log.Printf("provisioning: environWatcher
reported error on Stop: %v", err)
This is Printf rather than Debugf, so we need to be a bit nicer to the
user (no method and field names). Something like this might do:

"environment configuration watcher: %v"

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode76
cmd/jujud/provisioning.go:76: // changes returns a channel that will
receive the new *ConfigNode when a
Needs updating.

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode89
cmd/jujud/provisioning.go:89: log.Printf("provisioning: machinesWatcehr
reported error on Stop: %v", err)
"machines watcher: %v"

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode107
cmd/jujud/provisioning.go:107: // TODO(dfc) we need a method like
state.IsValid() here to exit cleanly if
IsConnected?

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode116
cmd/jujud/provisioning.go:116: continue
This should return an error.. it won't help to continue here. The state
will be broken.

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode121
cmd/jujud/provisioning.go:121: log.Printf("provisioner: unable to create
environment from supplied configuration: %v", err)
"provisioner loaded invalid environment configuration: %v"

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode124
cmd/jujud/provisioning.go:124: log.Printf("provisioner: valid
environment configured")
"provisioner loaded new environment configuration"

We spent a good while in London fiddling with messages and trying to
imagine how the actual error and log messages look like with prefixes,
and the conclusion we got to is that it doesn't really improve much the
understanding, and that we've been terribly inconsistent so far. The
agreement we're trying to get to (which still accepts input) is being a
bit more clear in the messages themselves.

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode133
cmd/jujud/provisioning.go:133: // TODO(dfc) we need a method like
state.IsValid() here to exit cleanly if
IsConnected?

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode142
cmd/jujud/provisioning.go:142: return fmt.Errorf("environWatcher
closed")
"environment configuration watcher was closed"

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode146
cmd/jujud/provisioning.go:146: log.Printf("provisioner: new
configuration received, but was not valid: %v", err)
"provisioner loaded invalid environment configuration: %v"

https://codereview.appspot.com/6250068/diff/16001/cmd/jujud/provisioning.go#newcode150
cmd/jujud/provisioning.go:150: log.Printf("provisioner: new environment
configuartion applied")
"provisioner loaded new environment configuration"

https://codereview.appspot.com/6250068/

« Back to merge proposal