]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os:enable ObjectStore::statfs() api to return OS alert list.
authorIgor Fedotov <ifedotov@suse.com>
Wed, 19 Dec 2018 11:21:03 +0000 (14:21 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Sat, 26 Jan 2019 14:20:39 +0000 (17:20 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/ObjectStore.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h
src/os/kstore/KStore.cc
src/os/kstore/KStore.h
src/os/memstore/MemStore.cc
src/os/memstore/MemStore.h
src/osd/OSD.cc
src/osd/osd_types.h

index 86e070de6c389bb6f03cbbdc502262d46f8de2b3..6096b494bd6f4d1ca58088c2df1ed1d7719ecb50 100644 (file)
@@ -1558,7 +1558,8 @@ public:
     return false;   // assume a backend cannot, unless it says otherwise
   }
 
-  virtual int statfs(struct store_statfs_t *buf) = 0;
+  virtual int statfs(struct store_statfs_t *buf,
+                    osd_alert_list_t* alerts = nullptr) = 0;
   virtual int pool_statfs(uint64_t pool_id, struct store_statfs_t *buf) = 0;
 
   virtual void collect_metadata(map<string,string> *pm) { }
index f52b4868979bcc3840e8290295d2a74b0b2f40c5..8b0ae602f1743ed1291e5da8a9f7633765b12ffe 100644 (file)
@@ -4361,7 +4361,6 @@ void BlueStore::_init_logger()
 int BlueStore::_reload_logger()
 {
   struct store_statfs_t store_statfs;
-
   int r = statfs(&store_statfs);
   if (r >= 0) {
     logger->set(l_bluestore_allocated, store_statfs.allocated);
@@ -7987,8 +7986,12 @@ void BlueStore::_get_statfs_overall(struct store_statfs_t *buf)
   buf->available = bfree;
 }
 
-int BlueStore::statfs(struct store_statfs_t *buf)
+int BlueStore::statfs(struct store_statfs_t *buf,
+                     osd_alert_list_t* alerts)
 {
+  if (alerts) {
+    alerts->clear();
+  }
   _get_statfs_overall(buf);
   {
     std::lock_guard l(vstatfs_lock);
index fb717b89b5e1927de485bc5cbf23dd242af0f36f..8bf9f6f5effcc0450ca3b79f0c349dd3f537311d 100644 (file)
@@ -2474,7 +2474,8 @@ public:
   string get_device_path(unsigned id);
 
 public:
-  int statfs(struct store_statfs_t *buf) override;
+  int statfs(struct store_statfs_t *buf,
+             osd_alert_list_t* alerts = nullptr) override;
   int pool_statfs(uint64_t pool_id, struct store_statfs_t *buf) override;
 
   void collect_metadata(map<string,string> *pm) override;
@@ -2676,7 +2677,6 @@ private:
       debug_mdata_error_objects.erase(o);
     }
   }
-
 private:
 
   // --------------------------------------------------------
index ef598d2d03e5ee94cfaaee461b17953911032104..2b391e956d34690f1003e19af548509691cd639d 100644 (file)
@@ -728,10 +728,13 @@ int FileStore::get_devices(set<string> *ls)
   return 0;
 }
 
-int FileStore::statfs(struct store_statfs_t *buf0)
+int FileStore::statfs(struct store_statfs_t *buf0, osd_alert_list_t* alerts)
 {
   struct statfs buf;
   buf0->reset();
+  if (alerts) {
+    alerts->clear(); // returns nothing for now
+  }
   if (::statfs(basedir.c_str(), &buf) < 0) {
     int r = -errno;
     ceph_assert(!m_filestore_fail_eio || r != -EIO);
index 0687fcd5c503c65b27c30943e64d62736a6ebeaf..f40a97689f85956fa6e426d4c80aba6de6fef12b 100644 (file)
@@ -517,7 +517,8 @@ public:
   void collect_metadata(map<string,string> *pm) override;
   int get_devices(set<string> *ls) override;
 
-  int statfs(struct store_statfs_t *buf) override;
+  int statfs(struct store_statfs_t *buf,
+             osd_alert_list_t* alerts = nullptr) override;
   int pool_statfs(uint64_t pool_id, struct store_statfs_t *buf) override;
 
   int _do_transactions(
index e0476c9a2894b6b5374360a1299bcbc0f0a1d5b2..2cf82e5efd0fabafa9beafb32cdd8664c7f04040 100644 (file)
@@ -1083,10 +1083,13 @@ void KStore::_sync()
   dout(10) << __func__ << " done" << dendl;
 }
 
-int KStore::statfs(struct store_statfs_t* buf0)
+int KStore::statfs(struct store_statfs_t* buf0, osd_alert_list_t* alerts)
 {
   struct statfs buf;
   buf0->reset();
+  if (alerts) {
+    alerts->clear(); // returns nothing for now
+  }
   if (::statfs(basedir.c_str(), &buf) < 0) {
     int r = -errno;
     ceph_assert(r != -ENOENT);
index dc00f7f1cc48e5841d0bf19d4e1f422fe5d1a7f7..227227fb9be906134d7e03bb64b0de042ef04ce6 100644 (file)
@@ -439,7 +439,8 @@ public:
   void get_db_statistics(Formatter *f) override {
     db->get_statistics(f);
   }
-  int statfs(struct store_statfs_t *buf) override;
+  int statfs(struct store_statfs_t *buf,
+             osd_alert_list_t* alerts = nullptr) override;
   int pool_statfs(uint64_t pool_id, struct store_statfs_t *buf) override;
 
   CollectionHandle open_collection(const coll_t& c) override;
index ea87c80cc84b19112d288544f79390028b5bc3df..d71e335d8b0156ddf841b762928ad2f26067d016 100644 (file)
@@ -220,9 +220,12 @@ int MemStore::mkfs()
   return 0;
 }
 
-int MemStore::statfs(struct store_statfs_t *st)
+int MemStore::statfs(struct store_statfs_t *st, osd_alert_list_t* alerts)
 {
-   dout(10) << __func__ << dendl;
+  dout(10) << __func__ << dendl;
+  if (alerts) {
+    alerts->clear(); // returns nothing for now
+  }
   st->reset();
   st->total = cct->_conf->memstore_device_bytes;
   st->available = std::max<int64_t>(st->total - used_bytes, 0);
index 77b2a32c6e7d51dc069b7d10d6124b26815ae4c6..b4dad703a2db469819a822c57da828b647fe33c9 100644 (file)
@@ -290,7 +290,8 @@ public:
     return 0;
   }
 
-  int statfs(struct store_statfs_t *buf) override;
+  int statfs(struct store_statfs_t *buf,
+             osd_alert_list_t* alerts = nullptr) override;
   int pool_statfs(uint64_t pool_id, struct store_statfs_t *buf) override;
 
   bool exists(CollectionHandle &c, const ghobject_t& oid) override;
index 0444aab500a8fd8db0c969f691561611e469eef2..84dd0c7c41c3ba807c60b3979bac01d620ac65e8 100644 (file)
@@ -2993,7 +2993,8 @@ int OSD::init()
   // prime osd stats
   {
     struct store_statfs_t stbuf;
-    int r = store->statfs(&stbuf);
+    osd_alert_list_t alerts;
+    int r = store->statfs(&stbuf, &alerts);
     ceph_assert(r == 0);
     service.set_statfs(stbuf);
   }
@@ -3937,7 +3938,8 @@ int OSD::update_crush_location()
     snprintf(weight, sizeof(weight), "%.4lf", cct->_conf->osd_crush_initial_weight);
   } else {
     struct store_statfs_t st;
-    int r = store->statfs(&st);
+    osd_alert_list_t alerts;
+    int r = store->statfs(&st, &alerts);
     if (r < 0) {
       derr << "statfs: " << cpp_strerror(r) << dendl;
       return r;
@@ -5279,7 +5281,8 @@ void OSD::tick_without_osd_lock()
 
   // refresh osd stats
   struct store_statfs_t stbuf;
-  int r = store->statfs(&stbuf);
+  osd_alert_list_t alerts;
+  int r = store->statfs(&stbuf, &alerts);
   ceph_assert(r == 0);
   service.set_statfs(stbuf);
 
index 41a9f62a9cbac0f581f61a532448d83fd5a240a5..faae78bed8d8e2260b7c5ef48063317cb6d1c31e 100644 (file)
@@ -112,6 +112,7 @@ string ceph_osd_op_flag_string(unsigned flags);
 /// conver CEPH_OSD_ALLOC_HINT_FLAG_* op flags to a string
 string ceph_osd_alloc_hint_flag_string(unsigned flags);
 
+typedef map<string,string> osd_alert_list_t;
 
 /**
  * osd request identifier