Skip to content

Commit

Permalink
Cancel dummy migration
Browse files Browse the repository at this point in the history
Signed-off-by: bingwang <[email protected]>
  • Loading branch information
bingwang-ms committed Jun 1, 2022
1 parent eaf4023 commit fc326b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 59 deletions.
74 changes: 17 additions & 57 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_2_0_5'
self.CURRENT_VERSION = 'version_2_0_0'

self.TABLE_NAME = 'VERSIONS'
self.TABLE_KEY = 'DATABASE'
Expand Down Expand Up @@ -409,6 +409,18 @@ def prepare_dynamic_buffer_for_warm_reboot(self, buffer_pools=None, buffer_profi

return True

def migrate_pfcwd_sw_enable_table(self):
"""
Migrate "pfc_enable" to "pfc_enable" and "pfcwd_sw_enable"
1. pfc_enable means enable pfc on certain queues
2. pfcwd_sw_enable means enable PFC software watchdog on certain queues
"""
qos_maps = self.configDB.get_table('PORT_QOS_MAP')
for k, v in qos_maps.items():
if 'pfc_enable' in v:
v['pfcwd_sw_enable'] = v['pfc_enable']
self.configDB.set_entry('PORT_QOS_MAP', k, v)

def version_unknown(self):
"""
version_unknown tracks all SONiC versions that doesn't have a version
Expand Down Expand Up @@ -544,65 +556,10 @@ def version_1_0_6(self):
return 'version_2_0_0'

def version_2_0_0(self):
"""
Version 2_0_0 (A dummy migrator).
"""
log.log_info('Handling version_2_0_0')

self.set_version('version_2_0_1')
return 'version_2_0_1'

def version_2_0_1(self):
"""
Version 2_0_1 (A dummy migrator).
"""
log.log_info('Handling version_2_0_1')

self.set_version('version_2_0_2')
return 'version_2_0_2'

def version_2_0_2(self):
"""
Version 2_0_2 (A dummy migrator).
"""
log.log_info('Handling version_2_0_2')

self.set_version('version_2_0_3')
return 'version_2_0_3'

def version_2_0_3(self):
"""
Version 2_0_3 (A dummy migrator).
"""
log.log_info('Handling version_2_0_3')

self.set_version('version_2_0_4')
return 'version_2_0_4'

def version_2_0_4(self):
"""
Version 2_0_4
"""
log.log_info('Handling version_2_0_4')
# Migrate "pfc_enable" to "pfc_enable" and "pfcwd_sw_enable"
# 1. pfc_enable means enable pfc on certain queues
# 2. pfcwd_sw_enable means enable PFC software watchdog on certain queues
# By default, PFC software watchdog is enabled on all pfc enabled queues.
qos_maps = self.configDB.get_table('PORT_QOS_MAP')
for k, v in qos_maps.items():
if 'pfc_enable' in v:
v['pfcwd_sw_enable'] = v['pfc_enable']
self.configDB.set_entry('PORT_QOS_MAP', k, v)
self.set_version('version_2_0_5')

return 'version_2_0_5'

def version_2_0_5(self):
"""
Current latest version. Nothing to do here.
"""
log.log_info('Handling version_2_0_5')
return None
log.log_info('Handling version_2_0_0')

def get_version(self):
version = self.configDB.get_entry(self.TABLE_NAME, self.TABLE_KEY)
Expand Down Expand Up @@ -652,6 +609,9 @@ def common_migration_ops(self):
# version 2_0_1 has been occupied by 202106
if self.asic_type == "mellanox":
self.mellanox_buffer_migrator.mlnx_reclaiming_unused_buffer()

# Migrate pfcwd_sw_enable table
self.migrate_pfcwd_sw_enable_table()

def migrate(self):
version = self.get_version()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_5"
"VERSION": "version_2_0_0"
},
"PORT_QOS_MAP": {
"Ethernet0": {
Expand Down
2 changes: 1 addition & 1 deletion tests/db_migrator_input/config_db/qos_map_table_input.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_4"
"VERSION": "version_2_0_0"
},
"PORT_QOS_MAP": {
"Ethernet0": {
Expand Down

0 comments on commit fc326b9

Please sign in to comment.