]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Handle MMDSLoadTarget messages
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 1 Oct 2009 21:30:36 +0000 (14:30 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 2 Oct 2009 22:22:10 +0000 (15:22 -0700)
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h
src/mon/Monitor.cc

index 5370bdedbf06ce9dda2a31fdb2e9df0b14a44419..2271cae804c4a38c79696266351deb4f27d3ac74 100644 (file)
@@ -21,6 +21,7 @@
 #include "messages/MMDSMap.h"
 #include "messages/MMDSGetMap.h"
 #include "messages/MMDSBeacon.h"
+#include "messages/MMDSLoadTargets.h"
 #include "messages/MMonCommand.h"
 
 #include "messages/MGenericMessage.h"
@@ -136,10 +137,7 @@ bool MDSMonitor::preprocess_query(PaxosServiceMessage *m)
     return preprocess_command((MMonCommand*)m);
 
   case MSG_MDS_OFFLOAD_TARGETS:
-    return true;
-
-  case MSG_MDS_OFFLOAD_COMPLETE:
-    return true;
+    return preprocess_offload_targets((MMDSLoadTargets*)m);
 
   default:
     assert(0);
@@ -248,6 +246,12 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
   return true;
 }
 
+bool MDSMonitor::preprocess_offload_targets(MMDSLoadTargets* m)
+{
+  return (m->targets ==
+         pending_mdsmap.get_mds_info(m->get_orig_source_addr()).export_targets);
+}
+
 
 bool MDSMonitor::prepare_update(PaxosServiceMessage *m)
 {
@@ -260,6 +264,9 @@ bool MDSMonitor::prepare_update(PaxosServiceMessage *m)
 
   case MSG_MON_COMMAND:
     return prepare_command((MMonCommand*)m);
+
+  case MSG_MDS_OFFLOAD_TARGETS:
+    return prepare_offload_targets((MMDSLoadTargets*)m);
   
   default:
     assert(0);
@@ -328,6 +335,13 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
   return true;
 }
 
+bool MDSMonitor::prepare_offload_targets(MMDSLoadTargets *m)
+{
+  pending_mdsmap.mds_info[m->get_orig_source_addr()].
+    export_targets = m->targets;
+  return true;
+}
+
 bool MDSMonitor::should_propose(double& delay)
 {
   delay = 0.0;
index dac42f4ea2d97de3b766f78eced9fcab0a81d689..c7f8c8708242dac56ee8e9a2265f0e87fbcdf148 100644 (file)
@@ -34,6 +34,7 @@ using namespace std;
 class MMDSBeacon;
 class MMDSGetMap;
 class MMonCommand;
+class MMDSLoadTargets;
 
 class MDSMonitor : public PaxosService {
  public:
@@ -79,6 +80,9 @@ class MDSMonitor : public PaxosService {
   bool prepare_beacon(class MMDSBeacon *m);
   void handle_mds_getmap(MMDSGetMap *m);
 
+  bool preprocess_offload_targets(MMDSLoadTargets *m);
+  bool prepare_offload_targets(MMDSLoadTargets *m);
+
   bool preprocess_command(MMonCommand *m);
   bool prepare_command(MMonCommand *m);
 
index c342286858f60fda98f20cf40fe31f32c1bfa544..804b6fe09264acaac604169f098a56530d2e981c 100644 (file)
@@ -394,6 +394,7 @@ bool Monitor::ms_dispatch(Message *m)
       
       // MDSs
     case MSG_MDS_BEACON:
+    case MSG_MDS_OFFLOAD_TARGETS:
     case CEPH_MSG_MDS_GETMAP:
       paxos_service[PAXOS_MDSMAP]->dispatch((PaxosServiceMessage*)m);
       break;