Skip to content

Commit fc326b9

Browse files
committed
Cancel dummy migration
Signed-off-by: bingwang <[email protected]>
1 parent eaf4023 commit fc326b9

File tree

3 files changed

+19
-59
lines changed

3 files changed

+19
-59
lines changed

scripts/db_migrator.py

+17-57
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, namespace, socket=None):
4545
none-zero values.
4646
build: sequentially increase within a minor version domain.
4747
"""
48-
self.CURRENT_VERSION = 'version_2_0_5'
48+
self.CURRENT_VERSION = 'version_2_0_0'
4949

5050
self.TABLE_NAME = 'VERSIONS'
5151
self.TABLE_KEY = 'DATABASE'
@@ -409,6 +409,18 @@ def prepare_dynamic_buffer_for_warm_reboot(self, buffer_pools=None, buffer_profi
409409

410410
return True
411411

412+
def migrate_pfcwd_sw_enable_table(self):
413+
"""
414+
Migrate "pfc_enable" to "pfc_enable" and "pfcwd_sw_enable"
415+
1. pfc_enable means enable pfc on certain queues
416+
2. pfcwd_sw_enable means enable PFC software watchdog on certain queues
417+
"""
418+
qos_maps = self.configDB.get_table('PORT_QOS_MAP')
419+
for k, v in qos_maps.items():
420+
if 'pfc_enable' in v:
421+
v['pfcwd_sw_enable'] = v['pfc_enable']
422+
self.configDB.set_entry('PORT_QOS_MAP', k, v)
423+
412424
def version_unknown(self):
413425
"""
414426
version_unknown tracks all SONiC versions that doesn't have a version
@@ -544,65 +556,10 @@ def version_1_0_6(self):
544556
return 'version_2_0_0'
545557

546558
def version_2_0_0(self):
547-
"""
548-
Version 2_0_0 (A dummy migrator).
549-
"""
550-
log.log_info('Handling version_2_0_0')
551-
552-
self.set_version('version_2_0_1')
553-
return 'version_2_0_1'
554-
555-
def version_2_0_1(self):
556-
"""
557-
Version 2_0_1 (A dummy migrator).
558-
"""
559-
log.log_info('Handling version_2_0_1')
560-
561-
self.set_version('version_2_0_2')
562-
return 'version_2_0_2'
563-
564-
def version_2_0_2(self):
565-
"""
566-
Version 2_0_2 (A dummy migrator).
567-
"""
568-
log.log_info('Handling version_2_0_2')
569-
570-
self.set_version('version_2_0_3')
571-
return 'version_2_0_3'
572-
573-
def version_2_0_3(self):
574-
"""
575-
Version 2_0_3 (A dummy migrator).
576-
"""
577-
log.log_info('Handling version_2_0_3')
578-
579-
self.set_version('version_2_0_4')
580-
return 'version_2_0_4'
581-
582-
def version_2_0_4(self):
583-
"""
584-
Version 2_0_4
585-
"""
586-
log.log_info('Handling version_2_0_4')
587-
# Migrate "pfc_enable" to "pfc_enable" and "pfcwd_sw_enable"
588-
# 1. pfc_enable means enable pfc on certain queues
589-
# 2. pfcwd_sw_enable means enable PFC software watchdog on certain queues
590-
# By default, PFC software watchdog is enabled on all pfc enabled queues.
591-
qos_maps = self.configDB.get_table('PORT_QOS_MAP')
592-
for k, v in qos_maps.items():
593-
if 'pfc_enable' in v:
594-
v['pfcwd_sw_enable'] = v['pfc_enable']
595-
self.configDB.set_entry('PORT_QOS_MAP', k, v)
596-
self.set_version('version_2_0_5')
597-
598-
return 'version_2_0_5'
599-
600-
def version_2_0_5(self):
601559
"""
602560
Current latest version. Nothing to do here.
603561
"""
604-
log.log_info('Handling version_2_0_5')
605-
return None
562+
log.log_info('Handling version_2_0_0')
606563

607564
def get_version(self):
608565
version = self.configDB.get_entry(self.TABLE_NAME, self.TABLE_KEY)
@@ -652,6 +609,9 @@ def common_migration_ops(self):
652609
# version 2_0_1 has been occupied by 202106
653610
if self.asic_type == "mellanox":
654611
self.mellanox_buffer_migrator.mlnx_reclaiming_unused_buffer()
612+
613+
# Migrate pfcwd_sw_enable table
614+
self.migrate_pfcwd_sw_enable_table()
655615

656616
def migrate(self):
657617
version = self.get_version()

tests/db_migrator_input/config_db/qos_map_table_expected.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"VERSIONS|DATABASE": {
3-
"VERSION": "version_2_0_5"
3+
"VERSION": "version_2_0_0"
44
},
55
"PORT_QOS_MAP": {
66
"Ethernet0": {

tests/db_migrator_input/config_db/qos_map_table_input.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"VERSIONS|DATABASE": {
3-
"VERSION": "version_2_0_4"
3+
"VERSION": "version_2_0_0"
44
},
55
"PORT_QOS_MAP": {
66
"Ethernet0": {

0 commit comments

Comments
 (0)