From e331d3ac393fdf106cd2705f7dd9106fc4ea9422 Mon Sep 17 00:00:00 2001 From: afeigin Date: Mon, 23 Jan 2023 11:18:06 +0000 Subject: [PATCH 01/13] Remove timer from FAST_REBOOT STATE_DB entry and use finalizer --- scripts/fast-reboot | 4 ++-- sonic-utilities-data/templates/service_mgmt.sh.j2 | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/fast-reboot b/scripts/fast-reboot index bfdc191b78..2e92ace3e5 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -148,7 +148,7 @@ function clear_boot() #clear_fast_boot if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then - sonic-db-cli STATE_DB DEL "FAST_REBOOT|system" &>/dev/null || /bin/true + sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "disable" &>/dev/null || /bin/true fi } @@ -532,7 +532,7 @@ case "$REBOOT_TYPE" in check_warm_restart_in_progress BOOT_TYPE_ARG=$REBOOT_TYPE trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM - sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "1" "EX" "210" &>/dev/null + sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "enable" &>/dev/null config warm_restart enable system ;; "warm-reboot") diff --git a/sonic-utilities-data/templates/service_mgmt.sh.j2 b/sonic-utilities-data/templates/service_mgmt.sh.j2 index d206049015..bd371cbfa8 100644 --- a/sonic-utilities-data/templates/service_mgmt.sh.j2 +++ b/sonic-utilities-data/templates/service_mgmt.sh.j2 @@ -51,7 +51,8 @@ function check_warm_boot() function check_fast_boot() { - if [[ $($SONIC_DB_CLI STATE_DB GET "FAST_REBOOT|system") == "1" ]]; then + SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB GET "FAST_REBOOT|system"` + if [[ ${SYSTEM_FAST_REBOOT} == "enable" ]]; then FAST_BOOT="true" else FAST_BOOT="false" From 9d70bb84b8f5517a1be4df74b5d42a36de6a437a Mon Sep 17 00:00:00 2001 From: afeigin Date: Wed, 8 Feb 2023 14:48:19 +0000 Subject: [PATCH 02/13] Update db-migrator to support fast-reboot finalizer when upgrading from older versions --- scripts/db_migrator.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index c52e38bd63..f11ff44c71 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -45,7 +45,7 @@ def __init__(self, namespace, socket=None): none-zero values. build: sequentially increase within a minor version domain. """ - self.CURRENT_VERSION = 'version_4_0_0' + self.CURRENT_VERSION = 'version_4_0_1' self.TABLE_NAME = 'VERSIONS' self.TABLE_KEY = 'DATABASE' @@ -850,9 +850,21 @@ def version_3_0_6(self): def version_4_0_0(self): """ Version 4_0_0. - This is the latest version for master branch """ log.log_info('Handling version_4_0_0') + # Update state-db fast-reboot entry to enable if set to enable fast-reboot finalizer when using upgrade with fast-reboot + fastreboot_state = self.stateDB.get(self.stateDB.STATE_DB, 'FAST_REBOOT|system', '1') + if fastreboot_state == 'true': + self.stateDB.set(self.stateDB.STATE_DB, 'FAST_REBOOT|system', 'enable') + self.set_version('version_4_0_1') + return None + + def version_4_0_1(self): + """ + Version 4_0_1. + This is the latest version for master branch + """ + log.log_info('Handling version_4_0_1') return None def get_version(self): From feb86755867b240cae1a17d5fdf5c94e526a0ce5 Mon Sep 17 00:00:00 2001 From: afeigin Date: Tue, 14 Feb 2023 14:30:24 +0000 Subject: [PATCH 03/13] Rename FAST_REBOOT table --- scripts/db_migrator.py | 6 +++++- scripts/fast-reboot | 6 +++--- sonic-utilities-data/templates/service_mgmt.sh.j2 | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index f11ff44c71..968f338162 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -853,9 +853,13 @@ def version_4_0_0(self): """ log.log_info('Handling version_4_0_0') # Update state-db fast-reboot entry to enable if set to enable fast-reboot finalizer when using upgrade with fast-reboot + # since upgrading from previous version FAST_REBOOT table will be deleted when the timer will expire. fastreboot_state = self.stateDB.get(self.stateDB.STATE_DB, 'FAST_REBOOT|system', '1') if fastreboot_state == 'true': - self.stateDB.set(self.stateDB.STATE_DB, 'FAST_REBOOT|system', 'enable') + enable_state = 'enable' + else: + enable_state = 'disable' + self.stateDB.set(self.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE|system', enable_state) self.set_version('version_4_0_1') return None diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 2e92ace3e5..60961656f1 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -148,7 +148,7 @@ function clear_boot() #clear_fast_boot if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then - sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "disable" &>/dev/null || /bin/true + sonic-db-cli STATE_DB SET "FAST_RESTART_ENABLE_TABLE|system" "disable" &>/dev/null || /bin/true fi } @@ -265,7 +265,7 @@ function backup_database() and not string.match(k, 'WARM_RESTART_ENABLE_TABLE|') \ and not string.match(k, 'VXLAN_TUNNEL_TABLE|') \ and not string.match(k, 'BUFFER_MAX_PARAM_TABLE|') \ - and not string.match(k, 'FAST_REBOOT|') then + and not string.match(k, 'FAST_RESTART_ENABLE_TABLE|') then redis.call('del', k) end end @@ -532,7 +532,7 @@ case "$REBOOT_TYPE" in check_warm_restart_in_progress BOOT_TYPE_ARG=$REBOOT_TYPE trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM - sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "enable" &>/dev/null + sonic-db-cli STATE_DB SET "FAST_RESTART_ENABLE_TABLE|system" "enable" &>/dev/null config warm_restart enable system ;; "warm-reboot") diff --git a/sonic-utilities-data/templates/service_mgmt.sh.j2 b/sonic-utilities-data/templates/service_mgmt.sh.j2 index bd371cbfa8..f497657d51 100644 --- a/sonic-utilities-data/templates/service_mgmt.sh.j2 +++ b/sonic-utilities-data/templates/service_mgmt.sh.j2 @@ -51,7 +51,7 @@ function check_warm_boot() function check_fast_boot() { - SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB GET "FAST_REBOOT|system"` + SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB GET "FAST_RESTART_ENABLE_TABLE|system"` if [[ ${SYSTEM_FAST_REBOOT} == "enable" ]]; then FAST_BOOT="true" else From 2b9a3db5301eac1c4584bd3bb7320287fcc8fae9 Mon Sep 17 00:00:00 2001 From: afeigin Date: Thu, 16 Feb 2023 11:03:57 +0000 Subject: [PATCH 04/13] fix db-migrator version --- scripts/db_migrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 968f338162..cdd97e8406 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -861,7 +861,7 @@ def version_4_0_0(self): enable_state = 'disable' self.stateDB.set(self.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE|system', enable_state) self.set_version('version_4_0_1') - return None + return 'version_4_0_1' def version_4_0_1(self): """ From 5dccee0874670f530e2f080478856194467def3d Mon Sep 17 00:00:00 2001 From: afeigin Date: Thu, 16 Feb 2023 12:04:16 +0000 Subject: [PATCH 05/13] fix change --- scripts/db_migrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index cdd97e8406..5baa0f98f7 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -859,7 +859,7 @@ def version_4_0_0(self): enable_state = 'enable' else: enable_state = 'disable' - self.stateDB.set(self.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE|system', enable_state) + self.stateDB.set(self.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE', 'system', enable_state) self.set_version('version_4_0_1') return 'version_4_0_1' From 57019f127eeb0f0ea5b44429c4295c487dba179f Mon Sep 17 00:00:00 2001 From: afeigin Date: Tue, 28 Feb 2023 19:04:15 +0000 Subject: [PATCH 06/13] modify fast-reboot table structure, add db migrator ut --- scripts/db_migrator.py | 18 ++++++++--- scripts/fast-reboot | 4 +-- .../templates/service_mgmt.sh.j2 | 4 +-- .../state_db/fast_reboot_expected.json | 5 +++ .../state_db/fast_reboot_input.json | 2 ++ tests/db_migrator_test.py | 31 +++++++++++++++++++ 6 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 tests/db_migrator_input/state_db/fast_reboot_expected.json create mode 100644 tests/db_migrator_input/state_db/fast_reboot_input.json diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 5baa0f98f7..8ad19671dc 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -6,6 +6,7 @@ import sys import traceback import re +import subprocess from sonic_py_common import device_info, logger from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig @@ -854,12 +855,19 @@ def version_4_0_0(self): log.log_info('Handling version_4_0_0') # Update state-db fast-reboot entry to enable if set to enable fast-reboot finalizer when using upgrade with fast-reboot # since upgrading from previous version FAST_REBOOT table will be deleted when the timer will expire. - fastreboot_state = self.stateDB.get(self.stateDB.STATE_DB, 'FAST_REBOOT|system', '1') - if fastreboot_state == 'true': - enable_state = 'enable' + # reading FAST_REBOOT table can't be done with stateDB.get as it uses hget behind the scenes and the table structure is + # not using hash and won't work. + fb_system_state = 0 + cmd = ['sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"] + proc = subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) + (stdout, stderr) = proc.communicate() + if proc.returncode == 0 and stdout: + fb_system_state = stdout.rstrip('\n') + if fb_system_state == 1: + enable_state = 'true' else: - enable_state = 'disable' - self.stateDB.set(self.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE', 'system', enable_state) + enable_state = 'false' + self.stateDB.set(self.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE|system', 'enable', enable_state) self.set_version('version_4_0_1') return 'version_4_0_1' diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 60961656f1..f2c797b266 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -148,7 +148,7 @@ function clear_boot() #clear_fast_boot if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then - sonic-db-cli STATE_DB SET "FAST_RESTART_ENABLE_TABLE|system" "disable" &>/dev/null || /bin/true + sonic-db-cli STATE_DB HSET "FAST_RESTART_ENABLE_TABLE|system" "enable" "false" &>/dev/null || /bin/true fi } @@ -532,7 +532,7 @@ case "$REBOOT_TYPE" in check_warm_restart_in_progress BOOT_TYPE_ARG=$REBOOT_TYPE trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM - sonic-db-cli STATE_DB SET "FAST_RESTART_ENABLE_TABLE|system" "enable" &>/dev/null + sonic-db-cli STATE_DB HSET "FAST_RESTART_ENABLE_TABLE|system" "enable" "true" &>/dev/null config warm_restart enable system ;; "warm-reboot") diff --git a/sonic-utilities-data/templates/service_mgmt.sh.j2 b/sonic-utilities-data/templates/service_mgmt.sh.j2 index f497657d51..5c451f36bc 100644 --- a/sonic-utilities-data/templates/service_mgmt.sh.j2 +++ b/sonic-utilities-data/templates/service_mgmt.sh.j2 @@ -51,8 +51,8 @@ function check_warm_boot() function check_fast_boot() { - SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB GET "FAST_RESTART_ENABLE_TABLE|system"` - if [[ ${SYSTEM_FAST_REBOOT} == "enable" ]]; then + SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB GET "FAST_RESTART_ENABLE_TABLE|system" enable` + if [[ x"${SYSTEM_FAST_REBOOT}" == x"true" ]]; then FAST_BOOT="true" else FAST_BOOT="false" diff --git a/tests/db_migrator_input/state_db/fast_reboot_expected.json b/tests/db_migrator_input/state_db/fast_reboot_expected.json new file mode 100644 index 0000000000..e3a7a5fa14 --- /dev/null +++ b/tests/db_migrator_input/state_db/fast_reboot_expected.json @@ -0,0 +1,5 @@ +{ + "FAST_RESTART_ENABLE_TABLE|system": { + "enable": "false" + } +} \ No newline at end of file diff --git a/tests/db_migrator_input/state_db/fast_reboot_input.json b/tests/db_migrator_input/state_db/fast_reboot_input.json new file mode 100644 index 0000000000..7a73a41bfd --- /dev/null +++ b/tests/db_migrator_input/state_db/fast_reboot_input.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/tests/db_migrator_test.py b/tests/db_migrator_test.py index 223f5d582e..d3c85cec8e 100644 --- a/tests/db_migrator_test.py +++ b/tests/db_migrator_test.py @@ -451,6 +451,37 @@ def test_move_logger_tables_in_warm_upgrade(self): diff = DeepDiff(resulting_table, expected_table, ignore_order=True) assert not diff +class TestFastRebootTableModification(object): + @classmethod + def setup_class(cls): + os.environ['UTILITIES_UNIT_TESTING'] = "2" + + @classmethod + def teardown_class(cls): + os.environ['UTILITIES_UNIT_TESTING'] = "0" + dbconnector.dedicated_dbs['STATE_DB'] = None + + def mock_dedicated_state_db(self): + dbconnector.dedicated_dbs['STATE_DB'] = os.path.join(mock_db_path, 'state_db') + + def test_rename_fast_reboot_table_check_enable(self): + device_info.get_sonic_version_info = get_sonic_version_info_mlnx + dbconnector.dedicated_dbs['STATE_DB'] = os.path.join(mock_db_path, 'state_db', 'fast_reboot_input') + + import db_migrator + dbmgtr = db_migrator.DBMigrator(None) + dbmgtr.migrate() + + dbconnector.dedicated_dbs['STATE_DB'] = os.path.join(mock_db_path, 'state_db', 'fast_reboot_expected') + + expected_db = Db() + + resulting_table = dbmgtr.stateDB.get_table('FAST_RESTART_ENABLE_TABLE') + expected_table = expected_db.stateDB.get_table('FAST_RESTART_ENABLE_TABLE') + + diff = DeepDiff(resulting_table, expected_table, ignore_order=True) + assert not diff + class TestWarmUpgrade_to_2_0_2(object): @classmethod def setup_class(cls): From 23d6635e30c91e04290213902b9ecf6292e08742 Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Wed, 1 Mar 2023 14:53:54 +0200 Subject: [PATCH 07/13] Update db_migrator.py --- scripts/db_migrator.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 8ad19671dc..f3ef89569e 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -857,13 +857,8 @@ def version_4_0_0(self): # since upgrading from previous version FAST_REBOOT table will be deleted when the timer will expire. # reading FAST_REBOOT table can't be done with stateDB.get as it uses hget behind the scenes and the table structure is # not using hash and won't work. - fb_system_state = 0 - cmd = ['sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"] - proc = subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) - (stdout, stderr) = proc.communicate() - if proc.returncode == 0 and stdout: - fb_system_state = stdout.rstrip('\n') - if fb_system_state == 1: + output = subprocess.check_output(['sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"], universal_newlines=True) + if "1" in output: enable_state = 'true' else: enable_state = 'false' From f98f28792e49a3c3b68d59c0048dace69bd2daf9 Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Wed, 1 Mar 2023 18:49:34 +0200 Subject: [PATCH 08/13] Update db_migrator.py --- scripts/db_migrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index f3ef89569e..d030e268c4 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -857,7 +857,7 @@ def version_4_0_0(self): # since upgrading from previous version FAST_REBOOT table will be deleted when the timer will expire. # reading FAST_REBOOT table can't be done with stateDB.get as it uses hget behind the scenes and the table structure is # not using hash and won't work. - output = subprocess.check_output(['sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"], universal_newlines=True) + output = subprocess.check_output(['/usr/bin/sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"], universal_newlines=True) if "1" in output: enable_state = 'true' else: From 35bb6102c57a13b78f8c2ef16017f51cdbe150db Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Wed, 1 Mar 2023 22:05:18 +0200 Subject: [PATCH 09/13] Update db_migrator.py --- scripts/db_migrator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index d030e268c4..77aab61d3e 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -857,8 +857,9 @@ def version_4_0_0(self): # since upgrading from previous version FAST_REBOOT table will be deleted when the timer will expire. # reading FAST_REBOOT table can't be done with stateDB.get as it uses hget behind the scenes and the table structure is # not using hash and won't work. - output = subprocess.check_output(['/usr/bin/sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"], universal_newlines=True) - if "1" in output: + # FAST_REBOOT table exists only if fast-reboot was triggered. + keys = self.stateDB.keys(self.stateDB.STATE_DB, "FAST_REBOOT") + if keys is not None: enable_state = 'true' else: enable_state = 'false' From ba9c2a517c3c45edfaa8dc8d69645ba33794b5f2 Mon Sep 17 00:00:00 2001 From: afeigin Date: Mon, 6 Mar 2023 08:42:50 +0000 Subject: [PATCH 10/13] fix fast-reboot db-migrator test --- tests/db_migrator_test.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/db_migrator_test.py b/tests/db_migrator_test.py index d3c85cec8e..ee4fae940f 100644 --- a/tests/db_migrator_test.py +++ b/tests/db_migrator_test.py @@ -467,17 +467,18 @@ def mock_dedicated_state_db(self): def test_rename_fast_reboot_table_check_enable(self): device_info.get_sonic_version_info = get_sonic_version_info_mlnx dbconnector.dedicated_dbs['STATE_DB'] = os.path.join(mock_db_path, 'state_db', 'fast_reboot_input') + dbconnector.dedicated_dbs['CONFIG_DB'] = os.path.join(mock_db_path, 'config_db', 'empty-config-input') import db_migrator dbmgtr = db_migrator.DBMigrator(None) dbmgtr.migrate() dbconnector.dedicated_dbs['STATE_DB'] = os.path.join(mock_db_path, 'state_db', 'fast_reboot_expected') + expected_db = SonicV2Connector(host='127.0.0.1') + expected_db.connect(expected_db.STATE_DB) - expected_db = Db() - - resulting_table = dbmgtr.stateDB.get_table('FAST_RESTART_ENABLE_TABLE') - expected_table = expected_db.stateDB.get_table('FAST_RESTART_ENABLE_TABLE') + resulting_table = dbmgtr.stateDB.get_all(dbmgtr.stateDB.STATE_DB, 'FAST_RESTART_ENABLE_TABLE|system') + expected_table = expected_db.get_all(expected_db.STATE_DB, 'FAST_RESTART_ENABLE_TABLE|system') diff = DeepDiff(resulting_table, expected_table, ignore_order=True) assert not diff From 8f5c98536e40104ea2145e4fbceb730447438be8 Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Mon, 6 Mar 2023 11:37:23 +0200 Subject: [PATCH 11/13] remove unused import --- scripts/db_migrator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 77aab61d3e..734ef288ea 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -6,7 +6,6 @@ import sys import traceback import re -import subprocess from sonic_py_common import device_info, logger from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig From 4f62c072abfa94ee056ff082cc95bebf63aa6dd7 Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Mon, 6 Mar 2023 11:38:21 +0200 Subject: [PATCH 12/13] Update service_mgmt.sh.j2 --- sonic-utilities-data/templates/service_mgmt.sh.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-utilities-data/templates/service_mgmt.sh.j2 b/sonic-utilities-data/templates/service_mgmt.sh.j2 index 5c451f36bc..9237e04878 100644 --- a/sonic-utilities-data/templates/service_mgmt.sh.j2 +++ b/sonic-utilities-data/templates/service_mgmt.sh.j2 @@ -51,7 +51,7 @@ function check_warm_boot() function check_fast_boot() { - SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB GET "FAST_RESTART_ENABLE_TABLE|system" enable` + SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB hget "FAST_RESTART_ENABLE_TABLE|system" enable` if [[ x"${SYSTEM_FAST_REBOOT}" == x"true" ]]; then FAST_BOOT="true" else From 4b5aa99447ffbdd010558f797092c26c3ef20622 Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Thu, 9 Mar 2023 10:11:07 +0200 Subject: [PATCH 13/13] use $SONIC_DB_CLI instead of sonic-db-cli --- sonic-utilities-data/templates/service_mgmt.sh.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-utilities-data/templates/service_mgmt.sh.j2 b/sonic-utilities-data/templates/service_mgmt.sh.j2 index 9237e04878..5c8f4e4974 100644 --- a/sonic-utilities-data/templates/service_mgmt.sh.j2 +++ b/sonic-utilities-data/templates/service_mgmt.sh.j2 @@ -51,7 +51,7 @@ function check_warm_boot() function check_fast_boot() { - SYSTEM_FAST_REBOOT=`sonic-db-cli STATE_DB hget "FAST_RESTART_ENABLE_TABLE|system" enable` + SYSTEM_FAST_REBOOT=`$SONIC_DB_CLI STATE_DB hget "FAST_RESTART_ENABLE_TABLE|system" enable` if [[ x"${SYSTEM_FAST_REBOOT}" == x"true" ]]; then FAST_BOOT="true" else