]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: Add the ability to reset state to v2
authorDavid Zafman <dzafman@redhat.com>
Wed, 13 Sep 2017 06:14:15 +0000 (23:14 -0700)
committerDavid Zafman <dzafman@redhat.com>
Wed, 15 Nov 2017 20:06:53 +0000 (12:06 -0800)
Available for testing and user downgrade.

Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 3e4d68640cc43efc0cf10ea8119b3aa583b7f36b)

Conflicts:
src/tools/ceph_osdomap_tool.cc (trivial)

src/os/filestore/DBObjectMap.cc
src/os/filestore/DBObjectMap.h
src/tools/ceph_osdomap_tool.cc

index 2ec7deb614732065c2e0e56f3da966614a5f4fbb..1e9c789693ac6000fee19ebc83e08ad81f5e354c 100644 (file)
@@ -1019,12 +1019,18 @@ int DBObjectMap::upgrade_to_v2()
 
   state.v = 2;
 
+  set_state();
+  return 0;
+}
+
+void DBObjectMap::set_state()
+{
   Mutex::Locker l(header_lock);
   KeyValueDB::Transaction t = db->get_transaction();
   write_state(t);
   db->submit_transaction_sync(t);
   dout(1) << __func__ << " done" << dendl;
-  return 0;
+  return;
 }
 
 int DBObjectMap::get_state()
index 1e9dc3ebc03543f9bc41bbf8304a034d26cd9651..8a1869d37dd6774d8642af575ef9b239ba2cc304 100644 (file)
@@ -219,6 +219,8 @@ public:
 
   /// Read initial state from backing store
   int get_state();
+  /// Write current state settings to DB
+  void set_state();
   /// Read initial state and upgrade or initialize state
   int init(bool upgrade = false);
 
index 08ac96d47d08c524d8c974b2460599c8469eff8f..ff92b132fd6447e34b84299aa533fe8a82047b7f 100644 (file)
@@ -197,6 +197,9 @@ int main(int argc, char **argv) {
     }
     for (auto i : headers)
       std::cout << i << std::endl;
+  } else if (cmd == "resetv2") {
+    omap.state.v = 2;
+    omap.set_state();
   } else {
     std::cerr << "Did not recognize command " << cmd << std::endl;
     r = 1;