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
ceph: allow for non-positional optional CLI arguments #41509
Conversation
@liewegas this changeset is non-trivial, i will take a closer look at it next week. |
Yep! Thanks for taking a look. My main reservation is that the form of the JSON we are generating is wonky.. things like |
@liewegas will this solve https://tracker.ceph.com/issues/50954 too? Or perhaps modules' CLI are treated independently? |
agreed. it should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apart from the nits, i just don't really get one thing: the has_default
parameter in:
def _compound_type_to_argdesc(tp, attrs, has_default, positional):
once i am able to get my head around this, it will lgtm.
Signed-off-by: Sage Weil <sage@newdream.net>
If an arg is non-positional, always show it as [--arg-name <value>] (All non-positional args are optional.) Signed-off-by: Sage Weil <sage@newdream.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2021-06-04T02:49:23.617 DEBUG:teuthology.orchestra.run.smithi045:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph nfs export create cephfs nfs-cephfs test /cephfs3 /volumes/_nogroup/sub_vol/ed3d73eb-3d51-444b-919a-
f81387b3df6d
2021-06-04T02:49:23.987 DEBUG:teuthology.orchestra.run:got remote process result: 22
2021-06-04T02:49:23.988 INFO:teuthology.orchestra.run.smithi045.stderr:Invalid command: Unexpected argument '/volumes/_nogroup/sub_vol/ed3d73eb-3d51-444b-919a-f81387b3df6d'
2021-06-04T02:49:23.988 INFO:teuthology.orchestra.run.smithi045.stderr:nfs export create cephfs <fsname> <clusterid> <binding> [--readonly] [--path <value>] : Create a cephfs export
2021-06-04T02:49:23.988 INFO:teuthology.orchestra.run.smithi045.stderr:Error EINVAL: invalid command
2021-06-04T02:49:23.989 DEBUG:teuthology.orchestra.run.smithi045:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph log 'Ended test tasks.cephfs.test_nfs.TestNFS.test_create_multiple_exports'
2021-06-04T02:49:24.313 INFO:journalctl@ceph.mon.a.smithi045.stdout:Jun 04 02:49:24 smithi045 ceph-mon[31481]: from='client.14645 -' entity='client.admin' cmd=[{"prefix": "fs subvolume getpath", "vol_name": "nfs-cephfs", "sub_name": "sub_vol", "target": ["mon-mgr", ""]}]: dispatch
2021-06-04T02:49:24.314 INFO:journalctl@ceph.mon.a.smithi045.stdout:Jun 04 02:49:24 smithi045 ceph-mon[31481]: pgmap v165: 97 pgs: 97 active+clean; 15 KiB data, 20 MiB used, 268 GiB / 268 GiB avail; 1.5 KiB/s rd, 1.6 KiB/s wr, 3 op/s
2021-06-04T02:49:24.314 INFO:journalctl@ceph.mon.a.smithi045.stdout:Jun 04 02:49:24 smithi045 ceph-mon[31481]: from='client.14647 -' entity='client.admin' cmd=[{"prefix": "nfs export create cephfs", "fsname": "nfs-cephfs", "clusterid": "test", "binding": "/cephfs2", "readonly": true, "path": "/volumes/_nogroup/sub_vol/ed3d73eb-3d51-444b-919a-f81387b3df6d", "target": ["mon-mgr", ""]}]: dispatch
2021-06-04T02:49:24.314 INFO:journalctl@ceph.mon.a.smithi045.stdout:Jun 04 02:49:24 smithi045 ceph-mon[31481]: mgrmap e26: a(active, since 4m)
2021-06-04T02:49:24.314 INFO:journalctl@ceph.mon.a.smithi045.stdout:Jun 04 02:49:24 smithi045 ceph-mon[31481]: from='client.? 172.21.15.45:0/2224977036' entity='client.admin' cmd=[{"prefix": "auth ls"}]: dispatch
2021-06-04T02:49:25.146 INFO:tasks.cephfs_test_runner:test_create_multiple_exports (tasks.cephfs.test_nfs.TestNFS) ... ERROR
this change breaks "test_create_multiple_exports " in tasks.cephfs.test_nfs.TestNFS
, which executes
$ ceph --cluster ceph nfs export create cephfs nfs-cephfs test /cephfs3 /volumes/_nogroup/sub_vol/ed3d73eb-3d51-444b-919a-f81387b3df6d'
2052a4b
to
4b908a2
Compare
These are old bool options that never got converted to CephBool. Signed-off-by: Sage Weil <sage@newdream.net>
This was broken, since it was trying to get a CephChoices as a bool. Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
If the mon is not yet quincy, do not share the quincy-ism of 'positional=false'. Signed-off-by: Sage Weil <sage@newdream.net>
Everything after --readonly is non-positional. Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Instead of '"req": "false"', emit '"req": false'. Same for conditional. Luckily, the clients don't really care about this change, as ceph_argparse.py argdesc interpets the JSON like so: self.req = req in (True, 'True', 'true') self.positional = positional in (True, 'True', 'true') Clean up command definitions to use lowercase 'false', but tolerate both for backward compat during upgrade and to tolerate future errors. Signed-off-by: Sage Weil <sage@newdream.net>
Put path before --readonly so that it can still be positional. Signed-off-by: Sage Weil <sage@newdream.net>
The tell/asok validation uses a different validation path; make it work for CephBool arguments. Signed-off-by: Sage Weil <sage@newdream.net>
@leseb i have no idea if we want to backport it or not. presumably, it's not a bug fix or a prerequisite for a critical feature required by pacific. am i right? |
Well @liewegas added this as a fix for https://tracker.ceph.com/issues/50954. So it'd be nice to have some kind of backport. |
Currently any optional argument may be specified as a flag (--arg val) or positionally. The ability to specify flags positionally is confusing, and not something that other CLIs allow. This PR makes it possible to mark the end of positional (and possibly optinoal) arguments and the beginning of optional flags (that must use the '--flagname value' syntax).
Also,
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox