Project

General

Profile

Bug #41391

ceph-volume doesn't detect invalid options

Added by Guillaume Abrioux over 4 years ago. Updated over 4 years ago.

Status:
Won't Fix
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

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

Description

While doing some tests to zap osds, I've made a typo on the '--osd_fsid' option I passed (which is actually --osd-fsid):

-bash-4.2# docker run --rm -ti --ulimit nofile=1024:4096 --privileged=true --net=host --pid=host --ipc=host -e CEPH_VOLUME_DEBUG=1 -v /dev:/dev -v /var/lib/ceph:/var/lib/ceph -v /etc/ceph:/etc/ceph -v /var/run:/var/run --entrypoint=ceph-volume docker.io/guits/ceph:ceph_volume_legady_devices-nautilus-centos-7-x86_64 lvm zap --destroy --osd_fsid d70c5ff5-a04d-4a1e-ab22-33f3393b1d93
stderr: lsblk: d70c5ff5-a04d-4a1e-ab22-33f3393b1d93: not a block device
stderr: error: d70c5ff5-a04d-4a1e-ab22-33f3393b1d93: No such file or directory
stderr: Unknown device, --name=, --path=, or absolute path in /dev/ or /sys expected.
usage: ceph-volume lvm zap [-h] [--destroy] [--osd-id OSD_ID]
[--osd-fsid OSD_FSID]
[DEVICES [DEVICES ...]]
ceph-volume lvm zap: error: Unable to proceed with non-existing device: d70c5ff5-a04d-4a1e-ab22-33f3393b1d93

I think ceph-volume should detect an invalid option has been passed and explicitly report it like "--osd_fsid: unknown option".

seen on ceph version 14.2.2 (4f8fa0a0024755aae7d95567c63f11d6862d55be) nautilus (stable)

History

#1 Updated by Jan Fajerski over 4 years ago

  • Status changed from New to Won't Fix

I agree. The issue is that the combination of an optional positional argument with a type validator and an optional flag clash. the arg parser assumes that d70c5ff5-a04d-4a1e-ab22-33f3393b1d93 is the positional arg and tries to validate it (which fails). Only if this would succeed would it try to parse the optional arguments.

This is rather tricky to work around while keeping the current cli interface.

If c-v gets to parsing the optional arguments, it will actually complain about the unknown arg. Try for example:

ceph-volume lvm zap --osd_fsid=d70c5ff5-a04d-4a1e-ab22-33f3393b1d93 --destroy

This avoids the attempt to interpret d70c5ff5-a04d-4a1e-ab22-33f3393b1d93 as a device and gives you the expected error

ceph-volume lvm zap: error: unrecognized arguments: --osd_fsid=d70c5ff5-a04d-4a1e-ab22-33f3393b1d93

Also available in: Atom PDF