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
core, udev: remove old device on move event #16968
core, udev: remove old device on move event #16968
Conversation
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.
Looks OK, but the udev rules files somehow doesn't feel right. @poettering do you have a better approach?
|
CentOS CIs are failed. @mrc0mmand Is it related to that the CI uses an old image for the test? |
|
Ah, |
c664336
to
b0357ae
Compare
b0357ae
to
273146f
Compare
|
So, yea, I think we should change "move" actions to not copy the db, it sounds wrong to me if we#d copy it then. |
Agreed. |
273146f
to
cee0fb4
Compare
|
@poettering and @keszybz Thank you for the comments. Updated. Now udev properties are also flushed on 'move' uevent. However, it makes 'ID_NET_DRIVER=', 'ID_NET_LINK_FILE=' and 'ID_NET_NAME=' dropped after 'move' event. So, I changed 80-net-setup-link.rules to apply .link file also on 'move' event (strictly speaking, all event but except for 'remove' event, I am not sure what we should do e.g., 'change' or 'bind' event). PTAL. |
|
semaphoreci failed with internal compiler error. Seems not related. |
|
Hmm, so with your patch, we don't set ID_NET_NAME. But we don't know for sure if end-user rules or other consumers of the udev db don't make some other use of ID_NET_NAME. So... shouldn't we instead set ID_NET_NAME unconditionally, and tweak rules.d/80-net-setup-link.rules so simply skip the rename when ACTION!="add" ? I don't know what better. |
cee0fb4
to
e822a42
Compare
|
Updated. Now ID_NET_NAME= is also re-assigned. Note that interface renaming is done only on 'add' uevent: Lines 834 to 835 in 12ce0f4
So, it is safe to set NAME= on all uevent in 80-net-setup-link.rules. |
So in the in NEWS file we actually suggest people should always use !="remove" rather than == add|change or so, hence this change is very much in line with what we suggest there, so that sounds good at first sight. Hmm, but then again, the net setup stuff might readjust device parameters, and we probably shouldn't do that on "change" or so, but only on "add" (and maybe "bind"?) So maybe, the net setup code itself should check the event action, and if it's "add" or "bind" make device changes, but if it's anything else it should just generate props... Hmm, that said: we probably should manually import specific props that we cannot regenerate on each event, like before b081b27. i.e. once a device is renamed and otherwise changed we might not be able to determine anymore whether it was us that renamed the thing and based on which .link file, hence we should probably import the props that is stored in over manually by focussed udev rules. |
…ev_t" This reverts commit b081b27. If a network interface get a 'move' event, then previously SYSTEMD_ALIAS= property still contains an old alias, and the old alias .device unit will not be removed. This makes all properties cleared on 'move' event, and then old alias .device unit will be removed by pid1. Fixes systemd#16967.
ee80f9d
to
6059187
Compare
|
@poettering Thank you for the comments. Updated.
Now, .link settings are applied on 'add', 'bind', and also 'move' events. On 'move' event,
Not sure. what is the difference between |
…rties on non-'add' uevent Previous commit makes drop ID_NET_DRIVER=, ID_NET_LINK_FILE=, and ID_NET_NAME= properties for network interfaces on 'move' uevent. ID_NET_DRIVER= and ID_NET_LINK_FILE= properties are used by networkctl. ID_NET_NAME= may be used by end-user rules or programs. So, let's re-assign them on 'move' uevent. (Note that strictly speaking, this makes them re-assigned on all but 'remove' uevent.)
6059187
to
efdaeb8
Compare
|
@poettering and @keszybz Could you review this again? |
Hmm, the ID_NET_LINK_FILE gets dropped that caused the interface to be renamed. But maybe that's actually OK, since it probably should be set to whatever counts now... |
Fixes #16967.