Skip to content

DHCP plugin updates#296

Closed
gombasg wants to merge 0 commit intoquattor:mainfrom
gombasg:dhcp_plugin
Closed

DHCP plugin updates#296
gombasg wants to merge 0 commit intoquattor:mainfrom
gombasg:dhcp_plugin

Conversation

@gombasg
Copy link
Contributor

@gombasg gombasg commented Sep 5, 2018

Add tests, adapted from aii-core. Replace bare open() with
CAF::FileReader to make the tests work. Include some improvements which
accumulated on our side.

@gombasg gombasg requested review from kwaegema and stdweird September 5, 2018 10:34
@ned21 ned21 added this to the 18.9 milestone Sep 5, 2018
@jrha
Copy link
Member

jrha commented Sep 10, 2018

Are there any examples of /system/aii/discovery being used?

@gombasg
Copy link
Contributor Author

gombasg commented Sep 12, 2018

@jrha: We use it exactly like the tests I've added since 2009 :-)

}
variable AII_DHCP_ADDOPTIONS ?= null;
"/system/aii/dhcp/options/addoptions" ?= AII_DHCP_ADDOPTIONS;
"options" ?= AII_DHCP_ADDOPTIONS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoudl be "options/addoptions"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should not :-) The original aii-dhcp command had a command-line option called --addoptions - which, due to being a command line option, needed to be a single string. But the plugin version never had "addoptions".

In other words - originally, the DHCP plugin did not come with templates, which was unfortunate. When templates were eventually added, they did not match what the code did. This change makes the templates match the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use the options/addtoptions value; at the very least this change is backwards incompatible
same for the relocation of the tftpserver from options/tftpserver to simple tftpserver.
in the Shellfe.pm is a methods called dhcp that uses this. please also fix that code if you plan to cleanup the schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is not backwards incompatible - using addoptions in the plugin's templates would be backwards incompatible :-)

The underlying issue is, aii-core/src/main/perl/DHCP.pm is not compatible with the DHCP plugin - and therefore, you cannot use the the same templates. Which is unfortunate, but this is the case ever since the plugin exists. aii-dhcp/src/main/pan/quattor contains templates for the plugin - so it must be compatible with what the plugin is doing.

This PR does not try to address the incompatibilities between the two implementations. But I think it is successfully pointing out where the incompatibilities are :-)

@documentation{
Enable the plugin
}
"enabled" = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seriously backwards incompatible
i propose to set "enabled" ?= false;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree :-) When quattor/aii/ks/config is included, it makes sure /system/aii/osinstall/ks is not empty, so the plugin will actually be used.

This template does exactly the same. If I write include 'quattor/aii/dhcp/config', I want that to cause the plugin to be enabled. But, since the plugin does not have any plugin-wide configuration options at the moment, the enabled flag is used to serve this purpose.

You could call enabled as an_arbitrary_value_to_ensure_the_path_exists, but that is much harder to type :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with current code, including quattor/aii/dhcp/config sets the discovery plugin, and effectively disables any dhcp configuration. i'm not sure it's the intention, at the very very least is backwards incompatible

#
# "/system/aii/dhcp/options/tftpserver" = "tftp.mydomain.org"
#
bind "/system/aii/discovery/dhcp" = structure_dhcp_module_info;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, since you do this, there's no way to unbind so the code has to be able to disable the discovery

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why the bind is in config.pan and not in schema.pan - you generally include .../config.pan when you want to use something. Again, this is exactly how quattor/aii/ks/config.pan and quattor/aii/pxelinux/config.pan behaves. Which is btw. nicer than the previous practice of having the bind statement in .../schema.pan.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

euhm, my point is that this bind disables dhcp configuration and only configures discovery; and there's no way to disable it.
so the template with this defined should just be called dhcp/discovery.pan, dhcp/config.pan at least suggest it does something with dhcp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, ks/config.pan and pxelinux/config.pan are not called ks/osinstall.pan and pxelinux/nbp.pan either :-)

The current template layout is inconsistent - it mixes core bits and plugins together. Maybe the templates of real plugins should be moved to a plugins subdirectory?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my point wrt renaming dhcp/config to dhcp/discvovery is that the current template and code does not configure dhcp since it enables the discovery plugin/whatever.

i'm aware that it's a mess (and i clearly haven't looked at the code base for a while), but this PR breaks our setup, so i'm trying to figure out where it goes wrong and we can get out of this.

@jrha jrha modified the milestones: 18.9, 18.12 Oct 10, 2018
@stdweird
Copy link
Member

@gombasg and @stdweird agreed to rename existing config.pan to embedded.pan; add the new config.pan as discovery.pan; add a variable to select between embedded and discovery and let the new copnfig.pan do the proper include

@jrha jrha modified the milestones: 19.12, 20.2 Dec 2, 2019
@jrha jrha modified the milestones: 20.3, 20.4 Mar 19, 2020
@jrha jrha removed this from the 22.12 milestone Jan 3, 2023
@jrha jrha added this to the 23.next milestone Jul 24, 2023
@jrha jrha modified the milestones: 23.9, 23.next Sep 28, 2023
@jrha
Copy link
Member

jrha commented Dec 16, 2024

Rebased on main

@jrha
Copy link
Member

jrha commented Jan 5, 2026

Superseded by the work in #299?

@jrha jrha force-pushed the dhcp_plugin branch 4 times, most recently from da57471 to 6e0e555 Compare January 5, 2026 18:06
@jrha
Copy link
Member

jrha commented Jan 5, 2026

Rebased on main and resolved conflicts, only a single line left now that #299 has been merged.

@jrha jrha closed this Jan 6, 2026
@jrha jrha removed this from the 26.1 milestone Jan 6, 2026
@jrha
Copy link
Member

jrha commented Jan 6, 2026

Last line was a duplicate, closing as equivalent code changes merged in #299.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants