Command "swift-init" is showing wrong output

Bug #1557337 reported by Kalaswan Datta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
In Progress
Undecided
Ankur Jain

Bug Description

I have installed packstack environment on Liberty. I am trying to identify the status of processes for each swift services.
I tried using the command "swift-init all status". But this command shows "No swift-xxx running".
Where as If I execute the ps -ef | grep "swift" command, it lists all the swift processes running on the system.
Please find the details below.
=======================================
[root@Liberty1 ~(keystone_admin)]# ps -ef | grep "swift"
swift 1321 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-account-reaper /etc/swift/account-server.conf
swift 1322 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-account-auditor /etc/swift/account-server.conf
swift 1323 1 0 11:11 ? 00:00:05 /usr/bin/python2 /usr/bin/swift-container-replicator /etc/swift/container-server.conf
swift 1324 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-container-auditor /etc/swift/container-server.conf
swift 1325 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-object-auditor /etc/swift/object-server.conf
swift 1326 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-object-updater /etc/swift/object-server.conf
swift 1328 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-object-expirer /etc/swift/object-expirer.conf
swift 1329 1 0 11:11 ? 00:00:01 /usr/bin/python2 /usr/bin/swift-account-replicator /etc/swift/account-server.conf
swift 1330 1 1 11:11 ? 00:01:16 /usr/bin/python2 /usr/bin/swift-container-server /etc/swift/container-server.conf
swift 1331 1 1 11:11 ? 00:01:18 /usr/bin/python2 /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
swift 1332 1 1 11:11 ? 00:01:17 /usr/bin/python2 /usr/bin/swift-account-server /etc/swift/account-server.conf
swift 1334 1 0 11:11 ? 00:00:04 /usr/bin/python2 /usr/bin/swift-object-replicator /etc/swift/object-server.conf
swift 1335 1 0 11:11 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-container-updater /etc/swift/container-server.conf
swift 3776 1332 0 11:12 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-account-server /etc/swift/account-server.conf
swift 3788 1330 0 11:12 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-container-server /etc/swift/container-server.conf
swift 3882 1331 0 11:12 ? 00:00:00 /usr/bin/python2 /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
root 2366 1511 0 12:41 pts/0 00:00:00 grep --color=auto swift

[root@Liberty1 ~(keystone_admin)]# swift-init all status
No container-updater running
No account-auditor running
No object-replicator running
No container-sync running
No container-replicator running
No object-auditor running
No object-expirer running
No container-auditor running
No container-server running
No object-reconstructor running
No object-server running
No account-reaper running
No proxy-server running
No account-replicator running
No object-updater running
No container-reconciler running
No account-server running
====================================================
According to my understanding the problem is there in Kilo release as well. Before that, for each process a particular PID file was created. But now the file is not created.

Ankur Jain (j-ankur)
Changed in swift:
assignee: nobody → Ankur Jain (j-ankur)
Revision history for this message
Kalaswan Datta (kalaswan-datta) wrote :

If the command "swift-init main restart" is executed, then the Code error is shown on screen.
=======================================================
[root@Liberty1 ~(keystone_admin)]# swift-init main restart
Signal proxy-server pid: 14330 signal: 15
Signal container-server pid: 14331 signal: 15
No container-server running
Signal account-server pid: 14332 signal: 15
No account-server running
Signal object-server pid: 14333 signal: 15
No object-server running
proxy-server (14330) appears to have stopped
Starting proxy-server...(/etc/swift/proxy-server.conf)
Starting container-server...(/etc/swift/container-server.conf)
Starting account-server...(/etc/swift/account-server.conf)
Starting object-server...(/etc/swift/object-server.conf)
Traceback (most recent call last):
  File "/usr/bin/swift-container-server", line 23, in <module>
    sys.exit(run_wsgi(conf_file, 'container-server', **options))
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 878, in run_wsgi
    error_msg = strategy.bind_ports()
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 480, in bind_ports
    self.sock = get_socket(self.conf)
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 201, in get_socket
    bind_addr[0], bind_addr[1], bind_timeout))
Exception: Could not bind to 192.168.52.131:6001 after trying for 30 seconds

Traceback (most recent call last):
  File "/usr/bin/swift-account-server", line 23, in <module>
    sys.exit(run_wsgi(conf_file, 'account-server', **options))
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 878, in run_wsgi
    error_msg = strategy.bind_ports()
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 480, in bind_ports
    self.sock = get_socket(self.conf)
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 201, in get_socket
    bind_addr[0], bind_addr[1], bind_timeout))
Exception: Could not bind to 192.168.52.131:6002 after trying for 30 seconds

Traceback (most recent call last):
  File "/usr/bin/swift-object-server", line 27, in <module>
    **options))
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 878, in run_wsgi
    error_msg = strategy.bind_ports()
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 480, in bind_ports
    self.sock = get_socket(self.conf)
  File "/usr/lib/python2.7/site-packages/swift/common/wsgi.py", line 201, in get_socket
    bind_addr[0], bind_addr[1], bind_timeout))
Exception: Could not bind to 192.168.52.131:6000 after trying for 30 seconds
======================================================================

Revision history for this message
Kalaswan Datta (kalaswan-datta) wrote :

According to my understanding there are few improvement points for this.

1. If the command is not functional in kilo and Liberty, then this command should be cleaned.
2. If cleaning is not possible, then error handling should be done, so that code error information should not be displayed on console.

Please suggest if any one has some point on this.

Changed in swift:
status: New → Confirmed
Revision history for this message
Sheel Rana (ranasheel2000) wrote :

This command seems not deprecated as per input from some members on IRC though same can be further confirmed.

We should fix this.

Revision history for this message
Sheel Rana (ranasheel2000) wrote :

Some extracts of discussion(only for reference):

"seems like there could be some improvements in cleaning up the output. so for that, sure, it could be worth fixing
eg the traceback output could be captured and turned into something cleaner and more helpful
I'd suggest starting with the traceback and treating that as one change by itself
and not worry with the pid or pidfile not finding an existing running process"

*Please dont consider this discussion extracts as final thoughts, this came out of some informal discussion so need to confirm further before fixing things on developer end*.

Revision history for this message
Ankur Jain (j-ankur) wrote :

As per suggestions, I have fixed to clean Traceback logs for "swift-init main restart":

Below will be output after fix:
No proxy-server running
No container-server running
No account-server running
No object-server running
Starting proxy-server...(/etc/swift/proxy-server.conf)
Starting container-server...(/etc/swift/container-server.conf)
Starting account-server...(/etc/swift/account-server.conf)
Starting object-server...(/etc/swift/object-server.conf)
Could not bind to 192.168.52.131:8080 after trying for 30 seconds

Could not bind to 192.168.52.131:6001 after trying for 30 seconds

Could not bind to 192.168.52.131:6002 after trying for 30 seconds

Could not bind to 192.168.52.131:6000 after trying for 30 seconds

I will submit patch soon.
Please let me know in case of any further suggestions.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

Fix proposed to branch: master
Review: https://review.openstack.org/299123

Changed in swift:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.