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

Problems using new targetclid daemon #149

Open
gonzoleeman opened this issue Oct 6, 2019 · 6 comments
Open

Problems using new targetclid daemon #149

gonzoleeman opened this issue Oct 6, 2019 · 6 comments

Comments

@gonzoleeman
Copy link
Contributor

I have installed test latest configshell-fb (v1.1.26), rtslib-fb (v2.1.70), and targetcli (v2.1.50), and it all seems to work as expected, unless I try to use the targetclid daemon.

Even though the "make install" does install them, I copied targetclid.service and targetclid.socket into my systemd unit directory, ran "daemon-reload", and started them running, with no issues.Systemd says the service is running, and I can see targetclid running as a daemon using "ps".

But when I try to use the daemon, I get an error:

root@linux-tw7(1):public_software/open-iscsi/targetcli-fb# targetcli --tcp ls /
Traceback (most recent call last):
  File "/usr/bin/targetcli", line 4, in <module>
    __import__('pkg_resources').run_script('targetcli-fb==2.1.50', 'targetcli')
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.7/site-packages/targetcli_fb-2.1.50-py3.7.egg/EGG-INFO/scripts/targetcli", line 261, in <module>
  File "/usr/lib/python3.7/site-packages/targetcli_fb-2.1.50-py3.7.egg/EGG-INFO/scripts/targetcli", line 221, in main
  File "/usr/lib/python3.7/site-packages/targetcli_fb-2.1.50-py3.7.egg/EGG-INFO/scripts/targetcli", line 140, in call_daemon
TypeError: a bytes-like object is required, not 'str'

Because of recent python3 changes, I tried this fix:

diff --git a/scripts/targetcli b/scripts/targetcli
index b7a2467c0ba7..76eccc61cd93 100755
--- a/scripts/targetcli
+++ b/scripts/targetcli
@@ -218,7 +218,7 @@ def main():
             use_daemon = True
 
     if use_daemon:
-        call_daemon(shell, get_arguments())
+        call_daemon(shell, get_arguments().encode())
 
     try:
         root_node = UIRoot(shell, as_root=is_root)

That does get me past the stack trace, but then the targetcli command just hangs, waiting for a reply from targetclid.

And it's disappointing there isn't a debug logging option for targetclid. Nor a man page. Is targetclid experimental?

@pkalever
Copy link
Contributor

pkalever commented Oct 7, 2019

@gonzoleeman is your targetclid.service running ?

The unix socket activation is not working as expected (hangs) for me as well. Not sure about the root cause though.

I agree, having a man page for targetclid will be useful.

@maurizio-lombardi
Copy link
Collaborator

And it's disappointing there isn't a debug logging option for targetclid.
Nor a man page. Is targetclid experimental?

Indeed I would consider it as an experimental feature which still needs to be fully debugged.
@pkalever , do you have the time to investigate this problem with socket activation?

@pkalever
Copy link
Contributor

pkalever commented Oct 7, 2019

@maurizio-lombardi honestly as mentioned before, I tried to figure-out the issue earlier, and couldn't understand it fully.

It will be really quick and helpful if someone with better understanding about socket activation can help with it ? I remember it was @gonzoleeman who gave the idea about socket activation stuff. May be he can help us here with some code or clues about the root cause.

Problem I see is, the targetcli cli command gets stuck on the first call (which is when activating the dameon), if we quit the cli command (by this time daemon would have got activated already) and retry the same command then it all works.

Thanks!

@gonzoleeman
Copy link
Contributor Author

I am debugging this and believe I'll be able to figure it out.

I got the Python 3.7 issues with binary vs strings sorted out, and I fixed one bug that made it so that targetclid only handled one command, instead of multiple commands, and now I'm looking at the abstract namespace that systemd uses for its sockets.

@gonzoleeman
Copy link
Contributor Author

See pull request #150

@gonzoleeman
Copy link
Contributor Author

I have an updated pull request #151

Also, A man page can be added for targetclid(8) under a different/new issue.

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

No branches or pull requests

3 participants