diff options
-rw-r--r-- | qa/run_xfstests.sh | 3 | ||||
-rwxr-xr-x | qa/workunits/cephtool/test.sh | 11 | ||||
-rwxr-xr-x | src/ceph.in | 4 | ||||
-rw-r--r-- | src/mon/MonCommands.h | 2 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 8 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 3 | ||||
-rw-r--r-- | src/pybind/ceph_argparse.py | 21 | ||||
-rw-r--r-- | src/test/common/get_command_descriptions.cc | 2 | ||||
-rwxr-xr-x | src/test/pybind/test_ceph_argparse.py | 12 |
9 files changed, 51 insertions, 15 deletions
diff --git a/qa/run_xfstests.sh b/qa/run_xfstests.sh index f3dffca293f..f9c3e55a79d 100644 --- a/qa/run_xfstests.sh +++ b/qa/run_xfstests.sh @@ -276,6 +276,9 @@ function install_xfstests() { cd xfstests + # FIXME: use an older version before the tests were rearranged! + git reset --hard e5f1a13792f20cfac097fef98007610b422f2cac + ncpu=$(getconf _NPROCESSORS_ONLN 2>&1) [ -n "${ncpu}" -a "${ncpu}" -gt 1 ] && multiple="-j ${ncpu}" diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 51420a2f134..09e55b9a842 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -169,7 +169,16 @@ bl=192.168.0.1:0/1000 ceph osd blacklist add $bl ceph osd blacklist ls | grep $bl ceph osd blacklist rm $bl -expect_false "(ceph osd blacklist ls | grep $bl)" +expect_false "ceph osd blacklist ls | grep $bl" + +bl=192.168.0.1 +# test without nonce, invalid nonce +ceph osd blacklist add $bl +ceph osd blacklist ls | grep $bl +ceph osd blacklist rm $bl +expect_false "ceph osd blacklist ls | grep $bl" +expect_false "ceph osd blacklist $bl/-1" +expect_false "ceph osd blacklist $bl/foo" ceph osd crush tunables legacy ceph osd crush tunables bobtail diff --git a/src/ceph.in b/src/ceph.in index 320e4bd413f..e4d4cf10344 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -476,6 +476,9 @@ def complete(sigdict, args, target): ### def main(): + ceph_args = os.environ.get('CEPH_ARGS') + if ceph_args: + sys.argv.extend(ceph_args.split()) parser, parsed_args, childargs = parse_cmdargs() @@ -556,7 +559,6 @@ def main(): cluster_handle = rados.Rados(name=name, clustername=clustername, conf_defaults=conf_defaults, conffile=conffile) - cluster_handle.conf_parse_env() retargs = cluster_handle.conf_parse_argv(childargs) #tmp = childargs childargs = retargs diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 752745a0c22..33e00a98d30 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -59,7 +59,7 @@ * CephString: optional badchars * CephSocketpath: validation involves "is it S_ISSOCK" * CephIPAddr: v4 or v6 addr with optional port, syntax validated - * CephEntityAddr: CephIPAddr + '/nonce' + * CephEntityAddr: CephIPAddr + optional '/nonce' * CephPoolname: Plainold string * CephObjectname: Another plainold string * CephPgid: n.xxx where n is an int > 0, xxx is a hex number > 0 diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index f4fe49bf8de..9144736d801 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -120,7 +120,12 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) * We will possibly have a stashed latest that *we* wrote, and we will * always be sure to have the oldest full map in the first..last range * due to encode_trim_extra(), which includes the oldest full map in the trim - * transaction. Start with whichever is newer. + * transaction. + * + * encode_trim_extra() does not however write the full map's + * version to 'full_latest'. This is only done when we are building the + * full maps from the incremental versions. But don't panic! We make sure + * that the following conditions find whichever full map version is newer. */ version_t latest_full = get_version_latest_full(); if (latest_full == 0 && get_first_committed() > 1) @@ -637,7 +642,6 @@ void OSDMonitor::encode_trim_extra(MonitorDBStore::Transaction *tx, version_t fi bufferlist bl; get_version_full(first, bl); put_version_full(tx, first, bl); - put_version_latest_full(tx, first); } // ------------- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 7831f95818d..c826c38c145 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2930,6 +2930,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) op.extent.length = (op.extent.offset > oi.size ? 0 : oi.size - op.extent.offset); dout(10) << " old truncate_seq " << op.extent.truncate_seq << " < current " << seq << ", adjusting write length to " << op.extent.length << dendl; + bufferlist t; + t.substr_of(osd_op.indata, 0, op.extent.length); + osd_op.indata.swap(t); } if (op.extent.truncate_seq > seq) { // write arrives before trimtrunc diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py index f115d3791af..7ec7b8b2f0c 100644 --- a/src/pybind/ceph_argparse.py +++ b/src/pybind/ceph_argparse.py @@ -275,15 +275,26 @@ class CephIPAddr(CephArgtype): class CephEntityAddr(CephIPAddr): """ - EntityAddress, that is, IP address/nonce + EntityAddress, that is, IP address[/nonce] """ def valid(self, s, partial=False): - try: + nonce = None + if '/' in s: ip, nonce = s.split('/') - except: - raise ArgumentValid('{0} must contain a /'.format(s)) + else: + ip = s super(self.__class__, self).valid(ip) - self.nonce = nonce + if nonce: + nonce_long = None + try: + nonce_long = long(nonce) + except ValueError: + pass + if nonce_long is None or nonce_long < 0: + raise ArgumentValid( + '{0}: invalid entity, nonce {1} not integer > 0'.\ + format(s, nonce) + ) self.val = s def __str__(self): diff --git a/src/test/common/get_command_descriptions.cc b/src/test/common/get_command_descriptions.cc index afca8254c42..aff5575b8c4 100644 --- a/src/test/common/get_command_descriptions.cc +++ b/src/test/common/get_command_descriptions.cc @@ -50,7 +50,7 @@ static void json_print(const MonCommand *mon_commands, int size) Formatter *f = new_formatter("json"); get_command_descriptions(mon_commands, size, f, &rdata); delete f; - string data(rdata.c_str()); + string data(rdata.c_str(), rdata.length()); dout(0) << data << dendl; } diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py index fe7c9bacccc..34bcf698e5a 100755 --- a/src/test/pybind/test_ceph_argparse.py +++ b/src/test/pybind/test_ceph_argparse.py @@ -834,20 +834,24 @@ class TestOSD(TestArgparse): def test_blackist(self): for action in ('add', 'rm'): self.assert_valid_command(['osd', 'blacklist', action, - '1.2.3.4/nonce']) + '1.2.3.4/567']) self.assert_valid_command(['osd', 'blacklist', action, - '1.2.3.4/nonce', '600.40']) + '1.2.3.4']) + self.assert_valid_command(['osd', 'blacklist', action, + '1.2.3.4/567', '600.40']) + self.assert_valid_command(['osd', 'blacklist', action, + '1.2.3.4', '600.40']) assert_equal({}, validate_command(sigdict, ['osd', 'blacklist', action, 'invalid', '600.40'])) assert_equal({}, validate_command(sigdict, ['osd', 'blacklist', action, - '1.2.3.4/nonce', + '1.2.3.4/567', '-1.0'])) assert_equal({}, validate_command(sigdict, ['osd', 'blacklist', action, - '1.2.3.4/nonce', + '1.2.3.4/567', '600.40', 'toomany'])) |