Raphaël and I discussed two options:

1. Render the preseed in the cluster.

2. Send the cluster address to the region during start-up so that it
   can render the preseed with the correct address.

We decided that #1 better divides responsibilities, but that we would
go for option #2 for two reasons: it's a lot less work, and it doesn't
preclude doing #1 at a later date and may be useful to that effort.

I made some notes about what it would take to do #1, included below,
which may be worth tracking as a blueprint (Julian, what is the best
way to propose work like this?).


.. -*- mode: rst -*-

Things needed from the region to render a preseed:
==================================================

- From ``maasserver.compose_preseed``:

  - Metadata URL: ``absolute_reverse('metadata')``
  - Token: ``NodeKey.objects.get_token_for_node(node)``
  - Node status: ``node.status`` (only if commissioning or not)

- From ``maasserver.preseed``:

  - Node status: ``node.status`` (only if commissioning or not)

  - Enum ``PRESEED_TYPE``.

    ⇒ Move to ``provisioningserver``?

  - Setting ``PRESEED_TEMPLATE_LOCATIONS``.

    ⇒ Move to ``provisioningserver``.

  - Config:

     - ``commissioning_distro_series``
     - ``main_archive``
     - ``ports_archive``
     - ``http_proxy``

    ⇒ Can be obtained via API.

  - Server host: ``get_maas_facing_server_host`` (used for?)

    ⇒ Already known on cluster?

  - Server URL: ``absolute_reverse('nodes_handler')`` (used for?)

    ⇒ Already known on cluster?

  - Enlistment URL: ``absolute_reverse('enlist')``

  - Disable netboot URL::

      absolute_reverse(
          'metadata-node-by-id',
          args=['latest', node.system_id])

  - Enlistment preseed URL::

      absolute_reverse(
          'metadata-enlist-preseed', args=[version],
          query={'op': 'get_enlist_preseed'})

    ⇒ Becomes responsibility of ``provisioningserver``.

  - Regular preseed URL::

      absolute_reverse(
          'metadata-node-by-id', args=[version, node.system_id],
          query={'op': 'get_preseed'})

    ⇒ Becomes responsibility of ``provisioningserver``.

- From ``contrib/preseeds_v2/generic``:

  - Node architecture: ``node.architecture``


Which boils down to:
--------------------

Code moves (see below_) and a view that returns:

- Metadata URL: ``absolute_reverse('metadata')``

- Token: ``NodeKey.objects.get_token_for_node(node)``

- Node status: ``node.status`` (only if commissioning or not)

- Node architecture: ``node.architecture``

- Enlistment URL: ``absolute_reverse('enlist')``

- Disable netboot URL::

    absolute_reverse(
        'metadata-node-by-id', args=['latest', node.system_id])

- *Optional:* return config items (e.g. ``ports_archive``)

.. _below: `Adding rendering server to the provisioning server:`_


Adding rendering server to the provisioning server:
===================================================

- Resurrect HTTP server in ``provisioningserver.plugin``.

- Move code, as detailed earlier_, to ``provisioningserver``, and
  perform some moderate refactoring.

- Add handler to the ``provisioningserver`` HTTP server to query the
  view_ detailed above, perhaps query the API for config, and call the
  render code.

.. _earlier: `Things needed from the region to render a preseed:`_
.. _view: `Which boils down to:`_


Notes:
======

- The ``pxeconfig`` view calculates the preseed URLs. This calculation
  no longer needs to happen, and its responsibility passes to the
  provisioning server.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to maas in Ubuntu.
https://bugs.launchpad.net/bugs/1081701

Title:
  The metadata address mentioned in the preseed is wrong.

To manage notifications about this bug go to:
https://bugs.launchpad.net/maas/+bug/1081701/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to