]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: remove class distribution infrastructure
authorSage Weil <sage.weil@dreamhost.com>
Tue, 19 Apr 2011 18:33:34 +0000 (11:33 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 19 Apr 2011 18:33:34 +0000 (11:33 -0700)
This is now the admin's job.  Removes a lot of code with limited testing
and coverage.

We rev the internal monitor protocol because the state machine ids changed.
This should not affect the on-disk format. Just stop and restart all the
monitors at once during the upgrade.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
25 files changed:
ceph.spec.in
debian/ceph.install
man/Makefile.am
man/cclass.8 [deleted file]
src/.gitignore
src/Makefile.am
src/cclass.in [deleted file]
src/common/ClassLibrary.cc [deleted file]
src/common/ClassVersion.h [deleted file]
src/include/ClassLibrary.h [deleted file]
src/include/ceph_fs.h
src/messages/MClass.h [deleted file]
src/messages/MClassAck.h [deleted file]
src/mon/ClassMonitor.cc [deleted file]
src/mon/ClassMonitor.h [deleted file]
src/mon/MonCaps.cc
src/mon/Monitor.cc
src/mon/Monitor.h
src/mon/mon_types.h
src/msg/Message.cc
src/osd/ClassHandler.cc
src/osd/ClassHandler.h
src/osd/OSD.cc
src/tools/common.cc
src/vstart.sh

index 4e964587ac1d1de4c72d5526232e00c3e50b66c2..d1f9ef70dbe4ccb0a8e817a4597fe4dae148c895 100644 (file)
@@ -133,7 +133,6 @@ fi
 %{_bindir}/ceph
 %{_bindir}/cephfs
 %{_bindir}/cconf
-%{_bindir}/cclass
 %{_bindir}/cclsinfo
 %{_bindir}/crushtool
 %{_bindir}/monmaptool
@@ -180,7 +179,6 @@ fi
 %{_mandir}/man8/rbd.8*
 %{_mandir}/man8/cauthtool.8*
 %{_mandir}/man8/cdebugpack.8*
-%{_mandir}/man8/cclass.8.gz
 %{_mandir}/man8/cclsinfo.8.gz
 %{python_sitelib}/rados.py
 %{python_sitelib}/rados.pyc
index 9f51314ea93efb47c126e5bc5ac3d98060fd1932..40a0230fa591e0b5e188156e03349fd52770d16c 100644 (file)
@@ -1,7 +1,6 @@
 usr/bin/ceph
 usr/bin/cephfs
 usr/bin/cconf
-usr/bin/cclass
 usr/bin/cclsinfo
 usr/bin/crushtool
 usr/bin/gceph
@@ -30,7 +29,6 @@ usr/share/man/man8/cconf.8
 usr/share/man/man8/ceph.8
 usr/share/man/man8/cephfs.8
 usr/share/man/man8/cauthtool.8
-usr/share/man/man8/cclass.8
 usr/share/man/man8/cclsinfo.8
 usr/share/man/man8/cdebugpack.8
 usr/share/ceph_tool/gui_resources/*
index afb97c7e3bb656f914b22c4407832325ff773cc2..640c65a6b22503d93a39fc0b5bc00c3850496fe2 100644 (file)
@@ -20,7 +20,6 @@ dist_man_MANS = \
        rados.8 \
        librados-config.8 \
        rbd.8 \
-       cclass.8 \
        cclsinfo.8 \
        cdebugpack.8 \
        cephfs.8
diff --git a/man/cclass.8 b/man/cclass.8
deleted file mode 100644 (file)
index 3cede03..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-.TH CCLASS 8
-.SH NAME
-cclass \- ceph class loading utility
-.SH SYNOPSIS
-.B cclass
-[ \fIoptions\fR ] ... [ \fIcls_filename\fR ] 
-.SH DESCRIPTION
-.B cclass
-will load class libraries into the ceph cluster. Ceph classes are loadable libraries that complement
-and extend the \fIosd\fR functionality. They define \fImethods\fR that can be executed on osd objects and
-may read and modify the data on these objects.
-.SH OPTIONS
-.TP
-\fB\-l\fP, \fB\-\-load\fP
-Loads a class, specified by \fIcls_filename\fR, into the system
-.TP
-\fB\-a\fP, \fB\-\-load-all\fP
-Searches for all the classes in the specified libdir and try to load them into the monitor
-.TP
-\fB\-L\fP, \fB\-\-libdir \fIpath\fP
-Specifies the path where classes will be searched for (used in conjuction with \fB\-\-load-all\fP)
-.TP
-\fB\-o\fP, \fB\-\-overwrite\fP
-Overwrite an existing class with the same name, version, and architecture.
-.TP
-\fB\-e\fP, \fB\-\-excl\fP
-Exclusively load class. Will only load the class if one with the same name (and version and architecture) hasn't been loaded yet.
-.SH AVAILABILITY
-.B cclass
-is part of the Ceph distributed file system.  Please refer to the Ceph wiki at
-http://ceph.newdream.net/wiki for more information.
-.SH SEE ALSO
-.BR cclsinfo (8)
-.BR ceph (8)
index 4e48f4f5915349bac9aea00d55e6d3e0b1b076bd..ad7cbe68efd5ad078750858753278cfc0bd0c49a 100644 (file)
@@ -54,7 +54,6 @@ CrushWrapper.pm
 crush/CrushWrapper_wrap.cxx
 
 /.git_version
-/cclass
 /cconf
 /cdebugpack
 /cephfs
index 3dd20a6c68e1c53139e90b0f2b88ba048b84868a..ac94f2d33d0fabd777c846d1922f613f7073beb5 100644 (file)
@@ -9,7 +9,7 @@ CLEANFILES =
 bin_PROGRAMS =
 sbin_PROGRAMS =
 sbin_SCRIPTS =
-bin_SCRIPTS = crun cclass $(srcdir)/cclsinfo cdebugpack crbdnamer
+bin_SCRIPTS = crun $(srcdir)/cclsinfo cdebugpack crbdnamer
 dist_bin_SCRIPTS =
 # C/C++ tests to build will be appended to this
 check_PROGRAMS =
@@ -459,7 +459,7 @@ editpaths = sed \
        -e 's|@datadir[@]|$(pkgdatadir)|g' \
        -e 's|@prefix[@]|$(prefix)|g'
 
-init-ceph mkcephfs cclass cdebugpack: init-ceph.in mkcephfs.in cclass.in Makefile cdebugpack.in
+init-ceph mkcephfs cdebugpack: init-ceph.in mkcephfs.in Makefile cdebugpack.in
        rm -f $@ $@.tmp
        $(editpaths) '$(srcdir)/$@.in' >$@.tmp
        chmod +x $@.tmp
@@ -470,7 +470,6 @@ BUILT_SOURCES += init-ceph
 sbin_SCRIPTS += mkcephfs
 
 CLEANFILES += \
-       cclass \
        cdebugpack \
        ceph_ver.h \
        init-ceph \
@@ -504,7 +503,7 @@ noinst_LIBRARIES +=  #libcephclient_so.a
 # extra bits
 EXTRA_DIST = $(srcdir)/verify-mds-journal.sh $(srcdir)/vstart.sh $(srcdir)/stop.sh \
        crun $(srcdir)/ceph_common.sh $(srcdir)/init-ceph.in $(srcdir)/mkcephfs.in \
-       $(srcdir)/cclass.in $(srcdir)/cdebugpack.in \
+       $(srcdir)/cdebugpack.in \
        $(srcdir)/cclsinfo $(srcdir)/make_version $(srcdir)/check_version \
        $(srcdir)/.git_version \
        $(srcdir)/crbdnamer \
@@ -584,7 +583,6 @@ libcommon_files = \
        msg/msg_types.cc \
        common/BackTrace.cc \
        common/ProfLogger.cc \
-       common/ClassLibrary.cc \
        common/Clock.cc \
        common/Timer.cc \
        common/Finisher.cc \
@@ -651,7 +649,6 @@ libmon_a_SOURCES = \
        mon/MonmapMonitor.cc \
        mon/PGMonitor.cc \
        mon/LogMonitor.cc \
-       mon/ClassMonitor.cc \
        mon/AuthMonitor.cc \
        mon/Elector.cc \
        mon/MonitorStore.cc \
@@ -760,7 +757,6 @@ noinst_HEADERS = \
        common/errno.h\
        common/likely.h\
        common/lockdep.h\
-        common/ClassVersion.h\
         common/Clock.h\
         common/Cond.h\
         common/ConfUtils.h\
@@ -799,7 +795,6 @@ noinst_HEADERS = \
         crush/types.h\
        fetch_config\
        include/bloom_filter.hpp\
-       include/ClassLibrary.h\
         include/Context.h\
        include/CompatSet.h\
         include/Distribution.h\
@@ -908,8 +903,6 @@ noinst_HEADERS = \
         messages/MAuth.h\
         messages/MAuthReply.h\
        messages/MCacheExpire.h\
-       messages/MClass.h\
-       messages/MClassAck.h\
         messages/MClientCaps.h\
         messages/MClientCapRelease.h\
         messages/MClientLease.h\
@@ -999,7 +992,6 @@ noinst_HEADERS = \
         messages/MWatchNotify.h\
        messages/PaxosServiceMessage.h\
        mon/AuthMonitor.h\
-        mon/ClassMonitor.h\
         mon/Elector.h\
        mon/LogMonitor.h\
         mon/MDSMonitor.h\
diff --git a/src/cclass.in b/src/cclass.in
deleted file mode 100644 (file)
index 099564e..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/sh
-
-load=0
-load_all=0
-fname=""
-libdir=""
-
-if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
-    BINDIR=.
-    [ -e .libs ] && LIBDIR=.libs || LIBDIR=.
-    ETCDIR=.
-    libdir=$LIBDIR
-else
-    BINDIR=@bindir@
-    ETCDIR=@sysconfdir@/ceph
-    libdir=@libdir@/rados-classes
-fi
-
-load_opt="changed"
-
-usage="usage: $0 [option]... [cls_filename]\n"
-usage=$usage"options:\n"
-usage=$usage"\t-b, --bindir <path>\n"
-usage=$usage"\t-L, --libdir <path>\n"
-usage=$usage"\t-l, --load\n"
-usage=$usage"\t-a, --load-all\n"
-usage=$usage"\t-c, --conf <ceph.conf>\n"
-usage=$usage"\t-o, --overwrite\n"
-usage=$usage"\t-e, --excl\n"
-
-conf=$ETCDIR/ceph.conf
-
-usage_exit() {
-       printf "$usage"
-       exit 1
-}
-
-err_exit() {
-       echo "Error: $*"
-       exit 1
-}
-
-while [ $# -ge 1 ]; do
-case $1 in
-    -b | --bindir )
-           shift
-           BINDIR=$1
-           ;;
-    -L | --libdir )
-           shift
-           libdir=$1
-           ;;
-    -l | --load )
-           load=1
-           ;;
-    -a | --load-all )
-           load_all=1
-           ;;
-    -o | --overwrite )
-           load_opt="overwrite"
-           ;;
-    -e | --excl )
-           load_opt="excl"
-           ;;
-    -c | --conf )
-           shift
-           conf=$1
-           ;;
-    * )
-           [ -n "$fname" ] && usage_exit
-           fname=$1
-           ;;
-
-esac
-shift
-done
-
-[ -z "$fname" ] && [ $load_all -eq 0 ] && usage_exit
-
-
-load() {
-       fn=$1
-       $BINDIR/ceph -c $conf class add -i $fn `$BINDIR/cclsinfo $fn` $load_opt
-}
-
-load_all() {
-       all=`find $libdir -name 'libcls_*.so*' -type f`;
-       if [ -n "$all" ]; then
-               for fn in $all; do
-                       echo Loading class: $fn: `$BINDIR/cclsinfo $fn`
-                       load $fn
-               done
-       fi
-}
-
-[ $load -eq 1 ] && load $fname
-[ $load_all -eq 1 ] && load_all
-
diff --git a/src/common/ClassLibrary.cc b/src/common/ClassLibrary.cc
deleted file mode 100644 (file)
index 119f654..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2009-2011 New Dream Network
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#include "common/ClassVersion.h"
-#include "common/debug.h"
-#include "include/ClassLibrary.h"
-
-#include "common/config.h"
-
-ClassInfo *ClassVersionMap::get(ClassVersion& ver)
-{
-  ClassVersion v = ver;
-  tClassVersionMap::iterator iter;
-
-  if (ver.is_default()) {
-    v.ver = default_ver;
-  }
-  dout(0) << "ClassVersionMap getting version " << v << " (requested " << ver << ")" << dendl;
-
-  iter = m.find(v);
-
-  if (iter != m.end())
-    return &(iter->second);
-
-  return NULL;
-}
-
diff --git a/src/common/ClassVersion.h b/src/common/ClassVersion.h
deleted file mode 100644 (file)
index 48813d2..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef CEPH_CLASSVERSION_H
-#define CEPH_CLASSVERSION_H
-
-#include "include/types.h"
-
-
-class ClassVersion
-{
-protected:
-  std::string ver;
-  std::string architecture;
-
-public:
-  ClassVersion(string& v, string& a) : ver(v), architecture(a) {}
-  ClassVersion(const char *s, const char *a) : ver(s), architecture(a) {}
-  ClassVersion() {}
-
-  void operator=(const char *s) { ver = s; }
-  void operator=(string& v) { ver = v; }
-
-  friend bool operator==(const ClassVersion& v1, const ClassVersion& v2);
-  friend bool operator<(const ClassVersion& v1, const ClassVersion& v2);
-  friend std::ostream& operator<<(std::ostream& out, const ClassVersion& v);
-  friend class ClassVersionMap;
-
-  void encode(bufferlist& bl) const {
-    __u8 struct_v = 1;
-    ::encode(struct_v, bl);
-    ::encode(ver, bl);
-    ::encode(architecture, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 struct_v;
-    ::decode(struct_v, bl);
-    ::decode(ver, bl);
-    ::decode(architecture, bl);
-  }
-
-  const char *str() { return ver.c_str(); }
-  const char *arch() { 
-    if (architecture.length() == 0)
-      return "unknown";
-    else
-      return architecture.c_str(); 
-  }
-  void set_ver(const char *v) {
-    ver = v;
-  }
-  void set_arch(const char *arch) {
-    architecture = arch;
-  }
-  bool is_default() { return (ver.length() == 0); }
-};
-WRITE_CLASS_ENCODER(ClassVersion)
-
-static int compare_single(const char *v1, const char *v2)
-{
-  int i1 = atoi(v1);
-  int i2 = atoi(v2);
-
-  if (i1 != i2)
-    return (i1-i2);
-
-  const char *p1 = v1;
-  const char *p2 = v2;
-
-  while (isdigit(*p1))
-    p1++;
-  while (isdigit(*p2))
-    p2++;
-
-  return strcmp(p1, p2);
-}
-
-inline std::ostream& operator<<(std::ostream& out, const ClassVersion& v)
-{
-  out << v.ver << " [" << v.architecture << "]";
-
-  return out;
-}
-inline bool operator==(const ClassVersion& v1, const ClassVersion& v2)
-{
-  return (v1.ver == v2.ver) && (v1.architecture == v2.architecture);
-}
-
-inline bool operator<(const ClassVersion& v1, const ClassVersion& v2)
-{
-  const char *_s1 = v1.ver.c_str();
-  const char *_s2 = v2.ver.c_str();
-  int l1 = strlen(_s1);
-  int l2 = strlen(_s2);
-  char s1[l1 + 1];
-  char s2[l2 + 1];
-  char *p1 = s1;
-  char *p2 = s2;
-
-  const char *tok1, *tok2;
-
-  memcpy(s1, _s1, l1 + 1);
-  memcpy(s2, _s2, l2 + 1);
-
-
-  while (true) {
-    tok1 = strsep(&p1, ".");
-    tok2 = strsep(&p2, ".");
-    if (!tok1 || !tok2) {
-      if (!tok1 && !tok2)
-        return (v1.architecture < v2.architecture);
-      if (!tok1)
-        return true;
-      return false;
-    }
-    int r = compare_single(tok1, tok2);
-    if (r < 0)
-      return true;
-    if (r > 0)
-      return false;
-  }
-}
-
-
-#endif
diff --git a/src/include/ClassLibrary.h b/src/include/ClassLibrary.h
deleted file mode 100644 (file)
index a026b5c..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef CEPH_CLASSLIBRARY_H
-#define CEPH_CLASSLIBRARY_H
-
-#include "include/types.h"
-#include "include/encoding.h"
-
-#include "common/ClassVersion.h"
-
-struct ClassImpl {
-  bufferlist binary;
-  utime_t stamp;
-  version_t seq;
-
-  void encode(bufferlist& bl) const {
-    __u8 v = 0;
-    ::encode(v, bl);
-    ::encode(binary, bl);
-    ::encode(seq, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    ::decode(binary, bl);
-    ::decode(seq, bl);
-  }
-};
-
-
-WRITE_CLASS_ENCODER(ClassImpl)
-
-
-struct ClassInfo {
-  string name;
-  ClassVersion version;
-
-  void encode(bufferlist& bl) const {
-    __u8 v = 1;
-    ::encode(v, bl);
-    ::encode(name, bl);
-    ::encode(version, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    ::decode(name, bl);
-    ::decode(version, bl);
-  }
-};
-
-WRITE_CLASS_ENCODER(ClassInfo)
-
-typedef enum {
-  CLASS_INC_NOP,
-  CLASS_INC_ADD,
-  CLASS_INC_DEL,
-  CLASS_INC_ACTIVATE,
-} ClassLibraryIncOp;
-
-struct ClassLibraryIncremental {
-   ClassLibraryIncOp op;
-   bufferlist info;
-   bufferlist impl;
-
-  void encode(bufferlist& bl) const {
-    __u8 v = 1;
-    ::encode(v, bl);
-    __u32 _op = (__u32)op;
-    ::encode(_op, bl);
-    ::encode(info, bl);
-    ::encode(impl, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    __u32 _op;
-    ::decode(_op, bl);
-    op = (ClassLibraryIncOp)_op;
-    assert( op >= CLASS_INC_NOP && op <= CLASS_INC_ACTIVATE);
-    ::decode(info, bl);
-    ::decode(impl, bl);
-  }
-
-  void decode_impl(ClassImpl& i) {
-     bufferlist::iterator iter = impl.begin();
-     ::decode(i, iter);
-  }
-
-  void decode_info(ClassInfo& l) {
-     bufferlist::iterator iter = info.begin();
-     ::decode(l, iter);
-  }
-};
-
-WRITE_CLASS_ENCODER(ClassLibraryIncremental)
-
-typedef map<ClassVersion, ClassInfo> tClassVersionMap;
-class ClassVersionMap
-{
-public:
-  tClassVersionMap m;
-  string default_ver;
-
-  void encode(bufferlist& bl) const {
-    __u8 v = 2;
-    ::encode(v, bl);
-    ::encode(m, bl);
-    ::encode(default_ver, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    ::decode(m, bl);
-    if (v >= 2)
-      ::decode(default_ver, bl);
-  }
-
-  tClassVersionMap::iterator begin() { return m.begin(); }
-  tClassVersionMap::iterator end() { return m.end(); }
-
-  void add(ClassInfo& library) {
-    m[library.version] = library;
-   if (default_ver.length() == 0)
-    default_ver = library.version.ver;
-  }
-
-  void remove(ClassInfo& library) {
-    tClassVersionMap::iterator iter;
-    iter = m.find(library.version);
-    if (iter != m.end()) {
-      m.erase(iter);
-    }
-  }
-
-  ClassInfo *get(ClassVersion& ver);
-  void set_default(string ver) { default_ver = ver; }
-};
-WRITE_CLASS_ENCODER(ClassVersionMap)
-
-struct ClassLibrary {
-  version_t version;
-  map<string, ClassVersionMap> library_map;
-
-  ClassLibrary() : version(0) {}
-
-  void add(const string& name, const ClassVersion& version) {
-    ClassInfo library;
-    library.version = version;
-    library.name = name;
-    add(library);
-  }
-
-  void add(ClassInfo& library) {
-    ClassVersionMap& vmap = library_map[library.name];
-    vmap.add(library);
-  }
-
-  void remove(const string& name, const ClassVersion& version) {
-    map<string, ClassVersionMap>::iterator mapiter = library_map.find(name);
-    if (mapiter == library_map.end())
-      return;
-    library_map.erase(mapiter);
-  }
-
-  bool contains(string& name) {
-    return (library_map.find(name) != library_map.end());
-  }
-  bool get_ver(string& name, ClassVersion& reqver, ClassVersion *ver) {
-    map<string, ClassVersionMap>::iterator mapiter = library_map.find(name);
-    if (mapiter == library_map.end())
-      return false;
-    string ver_str;
-    ClassVersionMap& map = mapiter->second;
-    ClassInfo *info = map.get(reqver);
-    if (info)
-      *ver = info->version;
-    
-    return (info != NULL);
-  }
-  void encode(bufferlist& bl) const {
-    __u8 v = 1;
-    ::encode(v, bl);
-    ::encode(version, bl);
-    ::encode(library_map, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    ::decode(version, bl);
-    ::decode(library_map, bl);
-  }
-};
-WRITE_CLASS_ENCODER(ClassLibrary)
-
-inline ostream& operator<<(ostream& out, const ClassInfo& e)
-{
-  return out << e.name << " (v" << e.version << ")";
-}
-
-#endif
index 3718bb421f1a92a8fdff8e35abab233809dfcf36..ef2b8b03f497ed39316295fc7ccebc7cf4cba538 100644 (file)
@@ -23,7 +23,7 @@
  */
 #define CEPH_OSD_PROTOCOL     8 /* cluster internal */
 #define CEPH_MDS_PROTOCOL    13 /* cluster internal */
-#define CEPH_MON_PROTOCOL     5 /* cluster internal */
+#define CEPH_MON_PROTOCOL     6 /* cluster internal */
 #define CEPH_OSDC_PROTOCOL   24 /* server/client */
 #define CEPH_MDSC_PROTOCOL   32 /* server/client */
 #define CEPH_MONC_PROTOCOL   15 /* server/client */
diff --git a/src/messages/MClass.h b/src/messages/MClass.h
deleted file mode 100644 (file)
index ced1b01..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef CEPH_MCLASS_H
-#define CEPH_MCLASS_H
-
-#include "include/ClassLibrary.h"
-#include "messages/PaxosServiceMessage.h"
-
-enum {
-   CLASS_NOOP = 0,
-   CLASS_GET,
-   CLASS_SET,
-   CLASS_RESPONSE,
-};
-
-class MClass : public PaxosServiceMessage {
-public:
-  ceph_fsid_t fsid;
-  deque<ClassInfo> info;
-  deque<ClassImpl> impl;
-  deque<bool> add;
-  version_t last;
-  __s32 action;
-
-
-  MClass() : PaxosServiceMessage(MSG_CLASS, 0) {}
-#if 0
-  MClass(const ceph_fsid_t& f, deque<ClassLibraryIncremental>& e) :
-    PaxosServiceMessage(MSG_CLASS, 0),
-    fsid(f), entries(e), last(0), action(0) {}
-#endif
-  MClass(const ceph_fsid_t& f, version_t l) : PaxosServiceMessage(MSG_CLASS, 0), fsid(f), last(l) {}
-  MClass(const ceph_fsid_t& f, version_t l, version_t paxos_version) :
-    PaxosServiceMessage(MSG_CLASS, paxos_version), fsid(f), last(l) {}
-private:
-  ~MClass() {}
-
-public:
-  const char *get_type_name() { return "class"; }
-  void print(ostream& out) {
-    out << "class(";
-    switch (action) {
-    case CLASS_NOOP:
-       out << "NOOP, ";
-       break;
-    case CLASS_GET:
-       out << "GET, ";
-       break;
-    case CLASS_SET:
-       out << "SET, ";
-       break;
-    case CLASS_RESPONSE:
-       out << "SET, ";
-       break;
-    default:
-       out << "Unknown op, ";
-       break;
-    }
-    if (info.size())
-      out << info.size() << " entries";
-    if (last)
-      out << "last " << last;
-    out << ")";
-  }
-
-  void encode_payload() {
-    paxos_encode();
-    ::encode(fsid, payload);
-    ::encode(info, payload);
-    ::encode(impl, payload);
-    ::encode(add, payload);
-    ::encode(last, payload);
-    ::encode(action, payload);
-  }
-  void decode_payload() {
-    bufferlist::iterator p = payload.begin();
-    paxos_decode(p);
-    ::decode(fsid, p);
-    ::decode(info, p);
-    ::decode(impl, p);
-    ::decode(add, p);
-    ::decode(last, p);
-    ::decode(action, p);
-  }
-};
-
-#endif
diff --git a/src/messages/MClassAck.h b/src/messages/MClassAck.h
deleted file mode 100644 (file)
index e2e6a47..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef CEPH_MCLASSACK_H
-#define CEPH_MCLASSACK_H
-
-#include "include/ClassLibrary.h"
-
-class MClassAck : public PaxosServiceMessage {
-public:
-  ceph_fsid_t fsid;
-  version_t last;
-  
-  MClassAck() : PaxosServiceMessage(MSG_CLASS_ACK, 0) {}
-  MClassAck(ceph_fsid_t& f, version_t l) : PaxosServiceMessage(MSG_CLASS_ACK, 0),
-                                          fsid(f), last(l) {}
-
-  MClassAck(ceph_fsid_t& f, version_t l, version_t paxos_version) :
-    PaxosServiceMessage(MSG_CLASS_ACK, paxos_version), fsid(f), last(l) {}
-private:
-  ~MClassAck() {}
-
-public:
-  const char *get_type_name() { return "class_ack"; }
-  void print(ostream& out) {
-    out << "class(last " << last << ")";
-  }
-
-  void encode_payload() {
-    paxos_encode();
-    ::encode(fsid, payload);
-    ::encode(last, payload);
-  }
-  void decode_payload() {
-    bufferlist::iterator p = payload.begin();
-    paxos_decode(p);
-    ::decode(fsid, p);
-    ::decode(last, p);
-  }
-};
-
-#endif
diff --git a/src/mon/ClassMonitor.cc b/src/mon/ClassMonitor.cc
deleted file mode 100644 (file)
index 53b958e..0000000
+++ /dev/null
@@ -1,563 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-
-#include "ClassMonitor.h"
-#include "Monitor.h"
-#include "MonitorStore.h"
-
-#include "messages/MMonCommand.h"
-#include "messages/MClass.h"
-#include "messages/MClassAck.h"
-
-#include "common/ClassVersion.h"
-#include "common/Timer.h"
-
-#include "osd/osd_types.h"
-#include "osd/PG.h"  // yuck
-
-#include "common/config.h"
-#include <sstream>
-
-#define DOUT_SUBSYS mon
-#undef dout_prefix
-#define dout_prefix _prefix(mon, paxos->get_version())
-static ostream& _prefix(Monitor *mon, version_t v) {
-  return *_dout << "mon." << mon->name << "@" << mon->rank
-               << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)")))
-               << ".class v" << v << " ";
-}
-
-ostream& operator<<(ostream& out, ClassMonitor& pm)
-{
-  std::stringstream ss;
-  return out << "class";
-}
-
-/*
- Tick function to update the map based on performance every N seconds
-*/
-
-void ClassMonitor::tick() 
-{
-  if (!paxos->is_active()) return;
-
-  update_from_paxos();
-  dout(10) << *this << dendl;
-
-  if (!mon->is_leader()) return; 
-
-}
-
-void ClassMonitor::create_initial(bufferlist& bl)
-{
-  dout(0) << "create_initial -- creating initial map" << dendl;
-  ClassImpl i;
-  ClassInfo l;
-  i.stamp = g_clock.now();
-  ClassLibraryIncremental inc;
-  ::encode(i, inc.impl);
-  ::encode(l, inc.info);
-  inc.op = CLASS_INC_NOP;
-  pending_class.insert(pair<utime_t,ClassLibraryIncremental>(i.stamp, inc));
-}
-
-bool ClassMonitor::store_impl(ClassInfo& info, ClassImpl& impl)
-{
-  int len = info.name.length() + 16;
-  char store_name[len];
-
-  snprintf(store_name, len, "%s.%s.%s", info.name.c_str(), info.version.str(), info.version.arch());
-  dout(10) << "storing inc.impl length=" << impl.binary.length() << dendl;
-  bufferlist bl;
-  ::encode(impl.binary, bl);
-  ::encode(info, bl);
-  mon->store->put_bl_ss(bl, "class_impl", store_name);
-  dout(10) << "adding name=" << info.name << " version=" << info.version <<  " store_name=" << store_name << dendl;
-
-  return true;
-}
-
-
-bool ClassMonitor::update_from_paxos()
-{
-  version_t paxosv = paxos->get_version();
-  if (paxosv == list.version) return true;
-  assert(paxosv >= list.version);
-
-  bufferlist blog;
-
-  if (list.version == 0 && paxosv > 1) {
-    // startup: just load latest full map
-    bufferlist latest;
-    version_t v = paxos->get_latest(latest);
-    if (v) {
-      dout(7) << "update_from_paxos startup: loading summary e" << v << dendl;
-      bufferlist::iterator p = latest.begin();
-      ::decode(list, p);
-    }
-  } 
-
-  // walk through incrementals
-  while (paxosv > list.version) {
-    bufferlist bl;
-    bool success = paxos->read(list.version+1, bl);
-    assert(success);
-
-    bufferlist::iterator p = bl.begin();
-    __u8 v;
-    ::decode(v, p);
-    ClassLibraryIncremental inc;
-    ::decode(inc, p);
-    ClassImpl impl;
-    ClassInfo info;
-    inc.decode_info(info);
-    switch (inc.op) {
-    case CLASS_INC_ADD:
-      inc.decode_impl(impl);
-      if (impl.binary.length() > 0) {
-        store_impl(info, impl);
-        list.add(info.name, info.version);
-      }
-      break;
-    case CLASS_INC_DEL:
-      list.remove(info.name, info.version);
-      break;
-    case CLASS_INC_ACTIVATE:
-      {
-        map<string, ClassVersionMap>::iterator mapiter = list.library_map.find(info.name);
-        if (mapiter == list.library_map.end()) {
-        } else {
-          ClassVersionMap& map = mapiter->second;
-          map.set_default(info.version.str());
-        }
-      }
-      break;
-    case CLASS_INC_NOP:
-      break;
-    default:
-      assert(0);
-    }
-
-    list.version++;
-  }
-
-  bufferlist bl;
-  ::encode(list, bl);
-  paxos->stash_latest(paxosv, bl);
-
-  return true;
-}
-
-void ClassMonitor::create_pending()
-{
-  pending_class.clear();
-  pending_list = list;
-  dout(10) << "create_pending v " << (paxos->get_version() + 1) << dendl;
-}
-
-void ClassMonitor::encode_pending(bufferlist &bl)
-{
-  dout(10) << "encode_pending v " << (paxos->get_version() + 1) << dendl;
-  __u8 v = 1;
-  ::encode(v, bl);
-  for (multimap<utime_t,ClassLibraryIncremental>::iterator p = pending_class.begin();
-       p != pending_class.end();
-       p++)
-    p->second.encode(bl);
-}
-
-bool ClassMonitor::preprocess_query(PaxosServiceMessage *m)
-{
-  dout(10) << "preprocess_query " << *m << " from " << m->get_orig_source_inst() << dendl;
-  switch (m->get_type()) {
-  case MSG_MON_COMMAND:
-    return preprocess_command((MMonCommand*)m);
-
-  case MSG_LOG:
-    return preprocess_class((MClass*)m);
-
-  default:
-    assert(0);
-    m->put();
-    return true;
-  }
-}
-
-bool ClassMonitor::prepare_update(PaxosServiceMessage *m)
-{
-  dout(10) << "prepare_update " << *m << " from " << m->get_orig_source_inst() << dendl;
-  switch (m->get_type()) {
-  case MSG_MON_COMMAND:
-    return prepare_command((MMonCommand*)m);
-  case MSG_CLASS:
-    return prepare_class((MClass*)m);
-  default:
-    assert(0);
-    m->put();
-    return false;
-  }
-}
-
-void ClassMonitor::committed()
-{
-
-}
-
-bool ClassMonitor::preprocess_class(MClass *m)
-{
-  dout(10) << "preprocess_class " << *m << " from " << m->get_orig_source() << dendl;
-  
-  int num_new = 0;
-  for (deque<ClassInfo>::iterator p = m->info.begin();
-       p != m->info.end();
-       p++) {
-    if (!pending_list.contains((*p).name))
-      num_new++;
-  }
-  if (!num_new) {
-    dout(10) << "  nothing new" << dendl;
-    m->put();
-    return true;
-  }
-  return false;
-}
-
-bool ClassMonitor::prepare_class(MClass *m) 
-{
-  dout(10) << "prepare_class " << *m << " from " << m->get_orig_source() << dendl;
-
-  if (ceph_fsid_compare(&m->fsid, &mon->monmap->fsid)) {
-    dout(10) << "handle_class on fsid " << m->fsid << " != " << mon->monmap->fsid << dendl;
-    m->put();
-    return false;
-  }
-  deque<ClassImpl>::iterator impl_iter = m->impl.begin();
-
-  for (deque<ClassInfo>::iterator p = m->info.begin();
-       p != m->info.end();
-       p++, impl_iter++) {
-    dout(10) << " writing class " << *p << dendl;
-    if (!pending_list.contains((*p).name)) {
-      ClassLibraryIncremental inc;
-      ::encode(*p, inc.info);
-      ::encode(*impl_iter, inc.impl);
-      pending_list.add(*p);
-      pending_class.insert(pair<utime_t,ClassLibraryIncremental>((*impl_iter).stamp, inc));
-    }
-  }
-
-  paxos->wait_for_commit(new C_Class(this, m));
-  return true;
-}
-
-void ClassMonitor::_updated_class(MClass *m)
-{
-  dout(7) << "_updated_class for " << m->get_orig_source_inst() << dendl;
-  ClassImpl impl = *(m->impl.rbegin());
-  mon->send_reply(m, new MClassAck(m->fsid, impl.seq));
-  m->put();
-}
-
-void ClassMonitor::class_usage(stringstream& ss)
-{
-  ss << "error: usage:" << std::endl;
-  ss << "              class <add | del> <name> <version> <arch> <--in-file=filename> [changed|overwrite|excl]" << std::endl;
-  ss << "              class <activate> <name> <version>" << std::endl;
-  ss << "              class <list>" << std::endl;
-}
-
-bool ClassMonitor::preprocess_command(MMonCommand *m)
-{
-  int r = -1;
-  bufferlist rdata;
-  stringstream ss;
-
-  if (m->cmd.size() > 1) {
-    if (m->cmd[1] == "add" ||
-        m->cmd[1] == "del" ||
-        m->cmd[1] == "activate" ||
-        m->cmd[1] == "list") {
-      return false;
-    }
-  }
-
-  class_usage(ss);
-  r = -EINVAL;
-
-  string rs;
-  getline(ss, rs, '\0');
-  mon->reply_command(m, r, rs, rdata, paxos->get_version());
-  return true;
-}
-
-
-bool ClassMonitor::prepare_command(MMonCommand *m)
-{
-  stringstream ss;
-  string rs;
-  int err = -EINVAL;
-
-  // nothing here yet
-  if (m->cmd.size() > 1) {
-    if (m->cmd[1] == "add" && m->cmd.size() >= 5) {
-      string name = m->cmd[2];
-      string ver = m->cmd[3];
-      string arch = m->cmd[4];
-      string opt;
-
-      bool excl_opt = false;
-      bool overwrite_opt = false;
-      bool changed_opt;
-      if (m->cmd.size() >= 6) {
-        opt = m->cmd[5];
-        if (opt == "excl")
-          excl_opt = true;
-        else if (opt == "overwrite")
-          overwrite_opt = true; 
-        else if (opt == "changed")
-         changed_opt = true;
-        else {
-         ss << "invalid option: " << opt;
-         goto done;
-        }
-      } else
-        changed_opt = true;
-
-      ClassImpl impl;
-      impl.binary = m->get_data();
-      if (impl.binary.length() <= 0) {
-         ss << "invalid binary data";
-         rs = -ENOENT;
-         goto done;
-      }
-      impl.stamp = g_clock.now();
-
-      bool in_map = list.library_map.find(name) != list.library_map.end();
-
-      ClassVersionMap& map = list.library_map[name];
-      ClassVersion cv(ver, arch);
-      ClassInfo& info = map.m[cv];
-
-      /* do we already have it? */
-      int len = name.length() + 16;
-      char store_name[len];
-      snprintf(store_name, len, "%s.%s.%s", name.c_str(), cv.str(), cv.arch());
-      bufferlist prev_bin;
-      bool should_store = true;
-      if (!overwrite_opt && in_map) {
-        bufferlist bl;
-
-        int bin_len = mon->store->get_bl_ss(bl, "class_impl", store_name);
-
-        if (bin_len > 0) {
-          bufferlist::iterator iter = bl.begin();
-          ::decode(prev_bin, iter);
-           /* check to see whether we should store it */
-          dout(10) << "class name exists" << dendl;
-          if (excl_opt) {
-            dout(10) << "excl flag, not overwriting" << dendl;
-            should_store = false;
-          } else if (changed_opt) {
-            if (prev_bin.length() == impl.binary.length() &&
-                memcmp(impl.binary.c_str(), prev_bin.c_str(), prev_bin.length()) == 0) {
-              dout(10) << "class content has not changed, not doing anything" << dendl;
-              should_store = false;
-            } else {
-              dout(10) << "class content changed, will keep newer version" << dendl;
-            }
-          }
-        }
-      }
-
-      ClassLibraryIncremental inc;
-      if (should_store) {
-        dout(10) << "payload.length=" << m->get_data().length() << dendl;
-        info.name = name;
-        info.version = cv;
-        dout(0) << "storing class " << name << " v" << info.version << dendl;
-        ::encode(impl, inc.impl);
-        ::encode(info, inc.info);
-        inc.op = CLASS_INC_ADD;
-        pending_list.add(info);
-      } else {
-        ClassImpl i;
-        ClassInfo l;
-        ::encode(i, inc.impl);
-        ::encode(l, inc.info);
-        inc.op = CLASS_INC_NOP;
-      }
-      pending_class.insert(pair<utime_t,ClassLibraryIncremental>(impl.stamp, inc));
-      ss << "updated";
-      getline(ss, rs);
-      paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
-      return true;
-    } else if (m->cmd[1] == "del" && m->cmd.size() >= 5) {
-      string name = m->cmd[2];
-      string ver = m->cmd[3];
-      string arch = m->cmd[4];
-      map<string, ClassVersionMap>::iterator iter = list.library_map.find(name);
-      if (iter == list.library_map.end()) {
-        ss << "couldn't find class " << name;
-        rs = -ENOENT;
-        goto done;
-      }
-      ClassVersionMap& map = iter->second;
-      ClassVersion v(ver, arch);
-      ClassInfo *info = map.get(v);
-      if (!info) {
-        ss << "couldn't find class " << name << " v" << v;
-        rs = -ENOENT;
-        goto done;
-      }
-      dout(0) << "removing class " << name << " v" << info->version << dendl;
-      ClassLibraryIncremental inc;
-      ClassImpl impl;
-      impl.stamp = g_clock.now();
-      ::encode(*info, inc.info);
-      inc.op = CLASS_INC_DEL;
-      pending_list.add(*info);
-      pending_class.insert(pair<utime_t,ClassLibraryIncremental>(impl.stamp, inc));
-
-      ss << "updated";
-      getline(ss, rs);
-      paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
-      return true;
-    } else if (m->cmd[1] == "activate" && m->cmd.size() >= 4) {
-      string name = m->cmd[2];
-      string ver = m->cmd[3];
-      map<string, ClassVersionMap>::iterator iter = list.library_map.find(name);
-      if (iter == list.library_map.end()) {
-        ss << "couldn't find class " << name;
-        rs = -ENOENT;
-        goto done;
-      }
-      ClassInfo info;
-      info.name = name;
-      info.version.set_ver(ver.c_str());
-      
-      dout(0) << "activating class " << name << " v" << info.version << dendl;
-      ClassLibraryIncremental inc;
-      ClassImpl impl;
-      impl.stamp = g_clock.now();
-      ::encode(info, inc.info);
-      inc.op = CLASS_INC_ACTIVATE;
-      pending_list.add(info);
-      pending_class.insert(pair<utime_t,ClassLibraryIncremental>(impl.stamp, inc));
-      ss << "updated";
-      getline(ss, rs);
-      paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
-      return true;
-    } else if (m->cmd[1] == "list") {
-      map<string, ClassVersionMap>::iterator mapiter = list.library_map.begin();
-      if (mapiter != list.library_map.end()) {
-        ss << "installed classes: " << std::endl;      
-
-       while (mapiter != list.library_map.end()) {
-          ClassVersionMap& map = mapiter->second;
-          dout(10) << "active class version=" << map.default_ver << dendl;
-          tClassVersionMap::iterator iter = map.begin();
-          while (iter != map.end()) {
-            string def_str = "";
-            if (iter->second.version.str() == map.default_ver)
-              def_str = " [active]";
-            ss << iter->second.name << " (v" << iter->second.version << ")" << def_str << std::endl;
-            ++iter;
-          }
-          ++mapiter;
-        }
-      } else {
-        ss << "no installed classes!";
-      }
-      err = 0;
-      goto done;
-    } else {
-      class_usage(ss);
-    }
-  } else {
-    class_usage(ss);
-  }
-
-done:
-  getline(ss, rs, '\0');
-  mon->reply_command(m, err, rs, paxos->get_version());
-  return false;
-}
-
-void ClassMonitor::handle_request(MClass *m)
-{
-  dout(10) << "handle_request " << *m << " from " << m->get_orig_source() << dendl;
-  MClass *reply = new MClass();
-
-  if (!reply) {
-    m->put();
-    return;
-  }
-
-  deque<ClassImpl>::iterator impl_iter = m->impl.begin();
-  deque<bool>::iterator add_iter = m->add.begin();
-  
-  for (deque<ClassInfo>::iterator p = m->info.begin();
-       p != m->info.end();
-       p++) {
-    ClassImpl impl;
-    ClassVersion ver;
-
-    reply->info.push_back(*p);
-    switch (m->action) {
-    case CLASS_GET:
-      dout(10) << "CLASS_GET name='" << (*p).name << "' ver='" << (*p).version << "'" << dendl;
-      if (list.get_ver((*p).name, (*p).version, &ver)) {
-        int len = (*p).name.length() + 16;
-        int bin_len;
-        char store_name[len];
-        snprintf(store_name, len, "%s.%s.%s", (*p).name.c_str(), ver.str(), ver.arch());
-        bufferlist bl;
-        bin_len = mon->store->get_bl_ss(bl, "class_impl", store_name);
-        assert(bin_len > 0);
-        bufferlist::iterator iter = bl.begin();
-        ::decode(impl.binary, iter);
-        dout(10) << "replying with name=" << (*p).name << " version=" << ver <<  " store_name=" << store_name << dendl;
-        list.add((*p).name, ver);
-        reply->add.push_back(true);
-        reply->impl.push_back(impl);
-      } else {
-        reply->add.push_back(false);
-      }
-      break;
-    case CLASS_SET:
-       {
-         dout(10) << "ClassMonitor::handle_request() CLASS_SET" << dendl;
-         bool add = *add_iter;
-         ClassVersionMap& cv = list.library_map[(*p).name];
-         ClassInfo entry;
-         entry.name = (*p).name;
-         entry.version = (*p).version;
-         if (add) {
-           cv.add(entry);
-           store_impl(entry, *impl_iter);
-         } else {
-           cv.remove(entry);
-         }
-         impl_iter++;
-         add_iter++;
-       } 
-    }
-  }
-  reply->action = CLASS_RESPONSE;
-  mon->send_reply(m, reply);
-  m->put();
-}
-
diff --git a/src/mon/ClassMonitor.h b/src/mon/ClassMonitor.h
deleted file mode 100644 (file)
index 3b4e3fd..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef CEPH_CLASSMONITOR_H
-#define CEPH_CLASSMONITOR_H
-
-#include <map>
-#include <set>
-using namespace std;
-
-#include "include/types.h"
-#include "msg/Messenger.h"
-#include "PaxosService.h"
-#include "mon/Monitor.h"
-
-#include "include/ClassLibrary.h"
-
-class MMonCommand;
-class MClass;
-
-class ClassMonitor : public PaxosService {
-  void class_usage(stringstream& ss);
-private:
-  multimap<utime_t,ClassLibraryIncremental> pending_class;
-  ClassLibrary pending_list, list;
-
-  void create_initial(bufferlist& bl);
-  bool update_from_paxos();
-  void create_pending();  // prepare a new pending
-  void encode_pending(bufferlist &bl);  // propose pending update to peers
-
-  void committed();
-
-  bool preprocess_query(PaxosServiceMessage *m);  // true if processed.
-  bool prepare_update(PaxosServiceMessage *m);
-
-  bool preprocess_class(MClass *m);
-  bool prepare_class(MClass *m);
-  void _updated_class(MClass *m);
-
-  struct C_Class : public Context {
-    ClassMonitor *classmon;
-    MClass *ack;
-    C_Class(ClassMonitor *p, MClass *a) : classmon(p), ack(a) {}
-    void finish(int r) {
-      classmon->_updated_class(ack);
-    }    
-  };
-
-  bool preprocess_command(MMonCommand *m);
-  bool prepare_command(MMonCommand *m);
-  bool store_impl(ClassInfo& info, ClassImpl& impl);
- public:
-  ClassMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p) { }
-  void handle_request(MClass *m);
-  
-  void tick();  // check state, take actions
-};
-
-#endif
index 54a3b8aec158ac16ebbba50d86b8a700f146bedf..d68062b19e1427b71372bd8d64fe4ce82c3e0a1c 100644 (file)
@@ -87,8 +87,6 @@ int MonCaps::get_service_id(string& token)
     return PAXOS_OSDMAP;
   } else if (token.compare("log") == 0) {
     return PAXOS_LOG;
-  } else if (token.compare("class") == 0) {
-    return PAXOS_CLASS;
   } else if (token.compare("auth") == 0) {
     return PAXOS_AUTH;
   }
index e9bf67458496bffe0e672e28c33fde7e995b6601..d5dc29cf55e93867abe2c927e1dcf7358c8d8901 100644 (file)
@@ -30,7 +30,6 @@
 #include "messages/MMonObserveNotify.h"
 
 #include "messages/MMonPaxos.h"
-#include "messages/MClass.h"
 #include "messages/MRoute.h"
 #include "messages/MForward.h"
 
@@ -50,7 +49,6 @@
 #include "MonmapMonitor.h"
 #include "PGMonitor.h"
 #include "LogMonitor.h"
-#include "ClassMonitor.h"
 #include "AuthMonitor.h"
 
 #include "osd/OSDMap.h"
@@ -109,7 +107,6 @@ Monitor::Monitor(string nm, MonitorStore *s, Messenger *m, MonMap *map) :
   paxos_service[PAXOS_OSDMAP] = new OSDMonitor(this, add_paxos(PAXOS_OSDMAP));
   paxos_service[PAXOS_PGMAP] = new PGMonitor(this, add_paxos(PAXOS_PGMAP));
   paxos_service[PAXOS_LOG] = new LogMonitor(this, add_paxos(PAXOS_LOG));
-  paxos_service[PAXOS_CLASS] = new ClassMonitor(this, add_paxos(PAXOS_CLASS));
   paxos_service[PAXOS_AUTH] = new AuthMonitor(this, add_paxos(PAXOS_AUTH));
 
   mon_caps = new MonCaps();
@@ -337,7 +334,7 @@ void Monitor::handle_command(MMonCommand *m)
       return;
     } 
     if (m->cmd[0] == "class") {
-      classmon()->dispatch(m);
+      reply_command(m, -EINVAL, "class distribution is no longer handled by the monitor", 0);
       return;
     }
     if (m->cmd[0] == "auth") {
@@ -765,10 +762,6 @@ bool Monitor::_ms_dispatch(Message *m)
       elector.dispatch(m);
       break;
 
-    case MSG_CLASS:
-      handle_class((MClass *)m);
-      break;
-
     case MSG_FORWARD:
       handle_forward((MForward *)m);
       break;
@@ -991,6 +984,8 @@ int Monitor::mkfs(bufferlist& osdmapbl)
 
   for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); p++) {
     PaxosService *svc = *p;
+    if (!svc)
+      continue;
     bufferlist bl;
     dout(10) << "initializing " << svc->get_machine_name() << dendl;
     svc->paxos->init();
@@ -1017,36 +1012,6 @@ int Monitor::mkfs(bufferlist& osdmapbl)
   return 0;
 }
 
-void Monitor::handle_class(MClass *m)
-{
-  MonSession *session = m->get_session();
-  if (!session)
-    goto done;
-  if (!session->caps.check_privileges(PAXOS_OSDMAP, MON_CAP_X)) {
-    dout(1) << "MClass received from entity without sufficient privileges "
-           << session->caps << dendl;
-    goto done;
-  }
-
-  switch (m->action) {
-    case CLASS_SET:
-    case CLASS_GET:
-      classmon()->handle_request(m);
-      return;
-
-    case CLASS_RESPONSE:
-      dout(10) << "got a class response (" << *m << ") ???" << dendl;
-      break;
-
-    default:
-      dout(10) << "got an unknown class message (" << *m << ") ???" << dendl;
-      break;
-  }
-
- done:
-  m->put();
-}
-
 bool Monitor::ms_get_authorizer(int service_id, AuthAuthorizer **authorizer, bool force_new)
 {
   dout(10) << "ms_get_authorizer for " << ceph_entity_type_name(service_id) << dendl;
index 2ea7da1e4465b4f0a04eab93e54acbd5f40f9a16..f55b44e0080a48d6f31cd48d8a13a1199fa93864 100644 (file)
@@ -48,7 +48,6 @@ class PaxosService;
 class MMonGetMap;
 class MMonObserve;
 class MMonSubscribe;
-class MClass;
 class MAuthRotating;
 class MRoute;
 class MForward;
@@ -125,7 +124,6 @@ public:
   class MDSMonitor *mdsmon() { return (class MDSMonitor *)paxos_service[PAXOS_MDSMAP]; }
   class MonmapMonitor *monmon() { return (class MonmapMonitor *)paxos_service[PAXOS_MONMAP]; }
   class OSDMonitor *osdmon() { return (class OSDMonitor *)paxos_service[PAXOS_OSDMAP]; }
-  class ClassMonitor *classmon() { return (class ClassMonitor *)paxos_service[PAXOS_CLASS]; }
   class AuthMonitor *authmon() { return (class AuthMonitor *)paxos_service[PAXOS_AUTH]; }
 
   friend class Paxos;
@@ -150,7 +148,6 @@ public:
   void handle_mon_get_map(MMonGetMap *m);
   void handle_command(class MMonCommand *m);
   void handle_observe(MMonObserve *m);
-  void handle_class(MClass *m);
   void handle_route(MRoute *m);
 
   void reply_command(MMonCommand *m, int rc, const string &rs, version_t version);
index 24d0f1cd4bd50d69995ee85319d7169b38a3b5d4..48ca35d532215bd0451bc8075852b1bc28ea0608 100644 (file)
 #define PAXOS_MDSMAP     1
 #define PAXOS_OSDMAP     2
 #define PAXOS_LOG        3
-#define PAXOS_CLASS      4
-#define PAXOS_MONMAP     5
-#define PAXOS_AUTH       6
-#define PAXOS_NUM        7
+#define PAXOS_MONMAP     4
+#define PAXOS_AUTH       5
+#define PAXOS_NUM        6
 
 inline const char *get_paxos_name(int p) {
   switch (p) {
@@ -31,7 +30,6 @@ inline const char *get_paxos_name(int p) {
   case PAXOS_OSDMAP: return "osdmap";
   case PAXOS_PGMAP: return "pgmap";
   case PAXOS_LOG: return "logm";
-  case PAXOS_CLASS: return "class";
   case PAXOS_AUTH: return "auth";
   default: assert(0); return 0;
   }
index 82ebb4ecdf4d2cb254988237f9d1857bbd02d256..687b794fdf08591f069005af14a7fd02fb2cd15e 100644 (file)
@@ -125,9 +125,6 @@ using namespace std;
 
 #include "messages/MLock.h"
 
-#include "messages/MClass.h"
-#include "messages/MClassAck.h"
-
 #include "messages/MWatchNotify.h"
 
 #include "common/config.h"
@@ -510,14 +507,6 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer,
     m = new MGenericMessage(type);
     break;
 
-  case MSG_CLASS:
-    m = new MClass();
-    break;
-
-  case MSG_CLASS_ACK:
-    m = new MClassAck();
-    break;
-
   default:
     dout(0) << "can't decode unknown message type " << type << " MSG_AUTH=" << CEPH_MSG_AUTH << dendl;
     if (g_conf.ms_die_on_bad_msg)
index 6465d54ef2cafd423c090cd5135c8c2f2ef67392..c644db6c5651be0cbb382f3803ec1d6f9c0c533e 100644 (file)
@@ -2,7 +2,6 @@
 #include "include/types.h"
 #include "msg/Message.h"
 #include "osd/OSD.h"
-#include "messages/MClass.h"
 #include "ClassHandler.h"
 
 #include <dlfcn.h>
index bb4277ac77071ce7aad6b4b1f7804b32e8f7b6e4..bb6ed627379a608438db248dcf12856fa0c62c67 100644 (file)
@@ -2,13 +2,11 @@
 #define CEPH_CLASSHANDLER_H
 
 #include "include/types.h"
-#include "include/ClassLibrary.h"
 
 #include "objclass/objclass.h"
 
 #include "common/Cond.h"
 #include "common/Mutex.h"
-#include "common/ClassVersion.h"
 
 
 class ClassHandler
index 1cd3133eaa6248714b4f4ca0f739b5137fc3e27a..327d4c83c7d2a3d0f9e5793fa102e3c354492701 100644 (file)
@@ -66,8 +66,6 @@
 #include "messages/MPGStats.h"
 #include "messages/MPGStatsAck.h"
 
-#include "messages/MClass.h"
-
 #include "messages/MWatchNotify.h"
 
 #include "common/ProfLogger.h"
index 68fd9fa97d8e7cd1fa5928f4b33a2e1339d6bb42..4a2b8efb843e66ce41c2d84b41833a303a6977f1 100644 (file)
@@ -69,7 +69,6 @@ Context *resend_event = 0;
 #include "osd/OSDMap.h"
 #include "mds/MDSMap.h"
 #include "common/LogEntry.h"
-#include "include/ClassLibrary.h"
 
 #include "mon/mon_types.h"
 
@@ -165,35 +164,6 @@ static void handle_notify(MMonObserveNotify *notify)
       break;
     }
 
-  case PAXOS_CLASS:
-    {
-      bufferlist::iterator p = notify->bl.begin();
-      if (notify->is_latest) {
-       ClassLibrary list;
-       ::decode(list, p);
-       // show the first class info
-        map<string, ClassVersionMap>::iterator mapiter = list.library_map.begin();
-       if (mapiter != list.library_map.end()) {
-          ClassVersionMap& map = mapiter->second;
-          tClassVersionMap::iterator iter = map.begin();
-
-          if (iter != map.end())
-           *g.log << now << "   class " <<  iter->second << std::endl;
-       }
-      } else {
-       __u8 v;
-       ::decode(v, p);
-       while (!p.end()) {
-         ClassLibraryIncremental inc;
-          ::decode(inc, p);
-         ClassInfo info;
-         inc.decode_info(info);
-         *g.log << now << "   class " << info << std::endl;
-       }
-      }
-      break;
-    }
-
   case PAXOS_AUTH:
     {
 #if 0
index fee4342209f9dc5c32dcfe4b335d02a6e8e399a7..c06b553fc1d800533d3bfe8282eff143955a73a4 100755 (executable)
@@ -355,9 +355,6 @@ EOF
                done
                sleep 1
        fi
-
-       # load classes
-       $CEPH_BIN/cclass -c $conf -a -L .libs
 fi
 
 rm $osdmap_fn