]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: show device name in "osd metadata output" 28107/head
authorIgor Fedotov <ifedotov@suse.com>
Wed, 15 May 2019 13:55:12 +0000 (16:55 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Wed, 15 May 2019 13:55:12 +0000 (16:55 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlockDevice.h
src/os/bluestore/KernelDevice.cc
src/os/bluestore/KernelDevice.h

index 315d46c19f852bcb986d48bdc4e3aeda53be54be..ee1afc63109bcb4d2eaa256d0135e313e0639809 100644 (file)
@@ -177,10 +177,10 @@ public:
 
   virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) const = 0;
 
-  virtual int get_devname(std::string *out) {
+  virtual int get_devname(std::string *out) const {
     return -ENOENT;
   }
-  virtual int get_devices(std::set<std::string> *ls) {
+  virtual int get_devices(std::set<std::string> *ls) const {
     std::string s;
     if (get_devname(&s) == 0) {
       ls->insert(s);
index 68b690e5aa98bc905f9173ca1cea31381e334e12..35092a0895a98a3c734ee68c6bdd1d690896d7a0 100644 (file)
@@ -223,7 +223,7 @@ out_fail:
   return r;
 }
 
-int KernelDevice::get_devices(std::set<std::string> *ls)
+int KernelDevice::get_devices(std::set<std::string> *ls) const
 {
   if (devname.empty()) {
     return 0;
@@ -274,6 +274,22 @@ int KernelDevice::collect_metadata(const string& prefix, map<string,string> *pm)
     (*pm)[prefix + "vdo_physical_size"] = stringify(total);
   }
 
+  {
+    string res_names;
+    std::set<std::string> devnames;
+    if (get_devices(&devnames) == 0) {
+      for (auto& dev : devnames) {
+       if (!res_names.empty()) {
+         res_names += ",";
+       }
+       res_names += dev;
+      }
+      if (res_names.size()) {
+       (*pm)[prefix + "devices"] = res_names;
+      }
+    }
+  }
+
   struct stat st;
   int r = ::fstat(fd_buffereds[WRITE_LIFE_NOT_SET], &st);
   if (r < 0)
index ec8cf2f8dc40034e96374b1e9fcd4824ff951150..99dfb761837a6f8438788eb1027dbcc403aee258 100644 (file)
@@ -117,14 +117,14 @@ public:
   void discard_drain() override;
 
   int collect_metadata(const std::string& prefix, map<std::string,std::string> *pm) const override;
-  int get_devname(std::string *s) override {
+  int get_devname(std::string *s) const override {
     if (devname.empty()) {
       return -ENOENT;
     }
     *s = devname;
     return 0;
   }
-  int get_devices(std::set<std::string> *ls) override;
+  int get_devices(std::set<std::string> *ls) const override;
 
   bool get_thin_utilization(uint64_t *total, uint64_t *avail) const override;