[db-migrator] Fix hwsku match for 6100 and add errors when hwsku is None#2821
Merged
yxieca merged 2 commits intosonic-net:masterfrom May 30, 2023
Merged
[db-migrator] Fix hwsku match for 6100 and add errors when hwsku is None#2821yxieca merged 2 commits intosonic-net:masterfrom
yxieca merged 2 commits intosonic-net:masterfrom
Conversation
kellyyeh
previously approved these changes
May 3, 2023
yxieca
reviewed
May 4, 2023
| if self.asic_type != "mellanox": | ||
| self.migrate_copp_table() | ||
| if self.asic_type == "broadcom" and 'Force10-S6100' in self.hwsku: | ||
| if self.asic_type == "broadcom" and 'Force10-S6100' in str(self.hwsku): |
Contributor
There was a problem hiding this comment.
Do you need to protect the possibility that self.hwsku is none?
Contributor
Author
There was a problem hiding this comment.
If self.hwsku is None then str(None) will convert None to a string and in check will still work.
Alternative is (as we want to ensure self.hwsku is always a string:
if self.asic_type == "broadcom" and type(self.hwsku) = str and 'Force10-S6100' in str(self.hwsku):
Contributor
tjchadaga
approved these changes
May 8, 2023
Contributor
|
can you add ado? |
yxieca
approved these changes
May 30, 2023
Contributor
|
@vaibhavhd This commit could not be cleanly cherry-picked to 202012. Please submit another PR. |
yxieca
pushed a commit
that referenced
this pull request
Jun 2, 2023
…one (#2821) * Fix hwsku match for 6100 and add errors when hwsku is None * Asic type fix
Contributor
|
@vaibhavhd , please create manually cherry-pick PR to 202012, if this PR not required for 202012, please remove 'Request for 202012 branch' label |
vaibhavhd
added a commit
that referenced
this pull request
Jul 24, 2023
…sku is None (#2896) Cherry pick of #2821 MSFT ADO: 17972494 Fix errors in db migration when hwsku is not detected. This PR is adds a better-error-handling fix for the issue that is fixed by: sonic-net/sonic-buildimage#14933 May 2 20:35:04 sonic database.sh[649]: Creating new database container May 2 20:35:04 sonic database.sh[663]: 99e8edba01ed0c7581f0d61dd2fa78374fa4f23e636a957004dd03a6f68eea86 May 2 20:35:04 sonic root: Starting database service... May 2 20:35:06 sonic database.sh[690]: database May 2 20:35:10 sonic database.sh[926]: True May 2 20:35:10 sonic database.sh[928]: File "/usr/local/bin/db_migrator.py", line 714, in common_migration_ops May 2 20:35:10 sonic database.sh[928]: File "/usr/local/bin/db_migrator.py", line 741, in migrate May 2 20:35:10 sonic database.sh[928]: File "/usr/local/bin/db_migrator.py", line 782, in main May 2 20:35:10 sonic database.sh[928]: Traceback (most recent call last): May 2 20:35:10 sonic database.sh[928]: TypeError: argument of type 'NoneType' is not iterable May 2 20:35:10 sonic database.sh[928]: argument of type 'NoneType' is not iterable May 2 20:35:10 sonic database.sh[928]: optional arguments: May 2 20:35:10 sonic database.sh[928]: usage: db_migrator.py [-h] [-o operation migrate, set_version, get_version] May 2 20:35:10 sonic db_migrator: :- operator(): DB '{APPL_DB}' is empty with pattern 'COPP_TABLE:*'! May 2 20:35:10 sonic db_migrator: :- operator(): DB '{APPL_DB}' is empty with pattern 'INTF_TABLE:*'! May 2 20:35:10 sonic db_migrator: :- operator(): Key 'BUFFER_MAX_PARAM_TABLE|global' field 'mmu_size' unavailable in database 'STATE_DB' May 2 20:35:10 sonic db_migrator: :- operator(): Key 'WARM_RESTART_ENABLE_TABLE|system' field 'enable' unavailable in database 'STATE_DB' May 2 20:35:10 sonic db_migrator: Caught exception: argument of type 'NoneType' is not iterable May 2 20:35:11 sonic config-setup[935]: Copying SONiC configuration minigraph.xml ... May 2 20:35:11 sonic config-setup[935]: Reloading minigraph... May 2 20:35:11 sonic config-setup[935]: Use minigraph.xml from old system... May 2 20:35:11 sonic root: Started database service... How I did it Convert hwsku's type to str before checking substring. Add error logs when hwsku and asic type information is not obtained. How to verify it Tested on a physical device
pdhruv-marvell
pushed a commit
to pdhruv-marvell/sonic-utilities
that referenced
this pull request
Aug 23, 2023
…one (sonic-net#2821) * Fix hwsku match for 6100 and add errors when hwsku is None * Asic type fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
MSFT ADO: 17972494
Fix errors in db migration when hwsku is not detected.
This PR is adds a better-error-handling fix for the issue that is fixed by: sonic-net/sonic-buildimage#14933
How I did it
Convert hwsku's type to
strbefore checking substring.Add error logs when hwsku and asic type information is not obtained.
How to verify it
Tested on a physical device
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)