Skip to content

ceph-daemon: do not pass -it unless it is an interactive shell - #31181

Merged
liewegas merged 1 commit into
ceph:masterfrom
liewegas:wip-cd-tty
Oct 29, 2019
Merged

liewegas merged 1 commit into
ceph:masterfrom
liewegas:wip-cd-tty

Conversation

@liewegas

Copy link
Copy Markdown
Member

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs

Comment thread src/ceph-daemon Resolved
@tchaikov

Copy link
Copy Markdown
Contributor
186/186 Test  #14: test_objectstore_memstore.sh ............***Timeout 3600.02 sec

jenkins test make check

@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test make check

@liewegas

liewegas commented Oct 28, 2019 via email

Copy link
Copy Markdown
Member Author

Comment thread src/ceph-daemon Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

get_container needs a podman_args cmd

diff --git a/src/ceph-daemon b/src/ceph-daemon
index 94563545b7..369f55624e 100755
--- a/src/ceph-daemon
+++ b/src/ceph-daemon
@@ -365,8 +365,7 @@ def get_container_mounts(fsid, daemon_type, daemon_id):
 
     return mounts
 
-def get_container(fsid, daemon_type, daemon_id, privileged=False):
-    podman_args = []
+def get_container(fsid, daemon_type, daemon_id, privileged=False, podman_args=[]):
     if daemon_type == 'osd' or privileged:
         podman_args += ['--privileged']
     return CephContainer(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that in python you should not use an object like a list as a default argument - it does not work as you might expect: https://stackoverflow.com/a/366430

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

weird. updated! (and ran test_ceph_daemon this time)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Comment thread src/ceph-daemon Outdated

@mgfritch mgfritch Oct 29, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor fixup for shell cmd when no args are passed -

Suggested change
return subprocess.call(c.shell_cmd(args.command))
return subprocess.call(c.shell_cmd(command))
# ./ceph-daemon shell
Traceback (most recent call last):
  File "./ceph-daemon", line 1683, in <module>
    r = args.func()
  File "./ceph-daemon", line 1145, in command_shell
    return subprocess.call(c.shell_cmd(args.command))
  File "./ceph-daemon", line 714, in shell_cmd
    ] + cmd[1:]
IndexError: list index out of rang

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sigh, fixed. I want to do something like

diff --git a/qa/standalone/test_ceph_daemon.sh b/qa/standalone/test_ceph_daemon.sh
index 69ecb242646..af17925f1c1 100755
--- a/qa/standalone/test_ceph_daemon.sh
+++ b/qa/standalone/test_ceph_daemon.sh
@@ -133,6 +133,7 @@ $SUDO $CEPH_DAEMON unit --fsid $FSID --name mon.a -- is-enabled
 ## shell
 $SUDO $CEPH_DAEMON --image $IMAGE shell -- true
 $SUDO $CEPH_DAEMON --image $IMAGE shell --fsid $FSID -- test -d /var/log/ceph
+echo 'whoami ; exit' | $SUDO $CEPH_DAEMON --image $IMAGE shell
 
 ## enter
 expect_false $SUDO $CEPH_DAEMON enter
@@ -142,6 +143,8 @@ $SUDO $CEPH_DAEMON enter --fsid $FSID --name mon.a -- pidof ceph-mon
 expect_false $SUDO $CEPH_DAEMON enter --fsid $FSID --name mgr.x -- pidof ceph-mon
 $SUDO $CEPH_DAEMON enter --fsid $FSID --name mgr.x -- pidof ceph-mgr
 
+echo 'pidof ceph-mgr ; exit' | $SUDO $CEPH_DAEMON enter --fsid $FSID --name mgr.x
+
 ## ceph-volume
 $SUDO $CEPH_DAEMON --image $IMAGE ceph-volume --fsid $FSID -- inventory --format=json \
       | jq '.[]'

but i have a feeling this needs to use something like expect since there is maybe no tty?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Or maybe remove the -t option since a pty is not in use?

diff --git a/src/ceph-daemon b/src/ceph-daemon
index 949af8ffb2..c698ae152b 100755
--- a/src/ceph-daemon
+++ b/src/ceph-daemon
@@ -1138,7 +1138,7 @@ def command_shell():
     else:
         command = ['bash']
         podman_args += [
-            '-it',
+            '-i',
             '--env', 'LANG=C',
         ]
     c = CephContainer(
@@ -1159,7 +1159,7 @@ def command_enter():
     else:
         command = ['bash']
         podman_args += [
-            '-it',
+            '-i',
             '--env', 'LANG=C',
         ]
     c = get_container(args.fsid, daemon_type, daemon_id,

Otherwise, we get errors like

2019-10-26T17:29:42.004 INFO:tasks.workunit.client.0.mira109.stderr:+ sudo /usr/sbin/ceph-daemon shell -- ceph -v
2019-10-26T17:29:42.004 INFO:tasks.workunit.client.0.mira109.stderr:+ grep 'ceph version'
2019-10-26T17:29:42.149 INFO:tasks.workunit.client.0.mira109.stderr:the input device is not a TTY

Fixes: https://tracker.ceph.com/issues/42499
Signed-off-by: Sage Weil <[email protected]>
liewegas added a commit that referenced this pull request Oct 29, 2019
* refs/pull/31181/head:
	ceph-daemon: only pass podman -it if need an interactive shell

Reviewed-by: Sebastian Wagner <[email protected]>
Reviewed-by: Michael Fritch <[email protected]>
@liewegas
liewegas merged commit 8c7dbec into ceph:master Oct 29, 2019
@liewegas
liewegas deleted the wip-cd-tty branch October 29, 2019 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants