<< " (default: " << Config().reattach_timeout << ")\n"
<< " --try-netlink Use the nbd netlink interface\n"
<< " --show-cookie Show device cookie\n"
+ << " --cookie Specify device cookie for attach\n"
<< "\n"
<< "List options:\n"
<< " --format plain|json|xml Output format (default: plain)\n"
cfg->try_netlink = true;
} else if (ceph_argparse_flag(args, i, "--show-cookie", (char *)NULL)) {
cfg->show_cookie = true;
+ } else if (ceph_argparse_witharg(args, i, &cfg->cookie, "--cookie", (char *)NULL)) {
} else if (ceph_argparse_witharg(args, i, &arg_value,
"--encryption-format", (char *)NULL)) {
if (arg_value == "luks1") {
*err_msg << "rbd-nbd: must specify device to attach";
return -EINVAL;
}
+ /* FIXME: Should we allow attach for kernel versions that doesn't
+ * support NBD_ATTR_BACKEND_IDENTIFIER (danger!) ?
+ * 1. If we allow attach for lower kernel versions then, we should
+ * also provide a way to skip cookie check here
+ * 2. If we do not want to allow, then add kernel version check here
+ */
+ if (cfg->cookie.empty()) {
+ *err_msg << "rbd-nbd: must specify cookie to attach";
+ return -EINVAL;
+ }
[[fallthrough]];
case Map:
if (args.begin() == args.end()) {