Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DHCP plugin updates #296
base: main
Are you sure you want to change the base?
DHCP plugin updates #296
Changes from all commits
facbf7c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a $self->verbose("discovery plugin configured, no dhcp configuration") or something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the return condition should be that
$st->{configuration}->...->{enabled}
is true (so that one can disable it; and it should be disabled by default)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no problem with adding a diag message, however, the code above is correct. The use of plugins is triggered by the existence of the plugin name - there does not have to be any specific keys under the name; see
iter_plugins()
. Neithernbp
norosinstall
plugins are required to have a property calledenabled
- I don't see whydiscovery
plugins should have that.As I wrote above,
enabled
is really just a placeholder here - since the DHCP plugin does not have any plugin-wide options, it needs something to force the path to exist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, if you really only need/want path existance, get rid of the enabled; the name suggests that you can also disable it.
you can just do
and get the same result.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 inconfig.pan
and not inschema.pan
- you generally include.../config.pan
when you want to use something. Again, this is exactly howquattor/aii/ks/config.pan
andquattor/aii/pxelinux/config.pan
behaves. Which is btw. nicer than the previous practice of having thebind
statement in.../schema.pan
.There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well,
ks/config.pan
andpxelinux/config.pan
are not calledks/osinstall.pan
andpxelinux/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?There was a problem hiding this comment.
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
todhcp/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.
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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, theenabled
flag is used to serve this purpose.You could call
enabled
asan_arbitrary_value_to_ensure_the_path_exists
, but that is much harder to type :-)There was a problem hiding this comment.
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 incompatibleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoudl be
"options/addoptions"
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 incompatiblesame for the relocation of the tftpserver from
options/tftpserver
to simpletftpserver
.in the
Shellfe.pm
is a methods calleddhcp
that uses this. please also fix that code if you plan to cleanup the schema.There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
Socket::inet_ntoa
.