]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: use 'else if' on handle_command instead of bunches of 'if'
authorJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 2 Jan 2013 14:45:01 +0000 (14:45 +0000)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Fri, 11 Jan 2013 00:44:21 +0000 (00:44 +0000)
... when the options are mutually exclusive.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/Monitor.cc

index 444757c893304eef2bfe38f3a8572ea098e10062..bc2004edf9f4e6c865e121201ef4dfef53b2eab4 100644 (file)
@@ -1528,8 +1528,7 @@ void Monitor::handle_command(MMonCommand *m)
       rs = "must supply options to be parsed in a single string";
       r = -EINVAL;
     }
-  } 
-  if (m->cmd[0] == "status") {
+  } else if (m->cmd[0] == "status") {
     if (!access_r) {
       r = -EACCES;
       rs = "access denied";
@@ -1547,8 +1546,7 @@ void Monitor::handle_command(MMonCommand *m)
     ss << "   mdsmap " << mdsmon()->mdsmap << "\n";
     rs = ss.str();
     r = 0;
-  }
-  if (m->cmd[0] == "report") {
+  } else if (m->cmd[0] == "report") {
     if (!access_r) {
       r = -EACCES;
       rs = "access denied";
@@ -1572,7 +1570,7 @@ void Monitor::handle_command(MMonCommand *m)
 
     string hs;
     get_health(hs, NULL, &jf);
-    
+
     monmon()->dump_info(&jf);
     osdmon()->dump_info(&jf);
     mdsmon()->dump_info(&jf);
@@ -1591,8 +1589,7 @@ void Monitor::handle_command(MMonCommand *m)
     rdata.append(ss2.str());
     rs = string();
     r = 0;
-  }
-  if (m->cmd[0] == "quorum_status") {
+  } else if (m->cmd[0] == "quorum_status") {
     if (!access_r) {
       r = -EACCES;
       rs = "access denied";
@@ -1608,8 +1605,7 @@ void Monitor::handle_command(MMonCommand *m)
     _quorum_status(ss);
     rs = ss.str();
     r = 0;
-  }
-  if (m->cmd[0] == "mon_status") {
+  } else if (m->cmd[0] == "mon_status") {
     if (!access_r) {
       r = -EACCES;
       rs = "access denied";
@@ -1619,8 +1615,7 @@ void Monitor::handle_command(MMonCommand *m)
     _mon_status(ss);
     rs = ss.str();
     r = 0;
-  }
-  if (m->cmd[0] == "health") {
+  } else if (m->cmd[0] == "health") {
     if (!access_r) {
       r = -EACCES;
       rs = "access denied";
@@ -1628,8 +1623,7 @@ void Monitor::handle_command(MMonCommand *m)
     }
     get_health(rs, (m->cmd.size() > 1) ? &rdata : NULL, NULL);
     r = 0;
-  }
-  if (m->cmd[0] == "heap") {
+  } else if (m->cmd[0] == "heap") {
     if (!access_all) {
       r = -EACCES;
       rs = "access denied";
@@ -1642,8 +1636,7 @@ void Monitor::handle_command(MMonCommand *m)
       ceph_heap_profiler_handle_command(m->cmd, ss);
       rs = ss.str();
     }
-  }
-  if (m->cmd[0] == "quorum") {
+  } else if (m->cmd[0] == "quorum") {
     if (!access_all) {
       r = -EACCES;
       rs = "access denied";