From 2d79e77b6a763fcece79f10f1e674b8b83624ae4 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Thu, 24 Oct 2019 11:31:52 -0700 Subject: [PATCH] ceph-objectstore-tool: call collection_bits() crashes on the meta collection Skip new check for meta collection test: Turn off osd_pool_default_pg_autoscale_mode just like bash tests do Fix test by checking for new error message Caused by: f88b3534549bb2ede76e9f3e8b6b641b5886a9f4 Fixes: https://tracker.ceph.com/issues/42476 Signed-off-by: David Zafman --- qa/standalone/special/ceph_objectstore_tool.py | 7 +++++-- src/tools/ceph_objectstore_tool.cc | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/qa/standalone/special/ceph_objectstore_tool.py b/qa/standalone/special/ceph_objectstore_tool.py index ccc9d00e6dc..952eda3b3ae 100755 --- a/qa/standalone/special/ceph_objectstore_tool.py +++ b/qa/standalone/special/ceph_objectstore_tool.py @@ -150,7 +150,7 @@ def cat_file(level, filename): print("") -def vstart(new, opt=""): +def vstart(new, opt="-o osd_pool_default_pg_autoscale_mode=off"): print("vstarting....", end="") NEW = new and "-n" or "-N" call("MON=1 OSD=4 MDS=0 MGR=1 CEPH_PORT=7400 MGR_PYTHON_PATH={path}/src/pybind/mgr {path}/src/vstart.sh --filestore --short -l {new} -d {opt} > /dev/null 2>&1".format(new=NEW, opt=opt, path=CEPH_ROOT), shell=True) @@ -1542,7 +1542,10 @@ def main(argv): logging.debug("FOUND: {json} in {osd} has value '{val}'".format(osd=osd, json=JSON, val=out)) found += 1 except subprocess.CalledProcessError as e: - if "No such file or directory" not in e.output and "No data available" not in e.output: + logging.debug("Error message: {output}".format(output=e.output)) + if "No such file or directory" not in e.output and \ + "No data available" not in e.output and \ + "not contained by pg" not in e.output: raise # Assuming k=2 m=1 for the default ec pool if found != 3: diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 5e2057f54da..229c9f628ee 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -3758,11 +3758,13 @@ int main(int argc, char **argv) ret = 1; goto out; } - auto ch = fs->open_collection(coll_t(pgid)); - if (!ghobj.match(fs->collection_bits(ch), pgid.ps())) { - stringstream ss; - ss << "object " << ghobj << " not contained by pg " << pgid; - throw std::runtime_error(ss.str()); + if (pgidstr != "meta") { + auto ch = fs->open_collection(coll_t(pgid)); + if (!ghobj.match(fs->collection_bits(ch), pgid.ps())) { + stringstream ss; + ss << "object " << ghobj << " not contained by pg " << pgid; + throw std::runtime_error(ss.str()); + } } } } catch (std::runtime_error& e) { -- 2.39.5