-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support OS9 -> SONiC fast-reboot migration #1414
Conversation
files/image_config/platform/rc.local
Outdated
mkdir -p /etc/sonic/migration | ||
|
||
# Copy relevant files | ||
nos_migration_import /mnt/nos_migration/minigraph.xml /etc/sonic/migration |
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 could import the entire bunch of files 1 shot - but this is just to ensure we know what we are importing.
files/image_config/platform/rc.local
Outdated
migration="TRUE" | ||
umount /mnt/onie-boot | ||
else | ||
# this is a reboot post NOS migration : remove stale imported files that were used during migration. | ||
rm -fr /etc/sonic/migration |
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.
Alternatively, we could remove the arp.json & fdb.json after checking that orchagent initialized but removing here localizes the migration changes to rc.local.
build_debian.sh
Outdated
@@ -315,7 +315,7 @@ sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null <<EOF | |||
|
|||
auto eth0 | |||
allow-hotplug eth0 | |||
iface eth0 inet dhcp | |||
iface eth0 inet static |
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 we are not going to disable dhcp globally? the dhcp is disabled only from ftos to sonic fast-boot migration?
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 was the earlier thought. But I could not disable this during migration since squashfs is readonly... So, changed the approach. Note that with this change, though we disable dhcp globally during the build, if there is no IP configured in the minigraph, the interfaces-config.sh would override the startup /etc/network/interfaces with a config that is set to 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.
you do not need to change squash fs, you can change the entry after you have mounted the union fs.
@pavel-shirshov , can you code-review 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.
As commented.
files/image_config/platform/rc.local
Outdated
nos_migration_import /mnt/nos_migration/arp.json /etc/sonic/migration | ||
nos_migration_import /mnt/nos_migration/fdb.json /etc/sonic/migration | ||
nos_migration_import /mnt/nos_migration/mgmt_interface.mac /etc/sonic/migration | ||
|
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.
Can you please put your files into /host/fast-reboot directory?
See following changes in fast-reboot script: sonic-net/sonic-utilities@461470b
In this case you don't need any changes in swssconfig.sh
@@ -29,6 +41,9 @@ function fast_reboot { | |||
esac | |||
} | |||
|
|||
# If we are migrating, import the dumps from the previous NOS | |||
fast_migration | |||
|
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.
You don't need to change this file. See my comments below
files/image_config/platform/rc.local
Outdated
@@ -11,6 +11,16 @@ | |||
# | |||
# By default this script does nothing. | |||
|
|||
# In case the unit is migrating from another NOS, save the logs | |||
log_migration() { | |||
echo $1 >> /etc/migration.log |
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.
better to save it to /var/log?
Any other place, not /etc?
files/image_config/platform/rc.local
Outdated
if [ `echo $eth0_mac | egrep "^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"` ]; then | ||
ifconfig eth0 down | ||
ip link set eth0 address $eth0_mac | ||
ifconfig eth0 up |
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.
please use iptools2 commands
files/image_config/platform/rc.local
Outdated
# Copy relevant files | ||
nos_migration_import /mnt/nos_migration/minigraph.xml /etc/sonic/migration | ||
nos_migration_import /mnt/nos_migration/arp.json /etc/sonic/migration | ||
nos_migration_import /mnt/nos_migration/fdb.json /etc/sonic/migration |
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.
Please add support for default routes in default_routes.json.
See here: sonic-net/sonic-utilities@461470b#diff-fcb2d524807024c9b0cd2e2850088f64R258
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.
- Create /host/migration which will contain:
a. migration logs
b. mgmt_interfaces.cfg (previously mgmt_interfaces.mac)
c. minigraph. - Revert changes to swssconfig.sh. the jsons are copied into /host/fast-reboot.
- In order to make the eth0 (and switchport MACs) persistent after the migration reboot, write the NOS's mac into the GbE EEPROM so that igb driver can use it post the migration reboot. Added ethtool for writing MAC to EEPROM.
- Also, update the 70-persistent-net.rules to fix the eth0 mac after migration.
Please review changes. |
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.
It looks ok for me
[ -f $1 ] && cp $1 $2 || log_migration "ERROR: $1 not found!" | ||
} | ||
|
||
# While migrating form another NOS, we need to preserve the MAC addresses |
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.
form -> from
files/image_config/platform/rc.local
Outdated
ethtool_magic=$(grep "ethtool_magic" $mgmt_config | awk -F'=' '{print $2}') | ||
ethtool_offset=$(grep "ethtool_offset" $mgmt_config | awk -F'=' '{print $2}') | ||
if [ -z "$ethtool_magic" ] || [ -z "$ethtool_offset" ]; then | ||
log_migration "Unable to retrieve ethtool params ($ethtool_magic,ethtool_offset)" |
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.
missed $ in the error message?
rmdir /mnt/nos_migration | ||
fi | ||
|
||
update_mgmt_interface_macaddr /host/migration/mgmt_interface.cfg |
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.
Are we sure this will work for any platform?
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.
There is an assumption that the platform supports ethtool to modify the eth (GbE in S6100/Z9100) case using igb. If the platform does not support ethtool to change the EEPROM, the alternative (workaround) is to note that the unit has migrated and apply the previous NOS' mac to eth0 (using ip link set) everytime the unit reboots...
|
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.
Please review !
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.
Where do you use mgmt-intf-dhcp?
Also I suggest to use
https://www.shellcheck.net/ sometime this utility shows hidden issues
@@ -0,0 +1,36 @@ | |||
#!/bin/sh |
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.
Better to use /bin/bash 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.
Thanks for the shellcheck! I want to use sh as is the convention with other initramfs scripts..
files/initramfs-tools/mgmt-intf-dhcp
Outdated
fi | ||
|
||
if [ -e "${rootmnt}/etc/network/interfaces" ]; then | ||
if [ "$val" == "off" ]; then |
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.
== is undefined in /bin/sh
Better use =
files/initramfs-tools/mgmt-intf-dhcp
Outdated
if [ -e "${rootmnt}/etc/network/interfaces" ]; then | ||
if [ "$val" == "off" ]; then | ||
sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' ${rootmnt}/etc/network/interfaces | ||
elif [ "$val" == "on" ]; then |
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.
==
The same as previous
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.
Please review changes!
elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then | ||
# Use the minigraph that was imported from the NOS | ||
mv /host/migration/minigraph.xml /etc/sonic/ | ||
sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json |
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.
-H -m -j
# Update the 70-persistent-net.rules with the new mac for eth0 | ||
log_migration "/etc/udev/rules.d/70-persistent-net.rules : replacing $old_mac with $new_mac for eth0" | ||
sed -i "/eth0/ s/ATTR{address}==\"$old_mac\"/ATTR{address}==\"$new_mac\"/g" /etc/udev/rules.d/70-persistent-net.rules | ||
} |
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.
for sonic, we are using the same mac for management interface and vlan interface. are you using the same mac for you management interface and vlan interface? The goal here is to make sure your vlan interface has the same mac as our vlan interface.
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.
as comments
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.
as comments
sonic-net#1414) * [vnet] Maintain the reference count of the nexthop when creating a vnet route
19615e3 Fixing db_migrator for Feature table (#1674) d1c1c61 [tests]: skip some dynamic port breakout unit tests (#1677) 25669c3 [CI] sonic-config-engine now depends on SONiC YANG packages (#1675) 3ff68c4 [neighbor-advertiser] delete the tunnel maps appropriately (#1663) a425ca2 [config] support for configuring muxcable to manual mode of operation (#1642) 25e17de [show platform summary] Add chassis hardware info to platform summary and version (#1624) f5f2a00 [db_migrator] fix old 1911 feature config migration to a new one. (#1635) 56db162 [config] Fix config int add incorrect ip (#1414) 1da879c [db_migrator][Mellanox] Update Mellanox buffer migrator with 2km-cable supported (#1564) c2b760f [sonic_package_manager] flush once finished saving docker image into temporary file (#1638) cd69473 Replace swsssdk.ConfigDBConnector and SonicDBConfig with swsscommon implementation (#1620) 5f20365 Change to use rvtysh when calling the show commands (#1572) 51d6bf5 Fix Aboot breakage in sonic package manager in sonic-installer (#1625) 18bed46 [console][show] Force refresh all lines status during show line (#1641) b616cd9 [TPID CONFIG] Added TPID configuration CLI support (#1618) 01eb4b1 [show] support for show muxcable firmware version of only active banks (#1629) 7744c8d [fdb]cli: fdb entries are cleared according to vlan or port or vlan&&port (#657) e23c5ee Add psu hardware revision to psushow table (#1601) f1726fe Make advance_version_for_expected_database available for other db migrator test cases as well (#1614) 5d1ad05 [show] add support for muxcable metrics (#1615) feeab29 [config] Sort Config Db When Saving (#1623)
Update submodule for sonic-utilities to include the following PRs: Make the soft-reboot available in the SONiC image on master (#1681) [config]: Update environment file during config reload (#1673) Enable pr checker form 202012 (#1649) [config] support for configuring muxcable to manual mode of operation (#1642) [config] Fix config int add incorrect ip (#1414) Signed-off-by: Dror Prital <drorp@nvidia.com>
19615e3 Fixing db_migrator for Feature table (sonic-net#1674) d1c1c61 [tests]: skip some dynamic port breakout unit tests (sonic-net#1677) 25669c3 [CI] sonic-config-engine now depends on SONiC YANG packages (sonic-net#1675) 3ff68c4 [neighbor-advertiser] delete the tunnel maps appropriately (sonic-net#1663) a425ca2 [config] support for configuring muxcable to manual mode of operation (sonic-net#1642) 25e17de [show platform summary] Add chassis hardware info to platform summary and version (sonic-net#1624) f5f2a00 [db_migrator] fix old 1911 feature config migration to a new one. (sonic-net#1635) 56db162 [config] Fix config int add incorrect ip (sonic-net#1414) 1da879c [db_migrator][Mellanox] Update Mellanox buffer migrator with 2km-cable supported (sonic-net#1564) c2b760f [sonic_package_manager] flush once finished saving docker image into temporary file (sonic-net#1638) cd69473 Replace swsssdk.ConfigDBConnector and SonicDBConfig with swsscommon implementation (sonic-net#1620) 5f20365 Change to use rvtysh when calling the show commands (sonic-net#1572) 51d6bf5 Fix Aboot breakage in sonic package manager in sonic-installer (sonic-net#1625) 18bed46 [console][show] Force refresh all lines status during show line (sonic-net#1641) b616cd9 [TPID CONFIG] Added TPID configuration CLI support (sonic-net#1618) 01eb4b1 [show] support for show muxcable firmware version of only active banks (sonic-net#1629) 7744c8d [fdb]cli: fdb entries are cleared according to vlan or port or vlan&&port (sonic-net#657) e23c5ee Add psu hardware revision to psushow table (sonic-net#1601) f1726fe Make advance_version_for_expected_database available for other db migrator test cases as well (sonic-net#1614) 5d1ad05 [show] add support for muxcable metrics (sonic-net#1615) feeab29 [config] Sort Config Db When Saving (sonic-net#1623)
sonic-net#1414) * [vnet] Maintain the reference count of the nexthop when creating a vnet route
* Added ip and mask check to config int Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
Update SAI submodule v1.9 with the following fixes 7594e53 (HEAD, origin/v1.9) Skip brcm teardown assertion (sonic-net#1423) (sonic-net#1428) 0c33f4a [FIX]Fix the circular reference issue when build sai header py (sonic-net#1427) 7e0fc24 Add support for building under Doxygen 1.9.1 (sonic-net#1414) (sonic-net#1424) 8ecf3ef [Fix]Correct enum check on branch 1.9 (sonic-net#1418) e2b2f39 Add Thrift 0.14.1 compatibility (sonic-net#1403) (sonic-net#1416)
- What I did
Add support for OS9 to SONiC migration in fast-reboot mode
- How I did it
a. Extract the NOS (OS9) partition from the cmdline (that stores the migration artifacts)
b. Set the mac for eth0 based on OS9 setting
c. Save the arp and fdb.jsons for use by swss
d. Initializes the migration.xml to generate config_db
e. On a non-migration reboot, clean up the jsons.
- How to verify it
Perform a customised version of the PTF ftos-fastreboot test (for OS9 -> SONiC migration)
- Description for the changelog
Add support for OS9 to SONiC migration in fast-reboot mode
- A picture of a cute animal (not mandatory but encouraged)