From: Michael Fritch Date: Tue, 27 Jul 2021 21:56:25 +0000 (-0600) Subject: cephadm: validate fsid during ceph-volume command X-Git-Tag: v17.1.0~1249^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42523%2Fhead;p=ceph.git cephadm: validate fsid during ceph-volume command Signed-off-by: Michael Fritch --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index a515cb24c545..a198cbcce59e 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -4634,6 +4634,7 @@ def command_enter(ctx): @infer_fsid @infer_image +@validate_fsid def command_ceph_volume(ctx): # type: (CephadmContext) -> None cp = read_config(ctx.config) diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py index 9fe381c12609..a4ea384708a3 100644 --- a/src/cephadm/tests/test_cephadm.py +++ b/src/cephadm/tests/test_cephadm.py @@ -1545,6 +1545,14 @@ class TestCephVolume(object): cd.command_ceph_volume(ctx) assert ctx.fsid == fsid + cmd = self._get_cmd('--fsid', '00000000-0000-0000-0000-0000deadbeez') + with with_cephadm_ctx(cmd) as ctx: + err = 'not an fsid' + with pytest.raises(cd.Error, match=err): + retval = cd.command_shell(ctx) + assert retval == 1 + assert ctx.fsid == None + s = get_ceph_conf(fsid=fsid) f = cephadm_fs.create_file('ceph.conf', contents=s)