-
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
Move all minigraph-related action from rc.local to updategraph #1452
Conversation
Requires=docker.service teamd.service | ||
After=swss.service teamd.service | ||
Requires=updategraph.service swss.service teamd.service | ||
After=updategraph.service swss.service teamd.service |
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 dhcp_relay requires teamd service?
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.
Portchannels need to be created and up before starting the relay, as the relay agent listens on them.
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.
Because it needs to listen on port channels. Please note that this was the original behavior and I didn't change it in this PR.
if [ ! -f /etc/sonic/init_cfg.json ]; then | ||
echo "{}" > /etc/sonic/init_cfg.json | ||
fi | ||
redis-cli -n 4 FLUSHDB |
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.
4 [](start = 17, length = 1)
can you assign config_dbnum to 4 and use it throughout the script?
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.
Done.
files/image_config/platform/rc.local
Outdated
fi | ||
mkdir -p /etc/sonic/old_config | ||
mv /host/minigraph.xml /etc/sonic/old_config/ | ||
touch /tmp/firstboot |
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.
firstboot [](start = 19, length = 9)
why do we need this firstboot, can updategraph check the /etc/sonic/old_config directory for it to pick up the minigraph or config_db from that directory?
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 plan is to keep /etc/sonic/old_config
folder there and not to delete it after first boot for easy debugging. Therefore we need a flag to mark whether it is the first boot.
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 feel like the file name firstboot
is confusing because we also reference /host/image-$sonic_version/platform/firsttime
in this file, which is also used to determine whether it's the initial boot.
Can we give this file a more specific name based on its application?
Also, I personally think firstboot
is a better name for /host/image-$sonic_version/platform/firsttime
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 rebase and resolve the conflict?
6ca5be9
to
c8aba9a
Compare
Done. |
Please see my comment on rc.local regarding the name of the |
Modified to |
Signed-off-by: Wenda Ni <wonda.ni@gmail.com> Co-authored-by: wenda.ni <wenda.ni@bytedance.com>
- What I did
rc.local
no longer do configuration-related stuff. Instead,updategraph
service now has the functionality to support first-time boot configuration behavior. The detail behavior is that-- For pure new installation, generate configuration from default minigraph if updategraph is not enabled during build time; attempt to configure through DHCP if updategraph is enabled.
-- For sonic version upgrade, generate configuration from minigraph on old system if updategraph is enabled during build time; use old configDB content if not enabled.
Reconsider the dependency between services -
updategraph
is now afterdatabase
. All feature services are now after and depending onupdategraph
. That means restartingupdategraph
will automatically trigger restarting of feature services.updategraph
now supports the scenario of not updating minigraph from data source but only reloading local graph. We plan to adapt to this approach in sonic-utilitiesconfig load_minigraph
to simplify the code and unify behavior.