Skip to content

Commit 76d9de5

Browse files
authored
[fast-reboot]: support encoded & gzipped minigraph in fast reboot (#1716)
* [fast-reboot]: support encoded & gzipped minigraph in fast reboot Signed-off-by: Guohan Lu <[email protected]> * add acl.json and snmp.yml into fast-reboot Signed-off-by: Guohan Lu <[email protected]>
1 parent c1e37a6 commit 76d9de5

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

files/image_config/platform/rc.local

+24-10
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,31 @@ if [ ! -e /host/machine.conf ]; then
126126

127127
if [ -n "$nos_dev" ]; then
128128
# Mount the previous NOS's partition
129-
mkdir -p /mnt/nos_migration
130-
mount $nos_dev /mnt/nos_migration
129+
NOS_DIR=/mnt/nos_migration
130+
MG_GZFILE=$NOS_DIR/minigraph.xml.gz.base64.txt
131+
MG_FILE=$NOS_DIR/minigraph.xml
132+
ACL_GZFILE=$NOS_DIR/acl.json.gz.base64.txt
133+
ACL_FILE=$NOS_DIR/acl.json
134+
SNMP_FILE=$NOS_DIR/snmp.yml
135+
mkdir -p $NOS_DIR
136+
mount $nos_dev $NOS_DIR
131137
mkdir -p /host/fast-reboot
132138

139+
# decode & unzip minigraph.xml.gz.base64.txt
140+
[ -f $MG_GZFILE ] && /usr/bin/base64 -d $MG_GZFILE | /bin/gunzip > $MG_FILE
141+
[ -f $ACL_GZFILE ] && /usr/bin/base64 -d $ACL_GZFILE | /bin/gunzip > $ACL_FILE
142+
133143
# Copy relevant files
134-
nos_migration_import /mnt/nos_migration/mgmt_interface.cfg /host/migration
135-
nos_migration_import /mnt/nos_migration/minigraph.xml /host/migration
136-
nos_migration_import /mnt/nos_migration/arp.json /host/fast-reboot
137-
nos_migration_import /mnt/nos_migration/fdb.json /host/fast-reboot
138-
nos_migration_import /mnt/nos_migration/default_routes.json /host/fast-reboot
139-
140-
umount /mnt/nos_migration
141-
rmdir /mnt/nos_migration
144+
nos_migration_import $NOS_DIR/mgmt_interface.cfg /host/migration
145+
nos_migration_import $MG_FILE /host/migration
146+
nos_migration_import $ACL_FILE /host/migration
147+
nos_migration_import $SNMP_FILE /host/migration
148+
nos_migration_import $NOS_DIR/arp.json /host/fast-reboot
149+
nos_migration_import $NOS_DIR/fdb.json /host/fast-reboot
150+
nos_migration_import $NOS_DIR/default_routes.json /host/fast-reboot
151+
152+
umount $NOS_DIR
153+
rmdir $NOS_DIR
142154
fi
143155

144156
update_mgmt_interface_macaddr /host/migration/mgmt_interface.cfg
@@ -196,6 +208,8 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then
196208
elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then
197209
mkdir -p /etc/sonic/old_config
198210
mv /host/migration/minigraph.xml /etc/sonic/old_config/
211+
[ -f /host/migration/acl.json ] && mv /host/migration/acl.json /etc/sonic/old_config/
212+
[ -f /host/migration/snmp.yml ] && mv /host/migration/snmp.yml /etc/sonic/old_config/
199213
touch /tmp/pending_config_migration
200214
[ -f /etc/sonic/updategraph.conf ] && sed -i -e "s/enabled=false/enabled=true/g" /etc/sonic/updategraph.conf
201215
else

0 commit comments

Comments
 (0)