]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cephadm: support --infer-name option for lazy devs
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 8 Apr 2025 23:06:45 +0000 (19:06 -0400)
committerAdam King <adking@redhat.com>
Sat, 21 Jun 2025 18:08:13 +0000 (14:08 -0400)
commitd7ba3cb08eaa0b885171bbcd68d0eac0f22e2ac1
treeb1b34c1dc63395b006db28807729f63af3cf1b54
parente01243e99c03d93e9e1597bce8d11d806a4cdfab
cephadm: support --infer-name option for lazy devs

Add an --infer-name/-i option to the cephadm enter command. This new
option is a spin on --name/-n but allows the value to be partial.
The first part of the value must be a service type (like `mgr`, `mds`,
`nfs`, etc). That can then be followed optionally by a dot (.) and
a part (or whole) of an id. For example:

Enter the one and only mgr container running on this host:
```
cephadm enter -i mgr
```

Enter a (primary) smb container running on this host belonging to
the virtual cluster "cluster1", without specifying random chars or
rank values:
```
cephadm enter -i smb.cluster1
```

If the partial name does not match any services on the host or it
matches more than 1 service on the host it will return an error.
In the case of >1 service you can then supply more characters in
the partial id to narrow down the match. For example:
```
cephadm enter -i osd
Inferring fsid bf7116b2-2b9d-11f0-bb35-525400220000
ERROR: too many daemons match 'osd' (osd.2, osd.5)

/tmp/cephadm enter -i osd.2
Inferring fsid bf7116b2-2b9d-11f0-bb35-525400220000
Inferring daemon osd.2
[ceph: root@ceph0 /]#
```

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 211e677f1d42ea3de76981128b18f1c914841d27)
src/cephadm/cephadm.py
src/cephadm/cephadmlib/container_lookup.py