Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force use unix domain socket when namespace not empty #797

Merged
merged 7 commits into from
Sep 11, 2023

Conversation

liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented Jun 16, 2023

Force use unix domain socket when namespace not empty

Work item tracking

Microsoft ADO (number only): 21776191

Why I did it

Change cli behavior same with python version.

How I did it

Force use unix domain socket when namespace not empty

How to verify it

Add UT.
Pass all UT.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Force use unix domain socket when namespace not empty

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@liuh-80 liuh-80 changed the title Force use UDS when namespace not empty [WIP] Force use UDS when namespace not empty Jun 16, 2023
@liuh-80
Copy link
Contributor Author

liuh-80 commented Jun 17, 2023

Code change in this PR verified with sonic-buildimage PR https://github.com/sonic-net/sonic-buildimage/pull/15509/checks?check_run_id=15581285814

@liuh-80
Copy link
Contributor Author

liuh-80 commented Jul 18, 2023

PR validation failed:
sonic-net/sonic-buildimage#15509

This is because swss-common code change break sonic cli:
#789

Will wait for that issue fix first.

@liuh-80 liuh-80 changed the title [WIP] Force use UDS when namespace not empty [WIP] Force use unix domain socket when namespace not empty Jul 18, 2023
@liuh-80
Copy link
Contributor Author

liuh-80 commented Jul 24, 2023

Will run validation again after #804 merged

@@ -3,7 +3,7 @@
"redis":{
"hostname" : "127.0.0.1",
"port": 6379,
"unix_socket_path": "/var/run/redis0/redis.sock"
"unix_socket_path": "/var/run/redis/redis.sock"
Copy link
Contributor

@qiluo-msft qiluo-msft Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redis

why changing test data? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is not correct.
Our UT never using unix_socket_path before.
But when change sonic-db-cli to user unix domian socket. some UT failed, so need this this value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we need to fix test code/data if it just start under testing.
This is used in multi-db feature, and you can see a pattern that database_configN.json will have a path /var/run/redisN/redis.sock. So if it is not working due to missing sock file, we need to start multiple redis-server, each with proper config on sock files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, keeps the original config no change and add new config file for asic2 and asic3.

@qiluo-msft
Copy link
Contributor

qiluo-msft commented Aug 1, 2023

Please add PR description. #Closed

@liuh-80
Copy link
Contributor Author

liuh-80 commented Aug 3, 2023

Please add PR description.

Fixed.

@liuh-80 liuh-80 changed the title [WIP] Force use unix domain socket when namespace not empty Force use unix domain socket when namespace not empty Aug 3, 2023
@liuh-80 liuh-80 marked this pull request as ready for review August 3, 2023 16:01
@qiluo-msft qiluo-msft merged commit 6a1ff52 into sonic-net:master Sep 11, 2023
14 checks passed
SviatoslavBoichuk pushed a commit to SviatoslavBoichuk/sonic-swss-common that referenced this pull request Sep 14, 2023
Force use unix domain socket when namespace not empty

#### Work item tracking
Microsoft ADO (number only): 21776191

#### Why I did it
Change cli behavior same with python version.

#### How I did it
Force use unix domain socket when namespace not empty

#### How to verify it
Add UT.
Pass all UT.

### Description for the changelog
Force use unix domain socket when namespace not empty
qiluo-msft pushed a commit that referenced this pull request Mar 29, 2024
…o start up in LC (#866)

### Why I did it
On multiasic LC,  instance database# failed to start due to the sonic-db-cli -n asic# PING failed.  soinc-db-cli -n asic0 PING failed which results in the /usr/bin/database.sh wait forever in the postStartAction(). Fixes sonic-net/sonic-buildimage#18395

#### How I did it
On multiasic LC,  sonic-db-cli -n asic0 PING has been fixed/changed by PR   #797.  But when execute "sonic-db-cli -n asic0 PING" command, it will fail to ping the CHASSIS_STATE_DB and CHASSIS_APP_DB in the database-chassis on the supervisor card.  The existing code uses db_name to check against 
 "redis_chassis.server" identify if it is for database-chassis is wrong.  This commit uses  variable "host" instead of db_name.  This will fix the issue.

#### How to verify it
1. Boot up the chassis, execuet " docker ps" to verify the instance database0 and database1 containers are up.
```
admin@ixre-egl-board40:~$ docker ps 
CONTAINER ID   IMAGE                                COMMAND                  CREATED          STATUS          PORTS     NAMES
d2dc397d420a   docker-macsec:latest                 "/usr/local/bin/supe?"   34 minutes ago   Up 34 minutes             macsec
fd60a96fcb67   docker-snmp:latest                   "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                snmp
168cf9ae286d   docker-platform-monitor:latest       "/usr/bin/docker_ini?"   6 hours ago      Up 6 hours                pmon
9f1c69112fdb   docker-sonic-mgmt-framework:latest   "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                mgmt-framework
01cb833ab7b6   docker-lldp:latest                   "/usr/bin/docker-lld?"   6 hours ago      Up 6 hours                lldp1
ec6a965669eb   docker-lldp:latest                   "/usr/bin/docker-lld?"   6 hours ago      Up 6 hours                lldp0
16dd25d29d7b   docker-lldp:latest                   "/usr/bin/docker-lld?"   6 hours ago      Up 6 hours                lldp
46ce9b823873   docker-sonic-gnmi:latest             "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                gnmi
5f36560338e0   docker-fpm-frr:latest                "/usr/bin/docker_ini?"   6 hours ago      Up 6 hours                bgp1
3b1abe66e7a1   docker-fpm-frr:latest                "/usr/bin/docker_ini?"   6 hours ago      Up 6 hours                bgp0
85cd5b6cdd05   docker-router-advertiser:latest      "/usr/bin/docker-ini?"   6 hours ago      Up 6 hours                radv
ca8f79f69122   docker-teamd:latest                  "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                teamd0
5fe4b55ac62e   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                syncd1
81b6ef493818   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                syncd0
4e32dd244b65   docker-teamd:latest                  "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                teamd1
4f83bee7ffba   docker-orchagent:latest              "/usr/bin/docker-ini?"   6 hours ago      Up 6 hours                swss0
4e2c047effa8   docker-orchagent:latest              "/usr/bin/docker-ini?"   6 hours ago      Up 6 hours                swss1
0b6d7e742c0f   docker-eventd:latest                 "/usr/local/bin/supe?"   6 hours ago      Up 6 hours                eventd
5c77bae968e0   docker-database:latest               "/usr/local/bin/dock?"   6 hours ago      Up 6 hours                database1
d4616de64435   docker-database:latest               "/usr/local/bin/dock?"   6 hours ago      Up 6 hours                database0
27403c8acffa   docker-database:latest               "/usr/local/bin/dock?"   6 hours ago      Up 6 hours                database
```
@rlhui
Copy link

rlhui commented May 1, 2024

@qiluo-msft , @liuh-80 , chassis community thinks that this change may bring bring back the multi-asic show commands issues as in sonic-net/sonic-buildimage#6982, please share your thoughts and/or whether these show commands tests are passing (these should be in multi-asic taccas sonic-mgmt tests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants