-
Notifications
You must be signed in to change notification settings - Fork 56
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
ncm-nmstate: relax syntax of VLAN interface names #1679
base: master
Are you sure you want to change the base?
Conversation
122dd65
to
4f4c11c
Compare
Implementing a fix I uncovered something I consider as a flaw in the current implementation: to guess the VLAN ID, the interface name is took in priority to the device name. It is a problem if you remove the need for a |
4f4c11c
to
8dfd32d
Compare
When I did this for backward compatibility for network.pm, I followed this test file. so I think long as your new change still covers this? then it should be fine for backward compatibility with network.pm? Due to legacy code we had internally, we only define vlan interface using interfacename.vlan_id, i.e eth0.123 format as part of the interface name when defining vlan iface. So long as this test passes, regards |
To be clear, my PR currently only relax the pattern matching on interface/device name but doesn't implement my second suggestion of inverting the order in which we use interface name and device to guess the VLAN ID. As for us this second point is not very important because we always use the same value for the interface name and the device. But I have the feeling you would allow the interface name not to convey the VLAN ID but have it attached to the device name instead... Anyway, with my fix, I'm a bit surprised that |
@jouvin from what I see, vlan0 test config is working as expected with your change since you just relaxed it and not removed anything. vlan0 config is using device=eth0.123 to get the vlanid. (https://github.com/quattor/configuration-modules-core/blob/master/ncm-network/src/test/resources/nmstate_advance.pan#L40) so that is correct and I wouldn't have expected your change to break it? so IMO it is working as expected. Unless I'm misunderstanding the solution here. I'm not fussed with order of check, as we are only setting it one way which is using the format "/system/network/interfaces/eth0.123" so long as this format of config carries on working too, it should be fine. I just did quick check on lab host and its a noop as expected. |
@aka7 good! I'll see if I can come up with the reverse order giving the current result. For me it should... My point with vlan0 is that with the relaxed regex, the ifnzme should match the regex and the vlan ID should be set to 0 which is not what we want. And for me the fix would be to reverse the order as the device will be carry the actual vlan0 ID and will be tested first. I guess it is working because ID 0 is causing the test to evaluate to false. My initial attempt to add vlan1 was failing in fact because it returned ID 1 instead of 123. |
8dfd32d
to
5b9837d
Compare
@aka7 @stdweird I'm trying to fix a problem I identified with the way returned VLAN ID from the interface/device name is tested. The fix is trivial but I'm trying to add a test for this and I'm having trouble because adding the needed lines in the test profile make all the tests failing (including the first one which is just compiling the profile if I'm right) with something that looks as a Pan error except that compiling the profile manually gives no error. Surely a trivial mistake of mine... Any idea? |
@jouvin there is planned meetup discussion today, are you able to join todays call, perhaps we can discuss it there? |
yes I just tried this on the test file, change interface name from vlan0 -> vlan1 and test fails. |
@aka7 sorry, I'm at a conference this week, it was impossible for me to join the meetup... Don't spend time trying to fix tests, I have almost everything done but currently I only published the side issue I identified and I don't understand why adding a VLAN interface in the test profile beaks the Pan compilation despite Pan being able to compile it successfully if run manually... |
@stdweird any chance you could have a look why the second commit is breaking all tests... I'm sure it's trivial and you'll identify the problem very quickly! Just my lack of Perl/Quattor development these last years! |
@stdweird I'm still looking for some help to sort out my (probably stupid) mistake with the test additions, so that I can push the real fix related to the issue... |
@jouvin sorry, i don't know where my head is last weeks ;) |
@jouvin quick look at the code, but |
@stdweird don't worry, I'm totally overwhelmed too these days, tackling to many issues a the same time... My question was not really on the code itself (the line you mentioned is not from me and I was not completely convinced if was correct with Perl, look at a bashism...) but anyway my main problem at this stage is that I added one test in one of the As for your request to rebase, I'd prefer not to do it at this stage (as I have the whole fix ready for this version and would prefer to rebase afterwards), except if you have particular reason for asking for it... |
hmmm, that is not the reason. if you can rebase, i can run the tests locally and debug it quicker |
Sorry I missed the conflicts... I'll do the rebase then... |
5b9837d
to
8dbf700
Compare
@stdweird rebase done |
@jouvin hidden in the output is a
|
@jouvin the pan unittest is an actual example? what is the generated filename for that device? probably the generated yml filename also needs to follow the |
@stdweird yes sure, I need to fix the test for the modified logic but wanted to fix the test logic first... I apologise missing the error, I thought it looked every line... My bad! I'll check in the next days and try to complete this PR. |
if you want to allow such names, just replace the whole device regex with |
@stdweird yes it is what I have done in fact but I have not pushed it yet.. I wanted to add a test first demonstrated the problem with the For my information, where have you seen this "hidden error"? |
it's not hidden, it's just a single line of ERROR output; it's easily missed |
@stdweird I think I understood why I was not seeing the error you mentioned. You need
It seems that the component doesn't like the device name I'll check if there is a good reason for such a restriction... |
And it is unexpected for me. This error comes from |
@stdweird I found it but is it expected that we execute some ncm-network code when using ncm-nmstate? |
@jouvin yes, that is normal. the nmstate backend is a subclass of the network backend |
8dbf700
to
0a71bff
Compare
Hi, I have been unable to finish the work on this critical fix for us (required if your VLAN name is not containing a |
@jouvin the tests still fail on the same error. you need to adapt the regex to pass them |
Thanks @stdweird . I forgot about it when doing my tests yesterday... Modifying this regex is really worrying... but I'll give it a try, hopefully this week :-) |
I add a look this morning. The problem is not |
0a71bff
to
11f935b
Compare
- Use interface name rather than interface device, as it is done for IPv6 - Fix test for vlan0 to match this change (previous test incorrect) - Add a test for vlan1.123 to check correct definition of VLAN paramters when the VLAN ID is specified in the interface name and the device parameter is ommitted
11f935b
to
7568224
Compare
I was able to look in details into the remaining problems and to the things already fixed. It is mainly the problem of the filename regexp that I relaxed in my last changes. I added a test for |
7568224
to
d9c563f
Compare
Answering to myself... I found the error: Anyway, the first for the original issue is now complete and working. @jrha is there any possibility to have it included inside the release? It is really critical for us as all our VLANs are name Note: the changes include a fix for |
- E.g. vlan.456 - Test added for this use case
d9c563f
to
8b6f7cb
Compare
Fixes #1678