]> 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, 13 Sep 2017 21:06:25 +0000 (14:06 -0700)
Available for testing and user downgrade.

Signed-off-by: David Zafman <dzafman@redhat.com>
src/os/filestore/DBObjectMap.cc
src/os/filestore/DBObjectMap.h
src/tools/ceph_osdomap_tool.cc

index 12c334ade13d249d0af6eb66dcd19fae64c23269..349fc15b862f95e2e3ac6d98fff6fbe57ecffbd4 100644 (file)
@@ -1021,12 +1021,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 8c465ac12837be426da250c6f274186491065efa..4d95450fe1d01f9d4935f6ecad0475205a2dc0ed 100644 (file)
@@ -220,6 +220,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 1f78cb901c5446cae8bb7d3312379d697ddfd355..d7c240d7923110c000825eae6293dd85828c96ce 100644 (file)
@@ -198,6 +198,9 @@ int main(int argc, char **argv) {
     for (auto i : headers)
       std::cout << i << std::endl;
     return 0;
+  } else if (cmd == "resetv2") {
+    omap.state.v = 2;
+    omap.set_state();
   } else {
     std::cerr << "Did not recognize command " << cmd << std::endl;
     return 1;