The trouble with EnvironProvider.InstanceId()

William Reade william.reade at canonical.com
Fri Mar 15 09:12:41 UTC 2013


On Fri, 2013-03-15 at 08:56 +0000, roger peppe wrote:
> > There's this new method on the EnvironProvider interface: InstanceId().
> >  It's meant to return the InstanceId of the machine it's being executed on.
> >
> > This is problematic for us.  In order to know the instance id, we need
> > to know what MAAS we're talking to.  The Environ would know that, but
> > definitely not the EnvironProvider.  The EC2 provider does not have this
> > problem because there, the address of the meta-data service is
> > hard-coded as a global constant.

Hmm, I made that change on the understanding that the MAAS instance id
was written to disk (er, *somewhere*) in a reliable way. Was that belief
not accurate?

> > Ian suggests that with a bit of refactoring, perhaps the call to
> > InstanceId() could be delayed, so that it could live in Environ instead
> > of EnvironProvider.  Would that be a possibility?

This does fit neatly with roger's suggestion below, and there aren't any
other clients.

> For instance, the first time an Environ becomes valid after the
> provisioner has started, it could check that machine 0 is unassigned
> and, if so, assign it the current instance (obtained with
> Environ.CurrentInstanceId),
> before continuing as usual.
> 
> It's not as nice as the current solution (what's that bootstrap-specific code
> doing in provisioner?!) but seems like it would work ok as long as we
> have at most one bootstrap machine, something I suspect is unlikely
> to change, even in a HA world.

The alternative perspective, to which I am sympathetic, is that this
"bootstrap-specific" code is just as much provisioner-specific, in that
its core purpose is to prevent the provisioner from going crazy. A
couple of us discussed this in Atlanta, and there seemed to be rough
agreement that it was a reasonable approach.

> The other possibility, probably not even worth mentioning, is to send
> the provider keys in the bootstrap machine's cloudinit, thus making
> it possible for the bootstrap machine to create an Environ and find the
> current instance id before bootstrapping the state.

I would prefer that we not do this.

Cheers
William




More information about the Juju-dev mailing list