Skip to content

Commit

Permalink
Changes to ignore services stop/start for config reload and
Browse files Browse the repository at this point in the history
load_minigraph command. This will be needed when executed from
config-setup script.
  • Loading branch information
abdosi committed May 20, 2020
1 parent c52e268 commit b346302
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,9 @@ def load(filename, yes):
@config.command()
@click.option('-y', '--yes', is_flag=True)
@click.option('-l', '--load-sysinfo', is_flag=True, help='load system default information (mac, portmap etc) first.')
@click.option('-n', '--no_service_restart', default=False, is_flag=True, help='Do not restart docker services')
@click.argument('filename', required=False)
def reload(filename, yes, load_sysinfo):
def reload(filename, yes, load_sysinfo, no_service_restart):
"""Clear current configuration and import a previous saved config DB dump file.
<filename> : Names of configuration file(s) to load, separated by comma with no spaces in between
"""
Expand Down Expand Up @@ -735,8 +736,9 @@ def reload(filename, yes, load_sysinfo):
cfg_hwsku = cfg_hwsku.strip()

#Stop services before config push
log_info("'reload' stopping services...")
_stop_services()
if not no_service_restart:
log_info("'reload' stopping services...")
_stop_services()

""" In Single AISC platforms we have single DB service. In multi-ASIC platforms we have a global DB
service running in the host + DB services running in each ASIC namespace created per ASIC.
Expand Down Expand Up @@ -808,9 +810,10 @@ def reload(filename, yes, load_sysinfo):

# We first run "systemctl reset-failed" to remove the "failed"
# status from all services before we attempt to restart them
_reset_failed_services()
log_info("'reload' restarting services...")
_restart_services()
if not no_service_restart:
_reset_failed_services()
log_info("'reload' restarting services...")
_restart_services()

@config.command("load_mgmt_config")
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
Expand Down Expand Up @@ -840,7 +843,8 @@ def load_mgmt_config(filename):
@config.command("load_minigraph")
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
expose_value=False, prompt='Reload config from minigraph?')
def load_minigraph():
@click.option('-n', '--no_service_restart', default=False, is_flag=True, help='Do not restart docker services')
def load_minigraph(no_service_restart):
"""Reconfigure based on minigraph."""
log_info("'load_minigraph' executing...")

Expand All @@ -855,8 +859,9 @@ def load_minigraph():
device_type = device_type.strip()

#Stop services before config push
log_info("'load_minigraph' stopping services...")
_stop_services()
if not no_service_restart:
log_info("'load_minigraph' stopping services...")
_stop_services()

# For Single Asic platform the namespace list has the empty string
# for mulit Asic platform the empty string to generate the config
Expand Down Expand Up @@ -901,10 +906,11 @@ def load_minigraph():

# We first run "systemctl reset-failed" to remove the "failed"
# status from all services before we attempt to restart them
_reset_failed_services()
#FIXME: After config DB daemon is implemented, we'll no longer need to restart every service.
log_info("'load_minigraph' restarting services...")
_restart_services()
if not no_service_restart:
_reset_failed_services()
#FIXME: After config DB daemon is implemented, we'll no longer need to restart every service.
log_info("'load_minigraph' restarting services...")
_restart_services()
click.echo("Please note setting loaded from minigraph will be lost after system reboot. To preserve setting, run `config save`.")


Expand Down

0 comments on commit b346302

Please sign in to comment.