]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix rbd-wnbd device status
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 17 Feb 2021 13:27:11 +0000 (13:27 +0000)
committerJason Dillaman <dillaman@redhat.com>
Tue, 23 Feb 2021 15:08:31 +0000 (10:08 -0500)
The "rbd-wnbd show" command will always report the device status
as "inactive". This patch adds the missing check, similar to the
one used by the "list" command.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 94cf22e35217e33a48ab73a018c8b1015b887ca4)

src/tools/rbd_wnbd/rbd_wnbd.cc

index a4b0cf29bd0ff738ca83917cdc4018e518b764d1..0b4cbb650c2bc10b3739b44b6bc30a04ce343e4d 100644 (file)
@@ -1345,6 +1345,7 @@ static int do_show_mapped_device(std::string format, bool pretty_format,
   }
 
   auto conn_props = conn_info.Properties;
+  cfg.active = conn_info.DiskNumber > 0 && is_process_running(conn_props.Pid);
   f->open_object_section("device");
   f->dump_int("id", conn_props.Pid ? conn_props.Pid : -1);
   f->dump_string("device", cfg.devpath);