]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: introduce mgr entity_type_t
authorJohn Spray <john.spray@redhat.com>
Thu, 19 May 2016 11:55:17 +0000 (12:55 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:26:53 +0000 (17:26 +0100)
Mgr will probably ultimately have different auth caps,
so let's make it a separate entity up front instead
of e.g. pretending to be a mon.

Signed-off-by: John Spray <john.spray@redhat.com>
src/common/ceph_strings.cc
src/common/entity_name.cc
src/common/entity_name.h
src/include/msgr.h
src/msg/msg_types.h
src/test/cli/ceph-conf/invalid-args.t

index 71c7b08678a61c41930e209c3dcc93792810668f..aebfb22e34c6102bad3517c9fee4496aa2180619 100644 (file)
@@ -9,6 +9,7 @@ const char *ceph_entity_type_name(int type)
        case CEPH_ENTITY_TYPE_MDS: return "mds";
        case CEPH_ENTITY_TYPE_OSD: return "osd";
        case CEPH_ENTITY_TYPE_MON: return "mon";
+       case CEPH_ENTITY_TYPE_MGR: return "mgr";
        case CEPH_ENTITY_TYPE_CLIENT: return "client";
        case CEPH_ENTITY_TYPE_AUTH: return "auth";
        default: return "unknown";
index 2e0b0cb1d9efee076f78f20728c52a8601a66d64..fbe8bd125dc8e45d0243d5f9a6030c307f31d104 100644 (file)
@@ -33,6 +33,7 @@ static const str_to_entity_type_t STR_TO_ENTITY_TYPE[] = {
   { CEPH_ENTITY_TYPE_MON, "mon" },
   { CEPH_ENTITY_TYPE_OSD, "osd" },
   { CEPH_ENTITY_TYPE_MDS, "mds" },
+  { CEPH_ENTITY_TYPE_MGR, "mgr" },
   { CEPH_ENTITY_TYPE_CLIENT, "client" },
 };
 
index e9329754762c2649f6c1f8decd58c0de2602fd83..d1c6cbcdd7be5729dc98db594db85c87b275561a 100644 (file)
@@ -58,6 +58,7 @@ struct EntityName
 
   uint32_t get_type() const { return type; }
   bool is_osd() const { return get_type() == CEPH_ENTITY_TYPE_OSD; }
+  bool is_mgr() const { return get_type() == CEPH_ENTITY_TYPE_MGR; }
   bool is_mds() const { return get_type() == CEPH_ENTITY_TYPE_MDS; }
   bool is_client() const { return get_type() == CEPH_ENTITY_TYPE_CLIENT; }
   bool is_mon() const { return get_type() == CEPH_ENTITY_TYPE_MON; }
index 4d90d4c7ee23388aa4134c1a50d821d8558da23c..f60c9dfa4938a5b62e609eacb89ff2a0c50e4072 100644 (file)
@@ -50,6 +50,7 @@ struct ceph_entity_name {
 #define CEPH_ENTITY_TYPE_MDS    0x02
 #define CEPH_ENTITY_TYPE_OSD    0x04
 #define CEPH_ENTITY_TYPE_CLIENT 0x08
+#define CEPH_ENTITY_TYPE_MGR    0x10
 #define CEPH_ENTITY_TYPE_AUTH   0x20
 
 #define CEPH_ENTITY_TYPE_ANY    0xFF
index a71c95d94ff14bf78c2d3f16fa7b2f41d8c7e834..c7f21e2495c5500ea3e062d0639196e4c70149f2 100644 (file)
@@ -40,6 +40,7 @@ public:
   static const int TYPE_MDS = CEPH_ENTITY_TYPE_MDS;
   static const int TYPE_OSD = CEPH_ENTITY_TYPE_OSD;
   static const int TYPE_CLIENT = CEPH_ENTITY_TYPE_CLIENT;
+  static const int TYPE_MGR = CEPH_ENTITY_TYPE_MGR;
 
   static const int64_t NEW = -1;
 
@@ -54,6 +55,7 @@ public:
   static entity_name_t MDS(int64_t i=NEW) { return entity_name_t(TYPE_MDS, i); }
   static entity_name_t OSD(int64_t i=NEW) { return entity_name_t(TYPE_OSD, i); }
   static entity_name_t CLIENT(int64_t i=NEW) { return entity_name_t(TYPE_CLIENT, i); }
+  static entity_name_t MGR(int64_t i=NEW) { return entity_name_t(TYPE_MGR, i); }
   
   int64_t num() const { return _num; }
   int type() const { return _type; }
@@ -67,6 +69,7 @@ public:
   bool is_mds() const { return type() == TYPE_MDS; }
   bool is_osd() const { return type() == TYPE_OSD; }
   bool is_mon() const { return type() == TYPE_MON; }
+  bool is_mgr() const { return type() == TYPE_MGR; }
 
   operator ceph_entity_name() const {
     ceph_entity_name n = { _type, init_le64(_num) };
@@ -92,6 +95,9 @@ public:
     } else if (strstr(start, "client.") == start) {
       _type = TYPE_CLIENT;
       start += 7;
+    } else if (strstr(start, "mgr.") == start) {
+      _type = TYPE_MGR;
+      start += 4;
     } else {
       return false;
     }
index d0fe553ed00771c18cef37398e6175fd75f6206d..43cedf2da16d35a394ac6698cf6baaa3012f9f09 100644 (file)
@@ -8,7 +8,7 @@
   [1]
 
   $ ceph-conf -c test.conf --name total.garbage
-  error parsing 'total.garbage': expected string of the form TYPE.ID, valid types are: auth, mon, osd, mds, client
+  error parsing 'total.garbage': expected string of the form TYPE.ID, valid types are: auth, mon, osd, mds, mgr, client
   [1]
 
   $ ceph-conf -c test.conf -s bar