← Back to team overview

maas-devel team mailing list archive

Re: Death to bootresources.yaml, Fit the Second

 

On 14/05/14 01:55, Graham Binns wrote:
> Hi all,
> 
> Now that the sprint's past, we can finish the removal of
> bootresources.yaml (see previous thread on this list on that topic).
> 
> I've been looking at how to replace it with a simple RPC-mesh API for
> the cluster to call, thus:
> 
>  1. cluster bootstraps

An important step here is that with the exception of the first
auto-accepted cluster, the user will configure the cluster at the same
time as accepting it.

>  2. User commands cluster to import images (via UI, CLI, etc.)
>  3. m-i-p-f runs on cluster, requests config from region

m-i-p-f is going to have to move to pserv if you want to use RPC.  A
quicker alternative would be to write an anonymous API method for the
existing script to query BootSelection.  At least I think it can be
anonymous, there's no special sekrit stuff in there.

(It might be that we haven't done enough RPC yet but it still feels like
it's quicker to write a new API method than an RPC method)

>  4. … time passes … things download …
>  5. … all proceeds as before [first iteration]
> 
> Now, in this admittedly simple first iteration we're shifting the
> knowledge of the boot resources from bootresources.yaml to the DB. We
> already have models for BootSource and BootSelection in the database;
> it's now a matter of putting a simple API in place and then hooking
> things up.
> 
> The simplest API I can think of looks like this:
> 
>   def get_boot_sources_for_cluster(uuid):
>       # Fetch sources for cluster from DB
>       # Convert to the same format as returned by a parsed bootresources.yaml
>       # Return
> 
> This doesn't provide *anything* other than a replacement for the
> config file. There's some obvious failure states we need to deal with:
> 
>  1. Region isn't up

Fail the job in this case, with a clear error.

>  2. Region doesn't recognise cluster as one of its own.

Same.

>  3. No boot sources for the cluster.

I don't think we should get into this state, because...

> My feeling for 3 is that right now we should just set a sane default
> for the boot source and then download the world, per Mark's
> preferences.

... I think this is dangerous.  We can avoid the state by always making
sure there's an explicit BootSelection set whenever a cluster is accepted.

> I've doubtless missed something with my simple-minded API above, so
> please tell me when you notice something.
> 
> I've started putting a branch together for the simple API; you can
> find it here: lp:~gmb/maas/boot-source-api
> 
> Cheers,
> 
> Graham

In summary, I suggest that you favour an API call over RPC because you
will need to Twistify the import script.  That will be harder than needs
be because the simplestreams library does not return Deferreds so you'll
end up deferring everything to threads, not to mention this is going to
take quite a while longer than just writing an anonymous API call for
the script to use.

Once we know the simple case works OK we can think about moving it to
Twisted code later.

J.


References