Comment 3 for bug 1842896

Revision history for this message
Pedro GuimarĂ£es (pguimaraes) wrote :

Hi @jameinel, it was not clear but I can see what you mean now.
Indeed, a quick search for "compose" on Juju source code returns void, and any other similar reference.

Correct me if I am wrong, but MAAS provider is following this path:

Digging into Juju code, I can see machine allocation starts at:
https://github.com/juju/juju/blob/cfda560669d10ca1883d24292e2817243c8c9928/provider/maas/environ.go#L983
Which will eventually lead to:
https://github.com/juju/juju/blob/cfda560669d10ca1883d24292e2817243c8c9928/provider/maas/environ.go#L809

That is a call to your gomaasapi lib, which ends on:
https://github.com/juju/gomaasapi/blob/65f2e261f089fd379297df942bf12193bd300825/controller.go#L570

Which actually is calling allocate machine: POST /MAAS/api/2.0/machines/?op=allocate

Indeed, on MAAS source code, that call boils down to a logic where, if I cannot find an available machine, MAAS will try to boot a composed machine (VM) out of a Pod:
https://github.com/maas/maas/blob/5fe288985249afedadf4656b595238856b13ce4d/src/maasserver/api/machines.py#L2330
Which is exactly what I was looking for.

Regarding Juju logic, am I correct? Or is there any other path to allocate/create machines on MAAS provider?