Project

General

Profile

Actions

Bug #51145

closed

pybind/cmd_argparse: does not process vector of choices

Added by Patrick Donnelly almost 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Category:
-
Target version:
% Done:

0%

Source:
Development
Tags:
Backport:
pacific
Regression:
No
Severity:
1 - critical
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

pdonnell@vossi04 ~/ceph/build$ bin/ceph tell mds.c scrub start / --scrubops=force,repair 
*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
2021-06-08T21:54:27.297+0000 7f05948e4700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-08T21:54:27.330+0000 7f058f59e700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-08T21:54:27.369+0000 7f0558ff9700  0 client.4358 ms_handle_reset on v2:127.0.0.1:6830/3706968407
Invalid command: force,repair not in force|recursive|repair
scrub start <path> [force|recursive|repair...] [<tag>] :  scrub and inode and output results
Error EINVAL: invalid command
pdonnell@vossi04 ~/ceph/build$ bin/ceph tell mds.c scrub start / --scrubops=force\|repair 
*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
2021-06-08T21:54:32.303+0000 7f5c5a0a0700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-08T21:54:32.337+0000 7f5c5a0a0700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-08T21:54:32.375+0000 7f5c21ffb700  0 client.4369 ms_handle_reset on v2:127.0.0.1:6830/3706968407
Invalid command: force|repair not in force|recursive|repair
scrub start <path> [force|recursive|repair...] [<tag>] :  scrub and inode and output results
Error EINVAL: invalid command
pdonnell@vossi04 ~/ceph/build$ bin/ceph tell mds.c scrub start / force,repair mytag
*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
2021-06-08T21:54:59.573+0000 7fbda6d14700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-08T21:54:59.610+0000 7fbda6d14700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-08T21:54:59.649+0000 7fbd66ffd700  0 client.4380 ms_handle_reset on v2:127.0.0.1:6830/3706968407
Invalid command: unused arguments: ['mytag']
scrub start <path> [force|recursive|repair...] [<tag>] :  scrub and inode and output results
Error EINVAL: invalid command

For Pacific and master branches.


Related issues 3 (0 open3 closed)

Related to CephFS - Bug #51182: pybind/mgr/snap_schedule: Invalid command: Unexpected argument 'fs=cephfs'ResolvedPatrick Donnelly

Actions
Related to CephFS - Bug #51146: qa: scrub code does not join scrubopts with commaResolvedPatrick Donnelly

Actions
Copied to Ceph - Backport #51233: pacific: pybind/cmd_argparse: does not process vector of choicesResolvedPatrick DonnellyActions
Actions #1

Updated by Patrick Donnelly almost 3 years ago

The Ceph C++ code does process these as expected:

test.py:

import glob
import os
import socket
import sqlite3
import struct
import sys
import time
from contextlib import closing

class AdminSocket:
    #SO_PEERCRED = 17 # Pulled from /usr/include/asm-generic/socket.h

    def __init__(self, path):
        self.path = path
        self.getid()

    def getid(self):
        with closing(socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)) as sock:
            sock.connect(self.path)
            creds = sock.getsockopt(socket.SOL_SOCKET, socket.SO_PEERCRED, struct.calcsize('3i'))
            self.pid, self.uid, self.gid = struct.unpack('3i',creds)
            # Do something so we don't see an error: "AdminSocket: error reading request code: (0) Success" 
            sock.sendall(b"{\"prefix\": \"help\", \"format\": \"json\"}\x00")
            length = struct.unpack('>i', sock.recv(4))[0]
            sock.recv(length, socket.MSG_WAITALL)

    def cmd(self, J):
        J = J.encode('utf-8') + b'\x00'
        with closing(socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)) as sock:
            sock.connect(self.path)
            sock.sendall(J)
            length = struct.unpack('>i', sock.recv(4))[0]
            return sock.recv(length, socket.MSG_WAITALL)

a = AdminSocket("/tmp/ceph-asok.jxTcHk/mds.c.asok")
print(a.cmd('{"prefix":"status", "format":"json"}'))
print(a.cmd('{"prefix":"scrub start", "path":"/", "scrubops":["force","recursive"], "format":"json"}'))
pdonnell@vossi04 ~/ceph/build$ python3 ~/test.py
b'{"cluster_fsid":"88c3e7d7-ca67-4ff5-91f9-5dc39f28bd2f","whoami":0,"id":4268,"want_state":"up:active","state":"up:active","fs_name":"a","rank_uptime":5933.0511824089999,"mdsmap_epoch":8,"osdmap_epoch":23,"osdmap_epoch_barrier":23,"uptime":5941.7142224130002}'
b'{"return_code":0,"scrub_tag":"051fa890-d2b3-43e3-9354-12b8b33ca6ce","mode":"asynchronous"}'
Actions #3

Updated by Patrick Donnelly almost 3 years ago

I was wrong about this bug being in Pacific: the old syntax works:

pdonnell@vossi04 ~/ceph/build$ bin/ceph tell mds.c scrub start / force recursive tag
*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
2021-06-09T03:00:49.022+0000 7f40686c1700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-09T03:00:49.061+0000 7f40686c1700 -1 WARNING: all dangerous and experimental features are enabled.
2021-06-09T03:00:49.129+0000 7f402cff9700  0 client.4386 ms_handle_reset on v2:127.0.0.1:6830/1517164866
2021-06-09T03:00:49.241+0000 7f402cff9700  0 client.4393 ms_handle_reset on v2:127.0.0.1:6830/1517164866
{   
    "return_code": 0,
    "scrub_tag": "tag",
    "mode": "asynchronous" 
}

(Did we intend to break the old syntax with the recent positional argument changes?)

Actions #4

Updated by Kefu Chai almost 3 years ago

  • Status changed from New to Fix Under Review
  • Assignee set to Kefu Chai
  • Pull request ID set to 41773
Actions #5

Updated by Patrick Donnelly almost 3 years ago

  • Related to Bug #51182: pybind/mgr/snap_schedule: Invalid command: Unexpected argument 'fs=cephfs' added
Actions #6

Updated by Patrick Donnelly almost 3 years ago

  • Status changed from Fix Under Review to Pending Backport
Actions #7

Updated by Backport Bot almost 3 years ago

  • Copied to Backport #51233: pacific: pybind/cmd_argparse: does not process vector of choices added
Actions #8

Updated by Patrick Donnelly almost 3 years ago

  • Related to Bug #51146: qa: scrub code does not join scrubopts with comma added
Actions #9

Updated by Loïc Dachary almost 3 years ago

  • Status changed from Pending Backport to Resolved

While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".

Actions

Also available in: Atom PDF