expect_false ceph mds set max_mds asdf
ceph mds set max_file_size 1000000000
expect_false ceph mds set max_file_size 123asdf
+
+expect_false ceph mds set allow_new_snaps
+expect_false ceph mds set allow_new_snaps true
+ceph mds set allow_new_snaps true --yes-i-really-mean-it
+ceph mds set allow_new_snaps 0
+ceph mds set allow_new_snaps false
+ceph mds set allow_new_snaps no
+expect_false ceph mds set allow_new_snaps taco
+
ceph mds stat
# ceph mds tell mds.a getmap
# ceph mds rm
goto out;
}
pending_mdsmap.max_file_size = n;
+ } else if (var == "allow_new_snaps") {
+ if (val == "false" || val == "no" || (interr.length() == 0 && n == 0)) {
+ pending_mdsmap.clear_snaps_allowed();
+ ss << "disabled new snapshots";
+ } else if (val == "true" || val == "yes" || (interr.length() == 0 && n == 1)) {
+ string confirm;
+ if (!cmd_getval(g_ceph_context, cmdmap, "confirm", confirm) ||
+ confirm != "--yes-i-really-mean-it") {
+ ss << "Snapshots are unstable and will probably break your FS! Set to --yes-i-really-mean-it if you are sure you want to enable them";
+ r = -EPERM;
+ goto out;
+ }
+ pending_mdsmap.set_snaps_allowed();
+ ss << "enabled new snapshots";
+ } else {
+ ss << "value must be true|yes|1 or false|no|0";
+ r = -EINVAL;
+ goto out;
+ }
} else {
ss << "unknown variable " << var;
goto out;
} else if (prefix == "mds inline disable") {
pending_mdsmap.set_inline_data_enabled(false);
r = 0;
- } else if (prefix == "mds set") {
- string key;
- cmd_getval(g_ceph_context, cmdmap, "key", key);
- string sure;
- cmd_getval(g_ceph_context, cmdmap, "sure", sure);
- if (key == "allow_new_snaps") {
- if (sure != "--yes-i-really-mean-it") {
- ss << "Snapshots are unstable and will probably break your FS! Add --yes-i-really-mean-it if you are sure";
- r = -EPERM;
- } else {
- pending_mdsmap.set_snaps_allowed();
- ss << "turned on snaps";
- r = 0;
- }
- }
- } else if (prefix == "mds unset") {
- string key;
- cmd_getval(g_ceph_context, cmdmap, "key", key);
- string sure;
- cmd_getval(g_ceph_context, cmdmap, "sure", sure);
- if (key == "allow_new_snaps") {
- if (sure != "--yes-i-really-mean-it") {
- ss << "this won't get rid of snapshots or restore the cluster if it's broken. Add --yes-i-really-mean-it if you are sure";
- r = -EPERM;
- } else {
- pending_mdsmap.clear_snaps_allowed();
- ss << "disabled new snapshots";
- r = 0;
- }
- }
} else if (prefix == "mds add_data_pool") {
string poolname;
cmd_getval(g_ceph_context, cmdmap, "pool", poolname);
"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 " \
- "name=val,type=CephString", \
+ "name=var,type=CephChoices,strings=max_mds|max_file_size|allow_new_snaps " \
+ "name=val,type=CephString " \
+ "name=confirm,type=CephString,req=false", \
"set mds parameter <var> to <val>", "mds", "rw", "cli,rest")
COMMAND("mds setmap " \
"name=epoch,type=CephInt,range=0", \
COMMAND("mds inline disable", \
"disable inline data feature", \
"mds", "rw", "cli,rest")
-COMMAND("mds set " \
- "name=key,type=CephChoices,strings=allow_new_snaps " \
- "name=sure,type=CephString,req=false", \
- "set <key>", \
- "mds", "rw", "cli,rest")
-COMMAND("mds unset " \
- "name=key,type=CephChoices,strings=allow_new_snaps " \
- "name=sure,type=CephString,req=false", \
- "unset <key>", "mds", "rw", "cli,rest")
COMMAND("mds add_data_pool " \
"name=pool,type=CephString", \
"add data pool <pool>", "mds", "rw", "cli,rest")
'rm_incompat', '1', '1']))
def test_mds_set(self):
- self.assert_valid_command(['mds', 'set', 'allow_new_snaps'])
- self.assert_valid_command(['mds', 'set', 'allow_new_snaps', 'sure'])
+ self.assert_valid_command(['mds', 'set', 'max_mds', '2'])
+ self.assert_valid_command(['mds', 'set', 'max_file_size', '2'])
+ self.assert_valid_command(['mds', 'set', 'allow_new_snaps', 'no'])
assert_equal({}, validate_command(sigdict, ['mds',
'set',
'invalid']))
- assert_equal({}, validate_command(sigdict, ['mds',
- 'set',
- 'allow_new_snaps',
- 'sure',
- 'toomany']))
-
- def test_mds_unset(self):
- self.assert_valid_command(['mds', 'unset', 'allow_new_snaps'])
- self.assert_valid_command(['mds', 'unset', 'allow_new_snaps', 'sure'])
- assert_equal({}, validate_command(sigdict, ['mds',
- 'unset',
- 'invalid']))
- assert_equal({}, validate_command(sigdict, ['mds',
- 'unset',
- 'allow_new_snaps',
- 'sure',
- 'toomany']))
def test_add_data_pool(self):
self.assert_valid_command(['mds', 'add_data_pool', '1'])