]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: implicitly append '--smp 1' when invoked without it
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 24 Aug 2021 14:02:36 +0000 (14:02 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 24 Aug 2021 23:45:40 +0000 (23:45 +0000)
This commit is basically a hack supposed to fulfil the obligation
of crimson being a drop-in replacement for the classical OSD
we already made by packaging it under `/usr/bin/ceph-osd`.
The discussion whether the interface-exactness should be continued
or not is out of scope of the commit; it's supposed just to handle
the issue unveiled by the Rook integration effort: `crimson-osd`
is unable to `--mkfs` because Seastar, if not restricted by passing
`--smp N`, considers all CPU cores available in the system when
allocating resources. This leads to the following error:

```
ERROR 2021-08-24 14:17:32,105 [shard 5] seastar - Could not setup Async I/O: Resource temporarily unavailable. The most common cause is not enough request capacity in /proc/sys/fs/aio-max-nr. Try increasing that number or reducing the amount of logical CPUs available for your application
```

This hack will need to be dropped when integrating multi-reactor
support in crimson.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/main.cc

index 169c2f4540b096a06d149e23f1df6a621a202820..2a2ef3f0ccd0bb687feb783fb28ab5030065487b 100644 (file)
@@ -183,6 +183,20 @@ seastar::future<> fetch_config()
   });
 }
 
+static void override_seastar_opts(std::vector<const char*>& args)
+{
+  if (auto found = std::find_if(std::begin(args), std::end(args),
+                                [] (auto* arg) { return "--smp"sv == arg; });
+      found == std::end(args)) {
+    // TODO: we don't have a way to communicate the resource requirements
+    // with the deployment tools, like cephadm and rook, which don't set, for
+    // instance, aio-max-nr for us. but we should fix this, once crimson is able
+    // to run on a multi-core system, i.e., once m-to-n problem is resolved.
+    args.emplace_back("--smp");
+    args.emplace_back("1");
+  }
+}
+
 int main(int argc, char* argv[])
 {
   seastar::app_template::config app_cfg;
@@ -208,6 +222,7 @@ int main(int argc, char* argv[])
     usage(argv[0]);
     return EXIT_SUCCESS;
   }
+  override_seastar_opts(app_args);
   std::string cluster_name{"ceph"};
   std::string conf_file_list;
   // ceph_argparse_early_args() could _exit(), while local_conf() won't ready