Skip to content

Commit

Permalink
[db_migrator][201911] Support shared headroom in db_migrator on Mella…
Browse files Browse the repository at this point in the history
…nox platform (sonic-net#1261)
  • Loading branch information
stephenxs authored Jan 7, 2021
1 parent a9ef1c5 commit 1dfb3e8
Show file tree
Hide file tree
Showing 83 changed files with 100,427 additions and 252 deletions.
29 changes: 28 additions & 1 deletion scripts/db_migrator.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
#!/usr/bin/env python

import os
import argparse
import sys
import traceback

from sonic_py_common import device_info, logger
from swsssdk import ConfigDBConnector, SonicDBConfig, SonicV2Connector

# mock the redis for unit test purposes #
try:
if os.environ["UTILITIES_UNIT_TESTING"] == "2":
modules_path = os.path.join(os.path.dirname(__file__), "..")
tests_path = os.path.join(modules_path, "tests")
mocked_db_path = os.path.join(tests_path, "db_migrator_input")
sys.path.insert(0, modules_path)
sys.path.insert(0, tests_path)
except KeyError:
pass


SYSLOG_IDENTIFIER = 'db_migrator'

Expand Down Expand Up @@ -205,10 +217,25 @@ def version_1_0_3(self):

def version_1_0_4(self):
"""
Current latest version. Nothing to do here.
Version 1_0_4.
"""
log.log_info('Handling version_1_0_4')

# Check ASIC type, if Mellanox platform then need DB migration
if self.asic_type == "mellanox":
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_4', 'version_1_0_5') and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_4', 'version_1_0_5'):
self.set_version('version_1_0_5')
else:
self.set_version('version_1_0_5')

return 'version_1_0_5'

def version_1_0_5(self):
"""
Current latest version. Nothing to do here.
"""
log.log_info('Handling version_1_0_5')

return None

def get_version(self):
Expand Down
802 changes: 553 additions & 249 deletions scripts/mellanox_buffer_migrator.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
package_data={
'show': ['aliases.ini'],
'sonic-utilities-tests': ['acl_input/*',
'db_migrator_input/config_db/*.json',
'mock_tables/*.py',
'mock_tables/*.json',
'mock_tables/asic0/*',
Expand Down
Loading

0 comments on commit 1dfb3e8

Please sign in to comment.