Project

General

Profile

Actions

Bug #50954

closed

mgr/pybind/snap_schedule: commands only support positional arguments?

Added by Sébastien Han almost 3 years ago. Updated almost 3 years ago.

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

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Labels (FS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

It looks like the module does not support passing optional ceph arguments.

See:

ceph --connect-timeout=15 --cluster=rook-ceph --conf=/var/lib/rook/rook-ceph/rook-ceph.config --name=client.admin --keyring=/var/lib/rook/rook-ceph/client.admin.keyring --format plain --out-file /tmp/980504643 fs snap-schedule status / recursive=true fs=myfs2 format=json

Will return:

. : Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1337, in _handle_command
    return CLICommand.COMMANDS[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 385, in call
    kwargs = self._collect_args_by_argspec(cmd_dict)
  File "/usr/share/ceph/mgr/mgr_module.py", line 377, in _collect_args_by_argspec
    name, raw_v)
  File "/usr/share/ceph/mgr/mgr_module.py", line 360, in _get_arg_value
    k, v = val.split('=', 1)
ValueError: not enough values to unpack (expected 2, got 1)

It looks like the script supports its own arguments and not in a consistent way.

The script should support any ceph options passed via the CLI.

Actions #1

Updated by Sebastian Wagner almost 3 years ago

Can you use proper positional arguments here?

ceph fs snap-schedule status / --recursive=true --fs=myfs2 --format=json

I for one don't think having _get_arg_value in mgr_module is super useful.

See also https://github.com/ceph/ceph/pull/36910

Actions #2

Updated by Sage Weil almost 3 years ago

  • Status changed from New to Resolved
  • Pull request ID set to 41509
Actions #3

Updated by Sébastien Han almost 3 years ago

Sebastian Wagner wrote:

Can you use proper positional arguments here?

[...]

I for one don't think having _get_arg_value in mgr_module is super useful.

See also https://github.com/ceph/ceph/pull/36910

See:

[root@rook-ceph-operator-75c6d6bbfc-wqlnc /]# ceph --connect-timeout=15 --cluster=rook-ceph --conf=/var/lib/rook/rook-ceph/rook-ceph.config --name=client.admin --keyring=/var/lib/rook/rook-ceph/client.admin.keyring --format plain --out-file /tmp/980504643 fs snap-schedule status / --recursive=true --fs=myfs2 --format=json
Invalid command: Unexpected argument '--recursive=true'
fs snap-schedule status [<path>] [<subvol>] [<fs>] [<format>] :  List current snapshot schedules
Traceback (most recent call last):
  File "/usr/bin/ceph", line 1310, in <module>
    retval = main()
  File "/usr/bin/ceph", line 1256, in main
    outf.write(outbuf)
TypeError: a bytes-like object is required, not 'str'
Actions

Also available in: Atom PDF