Skip to content

Commit

Permalink
Change db_migrator major version on master branch from version 2 to 3 (
Browse files Browse the repository at this point in the history
…#2272)

To add room for db_migrator changes in 202012 branch, changed the major version on master/202205 branches from "2" to "3"

This change is needed:
1. Since the existing master/202205 db versions cannot be backported to 202012 as they are not relevant to 202012.
Current latest DB version for 202012 is 2_0_0, to add newer versions 2_0_1 cannot be added as it is already used for master/202205 branch.
2. Since master/202205 branches should incremented major version that was reserved for 202012. Since 202205 used same major version as 202012, there is no place for migrator changes to go into 202012 branch.

Changed major version on migrator script. Updated test files.

Signed-off-by: Vaibhav Hemant Dixit <vaibhav.dixit@microsoft.com>
  • Loading branch information
vaibhavhd committed Jul 20, 2022
1 parent 65346ce commit 9e3ba82
Show file tree
Hide file tree
Showing 148 changed files with 126 additions and 126 deletions.
65 changes: 32 additions & 33 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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_3_0_5'

self.TABLE_NAME = 'VERSIONS'
self.TABLE_KEY = 'DATABASE'
Expand Down Expand Up @@ -600,13 +600,13 @@ def version_1_0_6(self):
abandon_method = self.mellanox_buffer_migrator.mlnx_abandon_pending_buffer_configuration
append_method = self.mellanox_buffer_migrator.mlnx_append_item_on_pending_configuration_list

if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_6', 'version_2_0_0') \
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_6', 'version_2_0_0') \
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_6', 'version_3_0_0') \
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_6', 'version_3_0_0') \
and (not self.mellanox_buffer_migrator.mlnx_is_buffer_model_dynamic() or \
self.migrate_config_db_buffer_tables_for_dynamic_calculation(speed_list, cable_len_list, '0', abandon_method, append_method)) \
and self.mellanox_buffer_migrator.mlnx_flush_new_buffer_configuration() \
and self.prepare_dynamic_buffer_for_warm_reboot(buffer_pools, buffer_profiles, buffer_pgs):
self.set_version('version_2_0_0')
self.set_version('version_3_0_0')
else:
self.prepare_dynamic_buffer_for_warm_reboot()

Expand All @@ -615,59 +615,59 @@ def version_1_0_6(self):
self.configDB.set_entry('DEVICE_METADATA', 'localhost', metadata)
log.log_notice('Setting buffer_model to traditional')

self.set_version('version_2_0_0')
self.set_version('version_3_0_0')

return 'version_2_0_0'
return 'version_3_0_0'

def version_2_0_0(self):
def version_3_0_0(self):
"""
Version 2_0_0.
Version 3_0_0.
"""
log.log_info('Handling version_2_0_0')
log.log_info('Handling version_3_0_0')
self.migrate_config_db_port_table_for_auto_neg()
self.set_version('version_2_0_1')
return 'version_2_0_1'
self.set_version('version_3_0_1')
return 'version_3_0_1'

def version_2_0_1(self):
def version_3_0_1(self):
"""
Version 2_0_1.
Version 3_0_1.
"""
log.log_info('Handling version_2_0_1')
log.log_info('Handling version_3_0_1')
warmreboot_state = self.stateDB.get(self.stateDB.STATE_DB, 'WARM_RESTART_ENABLE_TABLE|system', 'enable')

if warmreboot_state != 'true':
portchannel_table = self.configDB.get_table('PORTCHANNEL')
for name, data in portchannel_table.items():
data['lacp_key'] = 'auto'
self.configDB.set_entry('PORTCHANNEL', name, data)
self.set_version('version_2_0_2')
return 'version_2_0_2'
self.set_version('version_3_0_2')
return 'version_3_0_2'

def version_2_0_2(self):
def version_3_0_2(self):
"""
Version 2_0_2.
Version 3_0_2.
"""
log.log_info('Handling version_2_0_2')
log.log_info('Handling version_3_0_2')
self.migrate_qos_fieldval_reference_format()
self.set_version('version_2_0_3')
return 'version_2_0_3'
self.set_version('version_3_0_3')
return 'version_3_0_3'


def version_2_0_3(self):
def version_3_0_3(self):
"""
Version 2_0_3
Version 3_0_3
"""
log.log_info('Handling version_2_0_3')
log.log_info('Handling version_3_0_3')
if self.asic_type == "mellanox":
self.mellanox_buffer_migrator.mlnx_reclaiming_unused_buffer()
self.set_version('version_2_0_4')
return 'version_2_0_4'
self.set_version('version_3_0_4')
return 'version_3_0_4'

def version_2_0_4(self):
def version_3_0_4(self):
"""
Version 2_0_4
Version 3_0_4
"""
log.log_info('Handling version_2_0_4')
log.log_info('Handling version_3_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
Expand All @@ -677,14 +677,13 @@ def version_2_0_4(self):
if 'pfc_enable' in v:
v['pfcwd_sw_enable'] = v['pfc_enable']
self.configDB.set_entry('PORT_QOS_MAP', k, v)
return 'version_3_0_5'

return 'version_2_0_5'

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

def get_version(self):
Expand Down
4 changes: 2 additions & 2 deletions scripts/mellanox_buffer_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ def __init__(self, configDB, appDB, stateDB):
"spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t1_pool_shp"],
}
},
"version_2_0_0": {
# Version 2.0.0 is introduced for dynamic buffer calculation
"version_3_0_0": {
# Version 3.0.0 is introduced for dynamic buffer calculation
#
"pool_mapped_from_old_version": {
"spc1_t0_pool": "spc1_pool",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,6 @@
"admin_status": "up"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_0"
"VERSION": "version_3_0_0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,6 @@
"speed": "50000"
},
"VERSIONS|DATABASE": {
"VERSION": "version_2_0_3"
"VERSION": "version_3_0_3"
}
}
Loading

0 comments on commit 9e3ba82

Please sign in to comment.