Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# PG lossless profiles.
# speed cable size xon xoff threshold xon_offset
40000 5m 56368 18432 55120 -3 2496
50000 5m 56368 18432 55120 -3 2496
100000 5m 56368 18432 55120 -3 2496
40000 40m 56368 18432 55120 -3 2496
50000 40m 56368 18432 55120 -3 2496
100000 40m 56368 18432 55120 -3 2496
40000 300m 56368 18432 55120 -3 2496
50000 300m 56368 18432 55120 -3 2496
100000 300m 56368 18432 55120 -3 2496
40000 5m 46384 18432 45136 -3 2496
50000 5m 46592 18432 45344 -3 2496
100000 5m 48464 18432 47216 -3 2496
40000 40m 48464 18432 47216 -3 2496
50000 40m 49296 18432 48048 -3 2496
100000 40m 53872 18432 52624 -3 2496
40000 300m 64064 18432 62816 -3 2496
50000 300m 68848 18432 67600 -3 2496
100000 300m 92976 18432 91728 -3 2496
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# PG lossless profiles.
# speed cable size xon xoff threshold xon_offset
40000 5m 56368 18432 55120 -3 2496
50000 5m 56368 18432 55120 -3 2496
100000 5m 56368 18432 55120 -3 2496
40000 40m 56368 18432 55120 -3 2496
50000 40m 56368 18432 55120 -3 2496
100000 40m 56368 18432 55120 -3 2496
40000 300m 56368 18432 55120 -3 2496
50000 300m 56368 18432 55120 -3 2496
100000 300m 56368 18432 55120 -3 2496
40000 5m 46384 18432 45136 -3 2496
50000 5m 46592 18432 45344 -3 2496
100000 5m 48464 18432 47216 -3 2496
40000 40m 48464 18432 47216 -3 2496
50000 40m 49296 18432 48048 -3 2496
100000 40m 53872 18432 52624 -3 2496
40000 300m 64064 18432 62816 -3 2496
50000 300m 68848 18432 67600 -3 2496
100000 300m 92976 18432 91728 -3 2496
2 changes: 1 addition & 1 deletion device/dell/x86_64-dell_s6100_c2538-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CONSOLE_PORT=0x2f8
CONSOLE_DEV=1
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich nos-config-part=/dev/sda12"
124 changes: 68 additions & 56 deletions files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ update_mgmt_interface_macaddr() {
fi

# Get the ethtool magic and offset for changing the mac address in the EEPROM
ethtool_magic=$(grep "ethtool_magic" $mgmt_config | awk -F'=' '{print $2}')
ethtool_offset=$(grep "ethtool_offset" $mgmt_config | awk -F'=' '{print $2}')
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)"
return
Expand Down Expand Up @@ -92,6 +92,69 @@ update_mgmt_interface_macaddr() {
ethtool -e eth0 offset $ethtool_offset length 6 >> /host/migration/migration.log
}

migrate_nos_configuration()
{
rm -rf /host/migration
mkdir -p /host/migration

# Extract the previous NOS's partition that contains the migration artifacts
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
nos-config-part=*)
nos_dev="${x#nos-config-part=}"
;;
SONIC_BOOT_TYPE=fast*)
sonic_fast_reboot=true
;;
esac
done

if [ -n "$nos_dev" ]; then
# remove nos-config-part from cmdline
sed -r -i.bak "s/nos-config-part=[^[:space:]]+//" /host/grub/grub.cfg

# Mount the previous NOS's partition
NOS_DIR=/mnt/nos_migration
MG_GZFILE=$NOS_DIR/minigraph.xml.gz.base64.txt
MG_FILE=$NOS_DIR/minigraph.xml
ACL_GZFILE=$NOS_DIR/acl.json.gz.base64.txt
ACL_FILE=$NOS_DIR/acl.json
SNMP_FILE=$NOS_DIR/snmp.yml
mkdir -p $NOS_DIR

mount $nos_dev $NOS_DIR
if [ $? != 0 ]; then
log_migration "ERROR: cannot mount $nos_dev"
else

# decode & unzip minigraph.xml.gz.base64.txt
[ -f $MG_GZFILE ] && /usr/bin/base64 -d $MG_GZFILE | /bin/gunzip > $MG_FILE
[ -f $ACL_GZFILE ] && /usr/bin/base64 -d $ACL_GZFILE | /bin/gunzip > $ACL_FILE

# Copy relevant files
nos_migration_import $NOS_DIR/mgmt_interface.cfg /host/migration
nos_migration_import $MG_FILE /host/migration
nos_migration_import $ACL_FILE /host/migration
nos_migration_import $SNMP_FILE /host/migration

if [ "$sonic_fast_reboot" == true ]; then
mkdir -p /host/fast-reboot
nos_migration_import $NOS_DIR/arp.json /host/fast-reboot
nos_migration_import $NOS_DIR/fdb.json /host/fast-reboot
nos_migration_import $NOS_DIR/default_routes.json /host/fast-reboot
fi

umount $NOS_DIR
rmdir $NOS_DIR
fi

[ -f /host/migration/mgmt_interface.cfg ] && update_mgmt_interface_macaddr /host/migration/mgmt_interface.cfg

migration="TRUE"
fi
}

firsttime_exit() {
rm -rf $FIRST_BOOT_FILE
exit 0
Expand Down Expand Up @@ -137,13 +200,11 @@ logger "SONiC version ${SONIC_VERSION} starting up..."
# If the machine.conf is absent, it indicates that the unit booted
# into SONiC from another NOS. Extract the machine.conf from ONIE.
if [ ! -e /host/machine.conf ]; then
mkdir -p /host/migration

onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//')
mkdir -p /mnt/onie-boot
mount $onie_dev /mnt/onie-boot
onie_grub_cfg=/mnt/onie-boot/onie/grub/grub-machine.cfg

if [ ! -e $onie_grub_cfg ]; then
log_migration "$onie_grub_cfg not found"
else
Expand All @@ -154,60 +215,11 @@ if [ ! -e /host/machine.conf ]; then
done
fi

# Extract the previous NOS's partition that contains the migration artifacts
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
nos-config-part=*)
nos_val="${x#nos-config-part=}"
;;
esac
done

if [ -n "$nos_val" ]; then
nos_dev=$(findfs $nos_val)
if [ $? != 0 ]; then
log_migration "ERROR: nos_dev not found. Check grub parameters"
fi
else
log_migration "ERROR: nos_val not found. Check grub parameters"
fi

if [ -n "$nos_dev" ]; then
# Mount the previous NOS's partition
NOS_DIR=/mnt/nos_migration
MG_GZFILE=$NOS_DIR/minigraph.xml.gz.base64.txt
MG_FILE=$NOS_DIR/minigraph.xml
ACL_GZFILE=$NOS_DIR/acl.json.gz.base64.txt
ACL_FILE=$NOS_DIR/acl.json
SNMP_FILE=$NOS_DIR/snmp.yml
mkdir -p $NOS_DIR
mount $nos_dev $NOS_DIR
mkdir -p /host/fast-reboot

# decode & unzip minigraph.xml.gz.base64.txt
[ -f $MG_GZFILE ] && /usr/bin/base64 -d $MG_GZFILE | /bin/gunzip > $MG_FILE
[ -f $ACL_GZFILE ] && /usr/bin/base64 -d $ACL_GZFILE | /bin/gunzip > $ACL_FILE

# Copy relevant files
nos_migration_import $NOS_DIR/mgmt_interface.cfg /host/migration
nos_migration_import $MG_FILE /host/migration
nos_migration_import $ACL_FILE /host/migration
nos_migration_import $SNMP_FILE /host/migration
nos_migration_import $NOS_DIR/arp.json /host/fast-reboot
nos_migration_import $NOS_DIR/fdb.json /host/fast-reboot
nos_migration_import $NOS_DIR/default_routes.json /host/fast-reboot

umount $NOS_DIR
rmdir $NOS_DIR
fi

update_mgmt_interface_macaddr /host/migration/mgmt_interface.cfg

migration="TRUE"
umount /mnt/onie-boot
fi

migrate_nos_configuration

. /host/machine.conf

program_console_speed
Expand Down