-
Notifications
You must be signed in to change notification settings - Fork 246
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
Improve ReaR network migration #1510
Improve ReaR network migration #1510
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.
"Tested ... with ... suse 11 / suse 12"
means I just trust you.
Only for the fun of it: |
@@ -3,12 +3,11 @@ | |||
|
|||
# because the bash option nullglob is set in rear (see usr/sbin/rear) | |||
# PATCH_FILES is empty if nothing matches $TARGET_FS_ROOT/etc/sysconfig/*/ifcfg-* | |||
PATCH_FILES=( $TARGET_FS_ROOT/etc/sysconfig/*/ifcfg-* ) | |||
PATCH_FILES=( $TARGET_FS_ROOT/etc/sysconfig/*/ifcfg-* $TARGET_FS_ROOT/etc/network/inter[f]aces $TARGET_FS_ROOT/etc/network/interfaces.d/* ) |
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.
Why do you use globbing for a single character as in inter[f]aces?
I think globbing for a single character is useless because
it matches only this single character
(it is neither case-insensitive nor optional):
# touch /tmp/bar # touch /tmp/bAr # touch /tmp/br # echo /tmp/b[a]r /tmp/bar # ( shopt -s nullglob extglob ; echo /tmp/b[a]r ) /tmp/bar
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 thought it also permit to take only the file if it exists on the server.
But maybe I misunderstood the comment:
# because the bash option nullglob is set in rear (see usr/sbin/rear)
# PATCH_FILES is empty if nothing matches $TARGET_FS_ROOT/etc/sysconfig/*/ifcfg-*
I just don't want to add /etc/network/interfaces to the PATCH_FILES array if it does not exists (like suse/redhat)
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.
Perfect!
Thanks for the explanation.
You are right:
# arr=( foo /etc/network/inter[f]aces bar ) ; echo ${arr[*]} foo /etc/network/inter[f]aces bar # ls /etc/network/interfaces ls: cannot access /etc/network/interfaces: No such file or directory # ( shopt -s nullglob extglob ; arr=( foo /etc/network/inter[f]aces bar ) ; echo ${arr[*]} ) foo bar
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.
Perhaps an additional comment why
that "artificial" looking globbing is used here?
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
@schabrolles |
@schabrolles Now I am wondering (in particular after reading its initial comment) In current (i.e. without this pull request) code Currently the only "normal" ReaR script that calls From my current point of view lib/network-functions.sh From my current point of view lib/network-functions.sh Simply put: @schabrolles The problem is that lib/network-functions.sh is the exact right name @schabrolles |
@gdha Can you explain if that strange looking functions therein What I mean is: |
@schabrolles |
I missed two functions in lib/network-functions.sh |
@jsmeix I'm not sure that |
@schabrolles |
@schabrolles @jsmeix I agree that network-functions.sh is collection I grabbed from an old RHEL system to get the job done as easy as possible (at that time - many, many years ago). |
@gdha thanks for your review. |
Regarding the lib/network-functions.sh cleanup I submitted |
@schabrolles No, I did not test it yet with ubuntu16 yet as I was struggling with ubuntu14 provisioning (just got it working without errors). Pff - what people need to do to earn some money... |
The objective of this PR is to update the network migration process in ReaR.
Before this PR, network migration was based on udev rules files to detect and update mac or interface name.
A) The problem is that newer Linux distro (rhel7, ubuntu) does not automatically update anymore the udev network rule files.
This prevent ReaR :
=> Migration is also currently impossible with
biosdevname
network interface name format (which is the new default for ubuntu/redhat.)B) Network parameter migration (ip/routes via
/etc/rear/mapping/ip_addresses
or/etc/rear/mapping/routes
) are only compatible with RedHat/Suse sysconfig file format. (not debian/ubuntu)This PR propose a migration compatible with latest RH / ubuntu (not based in udev rules but biosdevname) while keeping compatibility with udev rules for older distro.
Tested in migration on POWER with rhel 7.3 / suse 11 / suse 12 / ubuntu 16.04 (with and without
net.ifnames=0
)