int krbd_create_from_context(rados_config_t cct, struct krbd_ctx **pctx);
void krbd_destroy(struct krbd_ctx *ctx);
-int krbd_map(struct krbd_ctx *ctx, const char *pool, const char *image,
- const char *snap, const char *options, char **pdevnode);
-int krbd_is_mapped(struct krbd_ctx *ctx, const char *pool, const char *image,
- const char *snap, char **pdevnode);
+int krbd_map(struct krbd_ctx *ctx,
+ const char *pool_name,
+ const char *nspace_name,
+ const char *image_name,
+ const char *snap_name,
+ const char *options,
+ char **pdevnode);
+int krbd_is_mapped(struct krbd_ctx *ctx,
+ const char *pool_name,
+ const char *nspace_name,
+ const char *image_name,
+ const char *snap_name,
+ char **pdevnode);
int krbd_unmap(struct krbd_ctx *ctx, const char *devnode,
const char *options);
-int krbd_unmap_by_spec(struct krbd_ctx *ctx, const char *pool,
- const char *image, const char *snap,
+int krbd_unmap_by_spec(struct krbd_ctx *ctx,
+ const char *pool_name,
+ const char *nspace_name,
+ const char *image_name,
+ const char *snap_name,
const char *options);
#ifdef __cplusplus
struct krbd_spec {
std::string pool_name;
+ std::string nspace_name;
std::string image_name;
std::string snap_name;
- krbd_spec(const char *pool_name, const char *image_name,
- const char *snap_name)
+ krbd_spec(const char *pool_name, const char *nspace_name,
+ const char *image_name, const char *snap_name)
: pool_name(pool_name),
+ nspace_name(nspace_name),
image_name(image_name),
snap_name(*snap_name ? snap_name : SNAP_HEAD_NAME) { }
bool operator==(const krbd_spec& rhs) const {
return pool_name == rhs.pool_name &&
+ nspace_name == rhs.nspace_name &&
image_name == rhs.image_name &&
snap_name == rhs.snap_name;
}
std::ostream& operator<<(std::ostream& os, const krbd_spec& spec) {
os << spec.pool_name << "/";
+ if (!spec.nspace_name.empty())
+ os << spec.nspace_name << "/";
os << spec.image_name;
if (spec.snap_name != SNAP_HEAD_NAME)
os << "@" << spec.snap_name;
std::optional<krbd_spec> spec_from_dev(udev_device *dev) {
const char *pool_name = udev_device_get_sysattr_value(dev, "pool");
+ const char *nspace_name = udev_device_get_sysattr_value(dev, "pool_ns");
const char *image_name = udev_device_get_sysattr_value(dev, "name");
const char *snap_name = udev_device_get_sysattr_value(dev, "current_snap");
return std::nullopt;
return std::make_optional<krbd_spec>(
- pool_name, image_name, snap_name);
+ pool_name, nspace_name ?: "", image_name, snap_name);
}
static string get_kernel_rbd_name(const char *id)
if (strcmp(options, "") != 0)
oss << "," << options;
+ if (!spec.nspace_name.empty())
+ oss << ",_pool_ns=" << spec.nspace_name;
oss << " " << spec.pool_name << " " << spec.image_name << " "
<< spec.snap_name;
return r;
}
-static int enumerate_devices(struct udev *udev, const krbd_spec& spec,
- struct udev_enumerate **penm)
+static int __enumerate_devices(struct udev *udev, const krbd_spec& spec,
+ bool match_nspace, struct udev_enumerate **penm)
{
struct udev_enumerate *enm;
int r;
if (r < 0)
goto out_enm;
+ if (match_nspace) {
+ r = udev_enumerate_add_match_sysattr(enm, "pool_ns",
+ spec.nspace_name.c_str());
+ } else {
+ /*
+ * Match _only_ devices that don't have pool_ns attribute.
+ * If the kernel supports namespaces, the result will be empty.
+ */
+ r = udev_enumerate_add_nomatch_sysattr(enm, "pool_ns", nullptr);
+ }
+ if (r < 0)
+ goto out_enm;
+
r = udev_enumerate_add_match_sysattr(enm, "name", spec.image_name.c_str());
if (r < 0)
goto out_enm;
return r;
}
+static int enumerate_devices(struct udev *udev, const krbd_spec& spec,
+ struct udev_enumerate **penm)
+{
+ struct udev_enumerate *enm;
+ int r;
+
+ r = __enumerate_devices(udev, spec, true, &enm);
+ if (r < 0)
+ return r;
+
+ /*
+ * If no namespace is set, try again with match_nspace=false to
+ * handle older kernels. On a newer kernel the result will remain
+ * the same (i.e. empty).
+ */
+ if (!udev_enumerate_get_list_entry(enm) && spec.nspace_name.empty()) {
+ udev_enumerate_unref(enm);
+ r = __enumerate_devices(udev, spec, false, &enm);
+ if (r < 0)
+ return r;
+ }
+
+ *penm = enm;
+ return 0;
+}
+
static int spec_to_devno_and_krbd_id(struct udev *udev, const krbd_spec& spec,
dev_t *pdevno, string *pid)
{
f->open_object_section("device");
f->dump_string("id", id);
f->dump_string("pool", spec->pool_name);
+ f->dump_string("namespace", spec->nspace_name);
f->dump_string("name", spec->image_name);
f->dump_string("snap", spec->snap_name);
f->dump_string("device", kname);
f->close_section();
} else {
- *tbl << id << spec->pool_name << spec->image_name << spec->snap_name << kname
- << TextTable::endrow;
+ *tbl << id << spec->pool_name << spec->nspace_name << spec->image_name
+ << spec->snap_name << kname << TextTable::endrow;
}
return true;
} else {
tbl.define_column("id", TextTable::LEFT, TextTable::LEFT);
tbl.define_column("pool", TextTable::LEFT, TextTable::LEFT);
+ tbl.define_column("namespace", TextTable::LEFT, TextTable::LEFT);
tbl.define_column("image", TextTable::LEFT, TextTable::LEFT);
tbl.define_column("snap", TextTable::LEFT, TextTable::LEFT);
tbl.define_column("device", TextTable::LEFT, TextTable::LEFT);
delete ctx;
}
-extern "C" int krbd_map(struct krbd_ctx *ctx, const char *pool,
- const char *image, const char *snap,
- const char *options, char **pdevnode)
+extern "C" int krbd_map(struct krbd_ctx *ctx,
+ const char *pool_name,
+ const char *nspace_name,
+ const char *image_name,
+ const char *snap_name,
+ const char *options,
+ char **pdevnode)
{
- krbd_spec spec(pool, image, snap);
+ krbd_spec spec(pool_name, nspace_name, image_name, snap_name);
string name;
char *devnode;
int r;
return unmap_image(ctx, devnode, options);
}
-extern "C" int krbd_unmap_by_spec(struct krbd_ctx *ctx, const char *pool,
- const char *image, const char *snap,
+extern "C" int krbd_unmap_by_spec(struct krbd_ctx *ctx,
+ const char *pool_name,
+ const char *nspace_name,
+ const char *image_name,
+ const char *snap_name,
const char *options)
{
- krbd_spec spec(pool, image, snap);
+ krbd_spec spec(pool_name, nspace_name, image_name, snap_name);
return unmap_image(ctx, spec, options);
}
return dump_images(ctx, f);
}
-extern "C" int krbd_is_mapped(struct krbd_ctx *ctx, const char *pool,
- const char *image, const char *snap,
+extern "C" int krbd_is_mapped(struct krbd_ctx *ctx,
+ const char *pool_name,
+ const char *nspace_name,
+ const char *image_name,
+ const char *snap_name,
char **pdevnode)
{
- krbd_spec spec(pool, image, snap);
+ krbd_spec spec(pool_name, nspace_name, image_name, snap_name);
string name;
char *devnode;
int r;
Unmap by device (img is already mapped):
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap $DEV
$ rbd device list
$ DEV=$(sudo rbd device map img)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap ${DEV}p1
$ rbd device list
$ DEV=$(sudo rbd device map img)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap ${DEV}p5
$ rbd device list
$ sudo rbd device map img
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
$ sudo rbd device map img
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd --image img device unmap
$ rbd device list
$ sudo rbd device map img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img@snap
$ rbd device list
$ sudo rbd device map img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd --snap snap device unmap img
$ rbd device list
$ sudo rbd device map img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd --image img --snap snap device unmap
$ rbd device list
$ sudo rbd device map rbd/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap rbd/img@snap
$ rbd device list
$ sudo rbd device map rbd/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd --pool rbd device unmap img@snap
$ rbd device list
$ sudo rbd device map rbd/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd --pool rbd --snap snap device unmap img
$ rbd device list
$ sudo rbd device map rbd/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd --pool rbd --image img --snap snap device unmap
$ rbd device list
$ sudo rbd device map custom/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@snap
$ rbd device list
$ sudo rbd device map custom/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd --pool custom device unmap img@snap
$ rbd device list
$ sudo rbd device map custom/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd --pool custom --snap snap device unmap img
$ rbd device list
$ sudo rbd device map custom/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd --pool custom --image img --snap snap device unmap
$ rbd device list
$ sudo rbd device map anotherimg
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
- ? rbd anotherimg - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
+ ? rbd anotherimg - /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
- id pool image snap device
- ? rbd anotherimg - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd anotherimg - /dev/rbd? (glob)
$ sudo rbd device unmap anotherimg
$ rbd device list
$ sudo rbd device map anotherimg
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
- ? rbd anotherimg - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
+ ? rbd anotherimg - /dev/rbd? (glob)
$ sudo rbd device unmap anotherimg
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
$ sudo rbd device map img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img@snap
$ rbd device list
$ sudo rbd device map img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img@snap
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
$ sudo rbd device map custom/img@anothersnap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
- ? custom img anothersnap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
+ ? custom img anothersnap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@snap
$ rbd device list
- id pool image snap device
- ? custom img anothersnap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img anothersnap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@anothersnap
$ rbd device list
$ sudo rbd device map custom/img@anothersnap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
- ? custom img anothersnap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
+ ? custom img anothersnap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@anothersnap
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@snap
$ rbd device list
$ sudo rbd device map custom/img
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
- ? custom img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
+ ? custom img - /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
- id pool image snap device
- ? custom img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img - /dev/rbd? (glob)
$ sudo rbd device unmap custom/img
$ rbd device list
$ sudo rbd device map custom/img@snap
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@snap
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img@snap
$ rbd device list
rbd: warning: image already mapped as /dev/rbd? (glob)
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap img
rbd: rbd/img: mapped more than once, unmapping /dev/rbd? only (glob)
$ rbd device list
- id pool image snap device
- ? rbd img - /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img - /dev/rbd? (glob)
$ sudo rbd device unmap img
$ rbd device list
rbd: warning: image already mapped as /dev/rbd? (glob)
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img@snap
rbd: rbd/img@snap: mapped more than once, unmapping /dev/rbd? only (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap img@snap
$ rbd device list
rbd: warning: image already mapped as /dev/rbd? (glob)
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap rbd/img@snap
rbd: rbd/img@snap: mapped more than once, unmapping /dev/rbd? only (glob)
$ rbd device list
- id pool image snap device
- ? rbd img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? rbd img snap /dev/rbd? (glob)
$ sudo rbd device unmap rbd/img@snap
$ rbd device list
rbd: warning: image already mapped as /dev/rbd? (glob)
/dev/rbd? (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@snap
rbd: custom/img@snap: mapped more than once, unmapping /dev/rbd? only (glob)
$ rbd device list
- id pool image snap device
- ? custom img snap /dev/rbd? (glob)
+ id pool namespace image snap device
+ ? custom img snap /dev/rbd? (glob)
$ sudo rbd device unmap custom/img@snap
$ rbd device list
if (ret < 0)
return ret;
- ret = krbd_map(krbd, pool, name, "", "", &devnode);
+ ret = krbd_map(krbd, pool, "", name, "", "", &devnode);
if (ret < 0) {
prt("krbd_map(%s) failed\n", name);
return ret;
* based on errno return by krbd_map(). also note that even if some librbd calls
* fail, we at least dump the "try dmesg..." message to aid debugging.
*/
-static void print_error_description(const char *poolname, const char *imgname,
- const char *snapname, int maperrno)
+static void print_error_description(const char *poolname,
+ const char *nspace_name,
+ const char *imgname,
+ const char *snapname,
+ int maperrno)
{
int r;
uint8_t oldformat;
if (maperrno == -ENOENT)
goto done;
- r = utils::init_and_open_image(poolname, "", imgname, "", snapname,
+ r = utils::init_and_open_image(poolname, nspace_name, imgname, "", snapname,
true, &rados, &ioctx, &image);
if (r < 0)
goto done;
} else {
std::cout << "You can disable features unsupported by the kernel "
<< "with \"rbd feature disable ";
-
- if (poolname != utils::get_default_pool_name()) {
+ if (poolname != utils::get_default_pool_name() || *nspace_name) {
std::cout << poolname << "/";
}
+ if (*nspace_name) {
+ std::cout << nspace_name << "/";
+ }
std::cout << imgname;
}
} else {
std::cout << "In some cases useful info is found in syslog - try \"dmesg | tail\"." << std::endl;
}
-static int do_kernel_map(const char *poolname, const char *imgname,
- const char *snapname)
+static int do_kernel_map(const char *poolname, const char *nspace_name,
+ const char *imgname, const char *snapname)
{
#if defined(WITH_KRBD)
struct krbd_ctx *krbd;
}
}
- r = krbd_is_mapped(krbd, poolname, imgname, snapname, &devnode);
+ r = krbd_is_mapped(krbd, poolname, nspace_name, imgname, snapname, &devnode);
if (r < 0) {
std::cerr << "rbd: warning: can't get image map information: "
<< cpp_strerror(r) << std::endl;
free(devnode);
}
- r = krbd_map(krbd, poolname, imgname, snapname, oss.str().c_str(), &devnode);
+ r = krbd_map(krbd, poolname, nspace_name, imgname, snapname,
+ oss.str().c_str(), &devnode);
if (r < 0) {
- print_error_description(poolname, imgname, snapname, r);
+ print_error_description(poolname, nspace_name, imgname, snapname, r);
goto out;
}
}
static int do_kernel_unmap(const char *dev, const char *poolname,
- const char *imgname, const char *snapname)
+ const char *nspace_name, const char *imgname,
+ const char *snapname)
{
#if defined(WITH_KRBD)
struct krbd_ctx *krbd;
if (dev)
r = krbd_unmap(krbd, dev, oss.str().c_str());
else
- r = krbd_unmap_by_spec(krbd, poolname, imgname, snapname,
+ r = krbd_unmap_by_spec(krbd, poolname, nspace_name, imgname, snapname,
oss.str().c_str());
krbd_destroy(krbd);
const std::vector<std::string> &ceph_global_init_args) {
size_t arg_index = 0;
std::string pool_name;
+ std::string nspace_name;
std::string image_name;
std::string snap_name;
int r = utils::get_pool_image_snapshot_names(
- vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, &pool_name, nullptr,
+ vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, &pool_name, &nspace_name,
&image_name, &snap_name, true, utils::SNAPSHOT_PRESENCE_PERMITTED,
utils::SPEC_VALIDATION_NONE);
if (r < 0) {
utils::init_context();
- r = do_kernel_map(pool_name.c_str(), image_name.c_str(), snap_name.c_str());
+ r = do_kernel_map(pool_name.c_str(), nspace_name.c_str(), image_name.c_str(),
+ snap_name.c_str());
if (r < 0) {
std::cerr << "rbd: map failed: " << cpp_strerror(r) << std::endl;
return r;
size_t arg_index = 0;
std::string pool_name;
+ std::string nspace_name;
std::string image_name;
std::string snap_name;
int r;
if (device_name.empty()) {
r = utils::get_pool_image_snapshot_names(
- vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, &pool_name, nullptr,
+ vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, &pool_name, &nspace_name,
&image_name, &snap_name, false, utils::SNAPSHOT_PRESENCE_PERMITTED,
utils::SPEC_VALIDATION_NONE);
if (r < 0) {
utils::init_context();
r = do_kernel_unmap(device_name.empty() ? nullptr : device_name.c_str(),
- pool_name.c_str(), image_name.c_str(), snap_name.c_str());
+ pool_name.c_str(), nspace_name.c_str(),
+ image_name.c_str(), snap_name.c_str());
if (r < 0) {
std::cerr << "rbd: unmap failed: " << cpp_strerror(r) << std::endl;
return r;