cephadm: validate fsid during ceph-volume command

Signed-off-by: Michael Fritch <mfritch@suse.com>
This commit is contained in:
Michael Fritch 2021-07-27 15:56:25 -06:00
parent 25febfd9e0
commit f0609429c0
No known key found for this signature in database
GPG Key ID: 75F3EB2E80A03B7F
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View 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)