Skip to content

Commit

Permalink
[fast-reboot]: support encoded & gzipped minigraph in fast reboot (#1716
Browse files Browse the repository at this point in the history
)

* [fast-reboot]: support encoded & gzipped minigraph in fast reboot

Signed-off-by: Guohan Lu <gulv@microsoft.com>

* add acl.json and snmp.yml into fast-reboot

Signed-off-by: Guohan Lu <gulv@microsoft.com>
  • Loading branch information
lguohan committed May 19, 2018
1 parent 4faf96f commit a2d0144
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,31 @@ if [ ! -e /host/machine.conf ]; then

if [ -n "$nos_dev" ]; then
# Mount the previous NOS's partition
mkdir -p /mnt/nos_migration
mount $nos_dev /mnt/nos_migration
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 /mnt/nos_migration/mgmt_interface.cfg /host/migration
nos_migration_import /mnt/nos_migration/minigraph.xml /host/migration
nos_migration_import /mnt/nos_migration/arp.json /host/fast-reboot
nos_migration_import /mnt/nos_migration/fdb.json /host/fast-reboot
nos_migration_import /mnt/nos_migration/default_routes.json /host/fast-reboot

umount /mnt/nos_migration
rmdir /mnt/nos_migration
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
Expand Down Expand Up @@ -196,6 +208,8 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then
elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then
mkdir -p /etc/sonic/old_config
mv /host/migration/minigraph.xml /etc/sonic/old_config/
[ -f /host/migration/acl.json ] && mv /host/migration/acl.json /etc/sonic/old_config/
[ -f /host/migration/snmp.yml ] && mv /host/migration/snmp.yml /etc/sonic/old_config/
touch /tmp/pending_config_migration
[ -f /etc/sonic/updategraph.conf ] && sed -i -e "s/enabled=false/enabled=true/g" /etc/sonic/updategraph.conf
else
Expand Down

0 comments on commit a2d0144

Please sign in to comment.