Project

General

Profile

Actions

Bug #59166

open

mon_command said error about goodchar but, it works.

Added by Seungrok Baek about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
MonClient
Target version:
-
% Done:

0%

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

Description

Hello, I think I found the bug in mon_command, librados(v16.2.10).

My Environment
- CentOS 8 Stream
- GCC 11.2.1
- Ceph 16.2.10 with same version of librados, librbd, libcephfs, etc.

I am using, mon_command for using CephFS.

There is a concept, whose name is goodchars, in mon_command like below.
Of course, this can be seen when you call {"prefix": "get_command_descriptions"} with mon_command.

"cmd410": {
    "sig": [
        "fs",
        "volume",
        "create",
        {
            "goodchars": "[A-Za-z0-9-_.]",
            "name": "name",
            "type": "CephString" 
        },
        {
            "name": "placement",
            "req": "false",
            "type": "CephString" 
        }
    ],
    "help": "Create a CephFS volume",
    "module": "mgr",
    "perm": "rw",
    "flags": 8
},

When I didn't follow the goodchars for parameter, name, it returns error. However, it just creates volume regardless of returning error.

For example,

When I call mon_command with c++,

librados::Rados cluster;
cluster.init2(user_name, cluster_name, flags);
cluster.conf_read_file("/etc/ceph/ceph.conf");
cluster.connect();

// Mon Command
std::string cmd = R"({"prefix": "fs volume create", "name": "한글"})";
librados::bufferlist inbl;
librados::bufferlist outbl;
std::string outs;
int ret = cluster.mon_command(cmd, inbl, &outbl, &outs);
if (ret < 0) {
    std::string errorMsg("Failed MonCommand :: ");
    errorMsg = errorMsg + outs;
    std::cerr << errorMsg << std::endl;
    resp.content = boost::json::string(errorMsg);
    return resp;
}
std::string outstr(outbl.c_str(), outbl.length());
resp.content = outstr;
return resp;

My terminal prints,

Failed MonCommand :: Service id contains invalid characters, only [a-zA-Z0-9_.-] allowed

But, it can be seen in ceph dashboard, and terminal with $ ceph fs volume ls like below.

[root@c1-7 ~]# ceph fs volume ls
[
    {
        "name": "testfs1" 
    },
    {
        "name": "testfs2" 
    },
    {
        "name": "\ud55c\uae00" 
    }
]
[root@c1-7 ~]# ceph fs ls
name: testfs1, metadata pool: cephfs.testfs1.meta, data pools: [cephfs.testfs1.data ]
name: testfs2, metadata pool: cephfs.testfs2.meta, data pools: [cephfs.testfs2.data ]
name: 한글, metadata pool: cephfs.한글.meta, data pools: [cephfs.한글.data ]

Below link is the image, which shows my list of Filesystem which can be seen in Ceph Dashboard, and the pool which is created for making FS Volume.
https://i.imgur.com/JNu5qYl.png
※ I am so sorry but, I can't figure out how to upload image directly. I think HTML codes not working in this page.

No data to display

Actions

Also available in: Atom PDF