Project

General

Profile

Actions

Refactor #14035

open

Redesign discovered host

Added by Lukas Zapletal over 8 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Discovery plugin
Difficulty:
hard
Triaged:
Fixed in Releases:
Found in Releases:

Description

Currently, Discovery plugin leverages Edit Host form to do provisioning. This brings various problems and the code is difficult to maintain. This ticket aims to refactor discovery to use new form for manual discovered host provisioning.

Current problems:

  1. Monkey-patching is be used in order to use the form from core.
  2. The code depends on Edit Host core form, changes there usually breaks Discovery.
  3. Unable to edit/change Organization/Location fields when Katello plugin is installed.
  4. The form exits incorrectly on Cancel.
  5. Most users only assign Hostgroup and optionally edit Network configuration.

Possible solutions:

A) DISCOVERY PROFILE

We can introduce Discovery Profile model that defines the following items:

  • associated hostgroup
  • hostname pattern
  • organization and location
  • network configuration
  • [x] edit host before provisioning

The network configuration needs to be flexible so Profile can be used directly (attended provisioning) or via Rule (unattended provisioning). Instead of rewriting networking part of the New/Edit Host, we should come up with something else which is more flexible: #13847.

We shoud also provide a mechanism not to initiate provisioning immediately using a flag, this will be used in interactive (attended) provisioning when user want to do some per-host fine tuning (e.g. editing network configuration for a single host). Since we simple open an existing Edit Form URL from Discovery, no defacing will be required for this.

Hostgroup and hostname pattern will move from Discovery Rules to Profile and they will be linked together, so Profiles are used in both unattended and attended provisioning.

Advantages: Using the same model for both attended and unattended provisioning. Possibility to use scripted network configuration for both as well.

Disadvantages: Two forms are required in order to do interactive provisioning with networking configuration change.

B) EXTEND NEW HOST FORM

Instead using Edit Host, we can simply use New Host form if we extend it in core to accept "default parameters". Discovery needs at least:

  • hostname
  • network configuration

Alternatively, we can send just list of facts instead particular form items, so in that case the New Form controller action can do import_host_from_facts to build network configuration for the form.

This solution must be implemented together with getting rid of STI (#13848) since discovered hosts must not exist as a host record (otherwise there will be a conflict). New model DiscoveredHost will be created to hold facts and associated subnet (as a fact perhaps). The model can be very simple and we will not be creating new Foreman Host at the discovery time, we will just keep the facts.

We will use Facelets to extend Foreman Host with discovery subnet and also DiscoveredHost which will hold facts even after host was provisioned. It will be very useful to be able to access discovered facts after host was provisioned (currently we have a hack to keep all facts starting with discovery* - all the others are deleted). And of course we need a reference to DiscoveryRule as well via Facelet.

Workflow:

  • host is discovered
  • subnet is detected
  • organization/location is assigned (? maybe we won't need that at this stage)
  • DiscoveredHost record is created
  • user clicks on Provision
  • New Host form is rendered
  • once submitted, discovery orchestration hooks reboots/kexec

Related issues 6 (3 open3 closed)

Related to Discovery - Feature #13847: Auto-provisioning custom scripts for NIC configurationsNewLukas Zapletal02/23/2016Actions
Related to Discovery - Feature #4426: Allow changing/setting of organisation and location in the "Provision Host" screenClosedLukas Zapletal02/24/2014Actions
Related to Discovery - Bug #8148: Allow editing taxonomy on Provision Host formNew10/29/2014Actions
Related to Discovery - Refactor #13848: Refactor Discovery STI to FacetsNew02/23/2016Actions
Related to Discovery - Refactor #14036: Add extension point to Subnets form for Discovery ProxyClosedTimo Goebel03/03/2016Actions
Related to Foreman - Bug #14951: Can not submit when provisioning a discovered host with parameter override ClosedOri Rabin05/06/2016Actions
Actions #1

Updated by Lukas Zapletal over 8 years ago

  • Related to Feature #13847: Auto-provisioning custom scripts for NIC configurations added
Actions #2

Updated by Lukas Zapletal over 8 years ago

  • Related to Feature #4426: Allow changing/setting of organisation and location in the "Provision Host" screen added
Actions #3

Updated by Lukas Zapletal over 8 years ago

  • Related to Bug #8148: Allow editing taxonomy on Provision Host form added
Actions #4

Updated by Lukas Zapletal over 8 years ago

Actions #5

Updated by Lukas Zapletal over 8 years ago

  • Description updated (diff)

After discussion with Daniel and imriz on IRC, I have addded an alternative solution.

Actions #6

Updated by Lukas Zapletal over 8 years ago

  • Description updated (diff)
Actions #7

Updated by Lukas Zapletal over 8 years ago

  • Related to Refactor #14036: Add extension point to Subnets form for Discovery Proxy added
Actions #8

Updated by Ori Rabin over 8 years ago

  • Subject changed from Implement new form for provisioning discovered hosts to Redesign discovered host
Actions #9

Updated by Lukas Zapletal over 8 years ago

  • Category changed from Image to Discovery plugin
  • Assignee set to Ori Rabin
Actions #10

Updated by Lukas Zapletal over 8 years ago

  • Bugzilla link set to 1324539

Custom discovery pxe-less facts being deleted during provisioning is limiting, a Satellite 6 customer would like to have them and be able to access them from hostgroups which makes a lot of sense. Let's implement this as part of this feature.

Actions #11

Updated by Ori Rabin about 8 years ago

  • Related to Bug #14951: Can not submit when provisioning a discovered host with parameter override added
Actions #12

Updated by N V over 7 years ago

Hello, I'm affected by this issue on 1.13.1.
It works fine with autoprovision or manual quick-provision, but in my company we are unfortunately still stuck with the manual input of interfaces addresses, hence I can't live without the "edit form".

The infos I care about that are forgotten are related to the puppet settings (master/ca/environment).
Any plan to apply a workaround to this in 1.13.x or 1.14?

Thanks!

Actions #13

Updated by Ori Rabin almost 7 years ago

  • Assignee deleted (Ori Rabin)
Actions

Also available in: Atom PDF