]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: validate fsid during ceph-volume command 42523/head
authorMichael Fritch <mfritch@suse.com>
Tue, 27 Jul 2021 21:56:25 +0000 (15:56 -0600)
committerMichael Fritch <mfritch@suse.com>
Wed, 28 Jul 2021 13:44:09 +0000 (07:44 -0600)
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm
src/cephadm/tests/test_cephadm.py

index a515cb24c5454dd0777d71b0daf3aa3f1f2ea952..a198cbcce59e23f0081144055cc2837fcd82e7c4 100755 (executable)
@@ -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)
index 9fe381c12609211a817c5dfb0d0b8f61c53d5e4b..a4ea384708a3377f0b1db1d62d1e59582604fdaa 100644 (file)
@@ -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)