]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Fix failing ceph_objectstore_tool.py test 33593/head
authorDavid Zafman <dzafman@redhat.com>
Fri, 28 Feb 2020 01:18:05 +0000 (17:18 -0800)
committerDavid Zafman <dzafman@redhat.com>
Fri, 28 Feb 2020 02:14:36 +0000 (18:14 -0800)
The -N option to vstart.sh was removed, use -k

Old hinfo_key binary happen to be utf-8 decodable, now it
throws an exception trying to decode it. Use new
option to ceph-objectstore-tool to treat stdout as a terminal
and convert binary data to base64.

Signed-off-by: David Zafman <dzafman@redhat.com>
qa/standalone/special/ceph_objectstore_tool.py
src/tools/ceph_objectstore_tool.cc

index 0fd6b5d5ce2e6c2999f83cbe71ed07702b2ca3e8..2790bc19b69486411643c7ca4153cad70ae030bd 100755 (executable)
@@ -152,7 +152,7 @@ def cat_file(level, filename):
 
 def vstart(new, opt="-o osd_pool_default_pg_autoscale_mode=off"):
     print("vstarting....", end="")
-    NEW = new and "-n" or "-N"
+    NEW = new and "-n" or "-k"
     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)
     print("DONE")
 
@@ -1535,7 +1535,7 @@ def main(argv):
                     jsondict[1]['shard_id'] = int(pg.split('s')[1])
                     JSON = json.dumps((pg, jsondict[1]))
                     for osd in OSDS:
-                        cmd = (CFSD_PREFIX + " '{json}' get-attr hinfo_key").format(osd=osd, json=JSON)
+                        cmd = (CFSD_PREFIX + " --tty '{json}' get-attr hinfo_key").format(osd=osd, json=JSON)
                         logging.debug("TRY: " + cmd)
                         try:
                             out = check_output(cmd, shell=True, stderr=subprocess.STDOUT)
@@ -1543,9 +1543,9 @@ def main(argv):
                             found += 1
                         except subprocess.CalledProcessError as e:
                             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:
+                            if "No such file or directory" not in str(e.output) and \
+                               "No data available" not in str(e.output) and \
+                               "not contained by pg" not in str(e.output):
                                 raise
                 # Assuming k=2 m=1 for the default ec pool
                 if found != 3:
index 9422ad239ebe25818a33e2965c4ea4e9511f92c8..3699c3821c95255cd9566d38fad6ae1c5ee38cd1 100644 (file)
@@ -3199,7 +3199,7 @@ int main(int argc, char **argv)
   ghobject_t ghobj;
   bool human_readable;
   Formatter *formatter;
-  bool head;
+  bool head, tty;
 
   po::options_description desc("Allowed options");
   desc.add_options()
@@ -3239,6 +3239,7 @@ int main(int argc, char **argv)
     ("skip-mount-omap", "Disable mounting of omap")
     ("head", "Find head/snapdir when searching for objects by name")
     ("dry-run", "Don't modify the objectstore")
+    ("tty", "Treat stdout as a tty (no binary data)")
     ("namespace", po::value<string>(&argnspace), "Specify namespace when searching for objects")
     ("rmtype", po::value<string>(&rmtypestr), "Specify corrupting object removal 'snapmap' or 'nosnapmap' - TESTING USE ONLY")
     ("slow-omap-threshold", po::value<unsigned>(&slow_threshold),
@@ -3293,6 +3294,7 @@ int main(int argc, char **argv)
     nspace = argnspace;
 
   dry_run = (vm.count("dry-run") > 0);
+  tty = (vm.count("tty") > 0);
 
   osflagbits_t flags = 0;
   if (dry_run || vm.count("skip-journal-replay"))
@@ -3389,7 +3391,7 @@ int main(int argc, char **argv)
     usage(desc);
     return 1;
   }
-  outistty = isatty(STDOUT_FILENO);
+  outistty = isatty(STDOUT_FILENO) || tty;
 
   file_fd = fd_none;
   if ((op == "export" || op == "export-remove" || op == "get-osdmap" || op == "get-inc-osdmap") && !dry_run) {