From: Sage Weil Date: Sun, 2 Feb 2014 20:02:08 +0000 (-0800) Subject: mon: use 'mds set inline_data ...' for enable/disable of inline data X-Git-Tag: v0.77~9^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eb9ffd5a7918ca7da2e68abfc5260acf9288c1b4;p=ceph.git mon: use 'mds set inline_data ...' for enable/disable of inline data This makes the management interface a bit more consistent. Signed-off-by: Sage Weil --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 0e61f9feb74a..58d0e94a5214 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -160,6 +160,15 @@ ceph mds set_max_mds 4 ceph mds set_max_mds 3 ceph mds set max_mds 4 expect_false ceph mds set max_mds asdf +expect_false ceph mds set inline_data true +ceph mds set inline_data true --yes-i-really-mean-it +ceph mds set inline_data yes --yes-i-really-mean-it +ceph mds set inline_data 1 --yes-i-really-mean-it +expect_false ceph mds set inline_data --yes-i-really-mean-it +ceph mds set inline_data false +ceph mds set inline_data no +ceph mds set inline_data 0 +expect_false ceph mds set inline_data asdf ceph mds set max_file_size 1000000000 expect_false ceph mds set max_file_size 123asdf diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index e24b1d01d1b9..0f7bf274eb45 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -842,6 +842,27 @@ bool MDSMonitor::prepare_command(MMonCommand *m) if (interr.length()) goto out; pending_mdsmap.max_mds = n; + } else if (var == "inline_data") { + if (val == "true" || val == "yes" || (!interr.length() && n == 1)) { + string confirm; + if (!cmd_getval(g_ceph_context, cmdmap, "confirm", confirm) || + confirm != "--yes-i-really-mean-it") { + ss << "inline data is new and experimental; you must specify --yes-i-really-mean-it"; + r = -EPERM; + goto out; + } + ss << "inline data enabled"; + pending_mdsmap.set_inline_data_enabled(true); + pending_mdsmap.compat.incompat.insert(MDS_FEATURE_INCOMPAT_INLINE); + } else if (val == "false" || val == "no" || + (!interr.length() && n == 0)) { + ss << "inline data disabled"; + pending_mdsmap.set_inline_data_enabled(false); + } else { + ss << "value must be false|no|0 or true|yes|1"; + r = -EINVAL; + goto out; + } } else if (var == "max_file_size") { if (interr.length()) { ss << var << " requires an integer value"; @@ -994,13 +1015,6 @@ bool MDSMonitor::prepare_command(MMonCommand *m) r = 0; } - } else if (prefix == "mds inline enable") { - pending_mdsmap.set_inline_data_enabled(true); - pending_mdsmap.compat.incompat.insert(MDS_FEATURE_INCOMPAT_INLINE); - r = 0; - } else if (prefix == "mds inline disable") { - pending_mdsmap.set_inline_data_enabled(false); - r = 0; } else if (prefix == "mds add_data_pool") { string poolname; cmd_getval(g_ceph_context, cmdmap, "pool", poolname); diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index de84997db559..bff1f2e7b5ae 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -249,7 +249,7 @@ COMMAND("mds set_max_mds " \ "name=maxmds,type=CephInt,range=0", \ "set max MDS index", "mds", "rw", "cli,rest") COMMAND("mds set " \ - "name=var,type=CephChoices,strings=max_mds|max_file_size|allow_new_snaps " \ + "name=var,type=CephChoices,strings=max_mds|max_file_size|allow_new_snaps|inline_data " \ "name=val,type=CephString " \ "name=confirm,type=CephString,req=false", \ "set mds parameter to ", "mds", "rw", "cli,rest") @@ -279,12 +279,6 @@ COMMAND("mds compat rm_compat " \ COMMAND("mds compat rm_incompat " \ "name=feature,type=CephInt,range=0", \ "remove incompatible feature", "mds", "rw", "cli,rest") -COMMAND("mds inline enable", \ - "enable inline data feature", \ - "mds", "rw", "cli,rest") -COMMAND("mds inline disable", \ - "disable inline data feature", \ - "mds", "rw", "cli,rest") COMMAND("mds add_data_pool " \ "name=pool,type=CephString", \ "add data pool ", "mds", "rw", "cli,rest")