diff options
author | Sage Weil <sage@inktank.com> | 2012-12-20 11:07:10 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-12-20 11:07:10 -0800 |
commit | 9f67c450fec3a253b094c8fca3c5a166530366af (patch) | |
tree | b0341744d5d70627dec7bf9b1efc80c418392674 | |
parent | 5497d228116a717da43ce29984ec20d1289780ae (diff) | |
parent | 17c627b5e4b763f08af05f28597acc4a7b28ae78 (diff) | |
download | ceph-9f67c450fec3a253b094c8fca3c5a166530366af.tar.gz |
Merge branch 'next'
-rw-r--r-- | ceph.spec.in | 50 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rwxr-xr-x | debian/rules | 52 | ||||
-rwxr-xr-x | qa/workunits/cephtool/test.sh | 24 | ||||
-rw-r--r-- | src/common/config_opts.h | 2 | ||||
-rw-r--r-- | src/crushtool.cc | 71 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 63 | ||||
-rw-r--r-- | src/mon/OSDMonitor.h | 1 | ||||
-rw-r--r-- | src/osd/OSD.cc | 8 | ||||
-rw-r--r-- | src/osd/OSDMap.cc | 44 | ||||
-rw-r--r-- | src/osd/OSDMap.h | 2 | ||||
-rw-r--r-- | src/osdc/Objecter.cc | 35 | ||||
-rw-r--r-- | src/osdc/Objecter.h | 6 | ||||
-rw-r--r-- | src/rgw/rgw_rest_swift.cc | 5 | ||||
-rw-r--r-- | src/rgw/rgw_swift.cc | 16 | ||||
-rw-r--r-- | src/rgw/rgw_swift.h | 7 | ||||
-rw-r--r-- | src/test/cli/crushtool/help.t | 38 | ||||
-rw-r--r-- | src/tools/common.cc | 20 |
20 files changed, 344 insertions, 110 deletions
diff --git a/ceph.spec.in b/ceph.spec.in index ba1cce459bc..7aae6fefedb 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -74,6 +74,9 @@ performance, reliability, and scalability. Summary: Ceph fuse-based client Group: System Environment/Base Requires: %{name} +Requires: fuse-libs +Requires: libstdc++ +Requires: libuuid BuildRequires: fuse-devel %description fuse FUSE based client for Ceph distributed network file system @@ -186,8 +189,26 @@ Requires: libcephfs1 = %{version}-%{release} %description -n ceph-test This package contains Ceph benchmarks and test tools. -# Enable building of debug package on distributions that don't automatically -# build it. +%package -n libcephfs-jni +Summary: Java Native Interface library for CephFS Java bindings. +Group: System Environment/Libraries +License: LGPL-2.0 +Requires: java +Requires: libcephfs1 = %{version}-%{release} +BuildRequires: java-devel +%description -n libcephfs-jni +This package contains the Java Native Interface library for CephFS Java +bindings. + +%package -n libcephfs-java +Summary: Java libraries for the Ceph File System. +Group: System Environment/Libraries +License: LGPL-2.0 +Requires: java +Requires: libcephfs-jni = %{version}-%{release}- +BuildRequires: java-devel +%description -n libcephfs-java +This package contains the Java libraries for the Ceph File System. %if (0%{?centos} || 0%{?opensuse} || 0%{?suse_version}) %debug_package @@ -200,6 +221,11 @@ This package contains Ceph benchmarks and test tools. %setup -q %build +# Find jni.h +for i in /usr/{lib64,lib}/jvm/java/include{,/linux}; do + [ -d $i ] && java_inc="$java_inc -I$i" +done + ./autogen.sh MY_CONF_OPT="" @@ -209,7 +235,8 @@ export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e 's/i386/i486/'` # be explicit about --with/without-tcmalloc because the # autoconf default differs from what's needed for rpm -%{configure} --prefix=/usr \ +%{configure} CPPFLAGS="$java_inc" \ + --prefix=/usr \ --sbindir=/sbin \ --localstatedir=/var \ --sysconfdir=/etc \ @@ -219,6 +246,7 @@ export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e 's/i386/i486/'` --without-cryptopp \ --with-rest-bench \ --with-debug \ + --enable-cephfs-java \ $MY_CONF_OPT \ %{?_with_ocf} \ %{?with_tcmalloc:--with-tcmalloc} %{!?with_tcmalloc:--without-tcmalloc} \ @@ -250,6 +278,13 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/ceph/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/ceph/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ceph/ +# Relocate java packages to expected locations in buildroot. +mkdir -p $RPM_BUILD_ROOT/usr/lib/jni +mv $RPM_BUILD_ROOT/usr/lib64/libcephfs_jni.so* $RPM_BUILD_ROOT/usr/lib/jni/. +mkdir -p $RPM_BUILD_ROOT/usr/share/java +mv $RPM_BUILD_ROOT/usr/lib64/libcephfs.jar $RPM_BUILD_ROOT/usr/share/java/. +mv $RPM_BUILD_ROOT/usr/lib64/libcephfs-test.jar $RPM_BUILD_ROOT/usr/share/java/. + %clean rm -rf $RPM_BUILD_ROOT @@ -520,4 +555,13 @@ fi %{_bindir}/tpbench %{_bindir}/xattr_bench +%files -n libcephfs-jni +%defattr(-,root,root,-) +/usr/lib/jni/libcephfs_jni.so* + +%files -n libcephfs-java +%defattr(-,root,root,-) +/usr/share/java/libcephfs.jar +/usr/share/java/libcephfs-test.jar + %changelog diff --git a/configure.ac b/configure.ac index ebaec0f57ba..140867fc325 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_PREREQ(2.59) # VERSION define is not used by the code. It gets a version string # from 'git describe'; see src/ceph_ver.[ch] -AC_INIT([ceph], [0.55], [ceph-devel@vger.kernel.org]) +AC_INIT([ceph], [0.55.1], [ceph-devel@vger.kernel.org]) # Create release string. Used with VERSION for RPMs. AC_SUBST(RPM_RELEASE) diff --git a/debian/changelog b/debian/changelog index c5a2297cb23..23d5ff0ff15 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ceph (0.55.1-1) precise; urgency=low + + * New upstream release + + -- Gary Lowell <gary.lowell@inktank.com> Wed, 12 Dec 2012 16:24:13 -0800 + ceph (0.55-1) precise; urgency=low * New upstream release diff --git a/debian/control b/debian/control index 2f0c311225f..2ad36d94acb 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Vcs-Git: git://github.com/ceph/ceph.git Vcs-Browser: https://github.com/ceph/ceph Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.hu> Uploaders: Sage Weil <sage@newdream.net> -Build-Depends: debhelper (>= 6.0.7~), autotools-dev, autoconf, automake, libfuse-dev, libboost-dev (>= 1.34), libboost-thread-dev, libedit-dev, libnss3-dev, libtool, libexpat1-dev, libfcgi-dev, libatomic-ops-dev, libgoogle-perftools-dev [i386 amd64], pkg-config, libcurl4-gnutls-dev, libkeyutils-dev, uuid-dev, libaio-dev, python (>= 2.6.6-3~), libxml2-dev, javahelper, default-jdk +Build-Depends: debhelper (>= 6.0.7~), autotools-dev, autoconf, automake, libfuse-dev, libboost-dev (>= 1.34), libboost-thread-dev, libedit-dev, libnss3-dev, libtool, libexpat1-dev, libfcgi-dev, libatomic-ops-dev, libgoogle-perftools-dev [i386 amd64], pkg-config, libcurl4-gnutls-dev, libkeyutils-dev, uuid-dev, libaio-dev, python (>= 2.6.6-3~), libxml2-dev, javahelper, default-jdk, junit4, libboost-program-options-dev Standards-Version: 3.9.3 Package: ceph diff --git a/debian/rules b/debian/rules index 32380a41850..8f0b4ef2762 100755 --- a/debian/rules +++ b/debian/rules @@ -94,28 +94,44 @@ install: build # Add here commands to install the package into debian/testpack. # Build architecture-independent files here. binary-indep: build install + dh_testdir + dh_testroot jh_installlibs -v -i + dh_installchangelogs -i + dh_installdocs -i --all ChangeLog + dh_installexamples -i + dh_install -i --sourcedir=$(DESTDIR) --list-missing + dh_installman -i + dh_lintian -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_python2 -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot - dh_installchangelogs - dh_installdocs --all ChangeLog - dh_installexamples - dh_install --sourcedir=$(DESTDIR) --list-missing - dh_installlogrotate - dh_installinit --no-start + dh_installchangelogs -a + dh_installdocs -a --all ChangeLog + dh_installexamples -a + dh_install -a --sourcedir=$(DESTDIR) --list-missing + dh_installlogrotate -a + dh_installinit -a --no-start # dh_installinit is only set up to handle one upstart script # per package, so do this ourselves install -d -m0755 debian/ceph/etc/init install -m0644 src/upstart/ceph*.conf debian/ceph/etc/init install -d -m0755 debian/radosgw/etc/init install -m0644 src/upstart/radosgw*.conf debian/radosgw/etc/init - dh_installman - dh_lintian - dh_link + dh_installman -a + dh_lintian -a + dh_link -a dh_strip -pceph --dbg-package=ceph-dbg -k --exclude=libcls_ dh_strip -pceph-mds --dbg-package=ceph-mds-dbg @@ -129,15 +145,15 @@ binary-arch: build install dh_strip -prest-bench --dbg-package=rest-bench-dbg dh_strip -pceph-test --dbg-package=ceph-test-dbg - dh_compress - dh_fixperms - dh_makeshlibs -X/usr/lib/rados-classes # exclude .so files in ceph package - dh_python2 - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a -X/usr/lib/rados-classes # exclude .so files in ceph package + dh_python2 -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh new file mode 100755 index 00000000000..22ca2008651 --- /dev/null +++ b/qa/workunits/cephtool/test.sh @@ -0,0 +1,24 @@ +#!/bin/sh -x + +set -e + +ceph status +ceph -s +ceph quorum_status + +ceph osd dump +ceph osd tree +ceph pg dump +ceph mon dump +ceph mds dump + +ceph tell osd.0 version +ceph tell osd.9999 version && exit 1 +ceph tell osd.foo version && exit 1 + +for id in `ceph osd ls` ; do + ceph tell osd.$id version +done + +echo OK + diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 6c859c3f812..a25c231a097 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -163,6 +163,7 @@ OPTION(auth_service_ticket_ttl, OPT_DOUBLE, 60*60) OPTION(mon_client_hunt_interval, OPT_DOUBLE, 3.0) // try new mon every N seconds until we connect OPTION(mon_client_ping_interval, OPT_DOUBLE, 10.0) // ping every N seconds OPTION(mon_client_max_log_entries_per_message, OPT_INT, 1000) +OPTION(mon_max_pool_pg_num, OPT_INT, 65536) OPTION(client_cache_size, OPT_INT, 16384) OPTION(client_cache_mid, OPT_FLOAT, .75) OPTION(client_use_random_mds, OPT_BOOL, false) @@ -447,7 +448,6 @@ OPTION(rgw_swift_url, OPT_STR, "") // the swift url, being published OPTION(rgw_swift_url_prefix, OPT_STR, "swift") // entry point for which a url is considered a swift url OPTION(rgw_swift_auth_url, OPT_STR, "") // default URL to go and verify tokens for v1 auth (if not using internal swift auth) OPTION(rgw_swift_auth_entry, OPT_STR, "auth") // entry point for which a url is considered a swift auth url -OPTION(rgw_swift_use_keystone, OPT_BOOL, false) // should swift use keystone? OPTION(rgw_keystone_url, OPT_STR, "") // url for keystone server OPTION(rgw_keystone_admin_token, OPT_STR, "") // keystone admin token (shared secret) OPTION(rgw_keystone_accepted_roles, OPT_STR, "Member, admin") // roles required to serve requests diff --git a/src/crushtool.cc b/src/crushtool.cc index 0f54852f049..6584be54d5a 100644 --- a/src/crushtool.cc +++ b/src/crushtool.cc @@ -80,7 +80,6 @@ cout << " proportional_weights\n"; cout << " the proportional weight of each 'up' OSD specified in the CRUSH map\n"; cout << " data_layout: ROW MAJOR\n"; cout << " OSD id (int), proportional weight (float)\n"; -exit(1); } void usage() @@ -128,6 +127,8 @@ void usage() cout << " permutation before re-descent\n"; cout << " --set-choose-total-tries N\n"; cout << " set choose total descent attempts\n"; + cout << " --set-chooseleaf-descend-once <0|1>\n"; + cout << " set chooseleaf to (not) retry the recursive descent\n"; cout << " --output-name name\n"; cout << " prepend the data file(s) generated during the\n"; cout << " testing routine with name\n"; @@ -135,7 +136,6 @@ void usage() cout << " export select data generated during testing routine\n"; cout << " to CSV files for off-line post-processing\n"; cout << " use --help-output for more information\n"; - exit(1); } struct bucket_types_t { @@ -206,6 +206,9 @@ int main(int argc, const char **argv) for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) { if (ceph_argparse_double_dash(args, i)) { break; + } else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) { + usage(); + exit(0); } else if (ceph_argparse_witharg(args, i, &val, "-d", "--decompile", (char*)NULL)) { infn = val; decompile = true; @@ -258,12 +261,16 @@ int main(int argc, const char **argv) cerr << err.str() << std::endl; exit(EXIT_FAILURE); } - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --add-item" << std::endl; + exit(EXIT_FAILURE); + } add_weight = atof(*i); i = args.erase(i); - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --add-item" << std::endl; + exit(EXIT_FAILURE); + } add_name.assign(*i); i = args.erase(i); } else if (ceph_argparse_withint(args, i, &add_item, &err, "--update_item", (char*)NULL)) { @@ -272,18 +279,24 @@ int main(int argc, const char **argv) cerr << err.str() << std::endl; exit(EXIT_FAILURE); } - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --update-item" << std::endl; + exit(EXIT_FAILURE); + } add_weight = atof(*i); i = args.erase(i); - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --update-item" << std::endl; + exit(EXIT_FAILURE); + } add_name.assign(*i); i = args.erase(i); } else if (ceph_argparse_witharg(args, i, &val, "--loc", (char*)NULL)) { std::string type(val); - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --loc" << std::endl; + exit(EXIT_FAILURE); + } std::string name(*i); i = args.erase(i); add_loc[type] = name; @@ -293,10 +306,12 @@ int main(int argc, const char **argv) tester.set_output_csv(true); } else if (ceph_argparse_flag(args, i, "--help-output", (char*)NULL)) { data_analysis_usage(); + exit(0); } else if (ceph_argparse_witharg(args, i, &val, "--output-name", (char*)NULL)) { std::string name(val); if (i == args.end()) { - usage(); + cerr << "expecting additional argument to --output-name" << std::endl; + exit(EXIT_FAILURE); } else { tester.set_output_data_file_name(name + "-"); @@ -305,8 +320,10 @@ int main(int argc, const char **argv) remove_name = val; } else if (ceph_argparse_witharg(args, i, &val, "--reweight_item", (char*)NULL)) { reweight_name = val; - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --reweight-item" << std::endl; + exit(EXIT_FAILURE); + } reweight_weight = atof(*i); i = args.erase(i); } else if (ceph_argparse_flag(args, i, "--build", (char*)NULL)) { @@ -382,8 +399,10 @@ int main(int argc, const char **argv) exit(EXIT_FAILURE); } int dev = tmp; - if (i == args.end()) - usage(); + if (i == args.end()) { + cerr << "expecting additional argument to --weight" << std::endl; + exit(EXIT_FAILURE); + } float f = atof(*i); i = args.erase(i); tester.set_device_weight(dev, f); @@ -394,27 +413,29 @@ int main(int argc, const char **argv) } if (test && !display && !write_to_file) { - cerr << "WARNING: no output selected!" << std::endl; - usage(); + cerr << "WARNING: no output selected (via -o <filename>)" << std::endl; + exit(EXIT_FAILURE); } if (decompile + compile + build > 1) { - usage(); + cout << "cannot specify more than one of compile, decompile, and build" << std::endl; + exit(EXIT_FAILURE); } if (!compile && !decompile && !build && !test && !reweight && !adjust && add_item < 0 && remove_name.empty() && reweight_name.empty()) { - usage(); + cout << "no action specified; -h for help" << std::endl; + exit(EXIT_FAILURE); } if ((!build) && (args.size() > 0)) { - cerr << "too many arguments!" << std::endl; - usage(); + cerr << "unrecognized arguments: " << args << std::endl; + exit(EXIT_FAILURE); } else { if ((args.size() % 3) != 0U) { cerr << "layers must be specified with 3-tuples of (name, buckettype, size)" << std::endl; - usage(); + exit(EXIT_FAILURE); } for (size_t j = 0; j < args.size(); j += 3) { layer_t l; @@ -519,7 +540,7 @@ int main(int argc, const char **argv) } if (buckettype < 0) { cerr << "unknown bucket type '" << l.buckettype << "'" << std::endl << std::endl; - usage(); + exit(EXIT_FAILURE); } // build items diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e893655dab6..7b49eee72c6 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -302,6 +302,27 @@ void OSDMonitor::remove_redundant_pg_temp() } } +void OSDMonitor::remove_down_pg_temp() +{ + dout(10) << "remove_down_pg_temp" << dendl; + OSDMap tmpmap(osdmap); + tmpmap.apply_incremental(pending_inc); + + for (map<pg_t,vector<int> >::iterator p = tmpmap.pg_temp->begin(); + p != tmpmap.pg_temp->end(); + p++) { + unsigned num_up = 0; + for (vector<int>::iterator i = p->second.begin(); + i != p->second.end(); + ++i) { + if (!tmpmap.is_down(*i)) + ++num_up; + } + if (num_up == 0) + pending_inc.new_pg_temp[p->first].clear(); + } +} + /* Assign a lower weight to overloaded OSDs. * * The osds that will get a lower weight are those with with a utilization @@ -391,6 +412,9 @@ void OSDMonitor::create_pending() // drop any redundant pg_temp entries remove_redundant_pg_temp(); + + // drop any pg_temp entries with no up entries + remove_down_pg_temp(); } @@ -1678,6 +1702,7 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) } else if (m->cmd[1] == "dump" || m->cmd[1] == "tree" || + m->cmd[1] == "ls" || m->cmd[1] == "getmap" || m->cmd[1] == "getcrushmap") { string format = "plain"; @@ -1729,6 +1754,37 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) rdata.append(ds); ss << "dumped osdmap epoch " << p->get_epoch(); } + } else if (cmd == "ls") { + stringstream ds; + if (format == "json") { + JSONFormatter jf(true); + jf.open_array_section("osds"); + for (int i = 0; i < osdmap.get_max_osd(); i++) { + if (osdmap.exists(i)) { + jf.dump_int("osd", i); + } + } + jf.close_section(); + jf.flush(ds); + r = 0; + } else if (format == "plain") { + bool first = true; + for (int i = 0; i < osdmap.get_max_osd(); i++) { + if (osdmap.exists(i)) { + if (!first) + ds << "\n"; + first = false; + ds << i; + } + } + r = 0; + } else { + ss << "unrecognized format '" << format << "'"; + r = -EINVAL; + } + if (r == 0) { + rdata.append(ds); + } } else if (cmd == "tree") { stringstream ds; if (format == "json") { @@ -2624,10 +2680,11 @@ bool OSDMonitor::prepare_command(MMonCommand *m) int pg_num = 0; int pgp_num = 0; - /* Don't allow over 65535 pgs in a single pool */ pg_num = parse_pos_long(m->cmd[4].c_str(), &ss); - if ((pg_num == 0) || (pg_num > 65535)) { - ss << "'pg_num' must be greater than 0 and lower or equal than 65535"; + if ((pg_num == 0) || (pg_num > g_conf->mon_max_pool_pg_num)) { + ss << "'pg_num' must be greater than 0 and less than or equal to " + << g_conf->mon_max_pool_pg_num + << " (you may adjust 'mon max pool pg num' for higher values)"; err = -ERANGE; goto out; } diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 4faa90e2902..9529f731c84 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -165,6 +165,7 @@ private: void send_incremental(epoch_t first, entity_inst_t& dest, bool onetime); void remove_redundant_pg_temp(); + void remove_down_pg_temp(); int reweight_by_utilization(int oload, std::string& out_str); bool preprocess_failure(class MOSDFailure *m); diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 5317cadf393..981e036b959 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -34,6 +34,7 @@ #include "Watch.h" #include "common/ceph_argparse.h" +#include "common/version.h" #include "os/FileStore.h" #include "os/FileJournal.h" @@ -2872,7 +2873,12 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist dout(20) << "do_command tid " << tid << " " << cmd << dendl; - if (cmd[0] == "injectargs") { + if (cmd[0] == "version") { + ss << pretty_version_to_str(); + r = 0; + goto out; + } + else if (cmd[0] == "injectargs") { if (cmd.size() < 2) { r = -EINVAL; ss << "ignoring empty injectargs"; diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index d18bef2d673..03ecad78dcc 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -704,7 +704,7 @@ void OSDMap::dedup(const OSDMap *o, OSDMap *n) n->osd_uuid = o->osd_uuid; } -int OSDMap::apply_incremental(Incremental &inc) +int OSDMap::apply_incremental(const Incremental &inc) { if (inc.epoch == 1) fsid = inc.fsid; @@ -717,7 +717,8 @@ int OSDMap::apply_incremental(Incremental &inc) // full map? if (inc.fullmap.length()) { - decode(inc.fullmap); + bufferlist bl(inc.fullmap); + decode(bl); return 0; } @@ -731,20 +732,20 @@ int OSDMap::apply_incremental(Incremental &inc) if (inc.new_pool_max != -1) pool_max = inc.new_pool_max; - for (set<int64_t>::iterator p = inc.old_pools.begin(); + for (set<int64_t>::const_iterator p = inc.old_pools.begin(); p != inc.old_pools.end(); p++) { pools.erase(*p); name_pool.erase(pool_name[*p]); pool_name.erase(*p); } - for (map<int64_t,pg_pool_t>::iterator p = inc.new_pools.begin(); + for (map<int64_t,pg_pool_t>::const_iterator p = inc.new_pools.begin(); p != inc.new_pools.end(); p++) { pools[p->first] = p->second; pools[p->first].last_change = epoch; } - for (map<int64_t,string>::iterator p = inc.new_pool_names.begin(); + for (map<int64_t,string>::const_iterator p = inc.new_pool_names.begin(); p != inc.new_pool_names.end(); p++) { if (pool_name.count(p->first)) @@ -753,7 +754,7 @@ int OSDMap::apply_incremental(Incremental &inc) name_pool[p->second] = p->first; } - for (map<int32_t,uint32_t>::iterator i = inc.new_weight.begin(); + for (map<int32_t,uint32_t>::const_iterator i = inc.new_weight.begin(); i != inc.new_weight.end(); i++) { set_weight(i->first, i->second); @@ -764,7 +765,7 @@ int OSDMap::apply_incremental(Incremental &inc) } // up/down - for (map<int32_t,uint8_t>::iterator i = inc.new_state.begin(); + for (map<int32_t,uint8_t>::const_iterator i = inc.new_state.begin(); i != inc.new_state.end(); i++) { int s = i->second ? i->second : CEPH_OSD_UP; @@ -778,7 +779,7 @@ int OSDMap::apply_incremental(Incremental &inc) (*osd_uuid)[i->first] = uuid_d(); osd_state[i->first] ^= s; } - for (map<int32_t,entity_addr_t>::iterator i = inc.new_up_client.begin(); + for (map<int32_t,entity_addr_t>::const_iterator i = inc.new_up_client.begin(); i != inc.new_up_client.end(); i++) { osd_state[i->first] |= CEPH_OSD_EXISTS | CEPH_OSD_UP; @@ -786,38 +787,39 @@ int OSDMap::apply_incremental(Incremental &inc) if (inc.new_hb_up.empty()) osd_addrs->hb_addr[i->first].reset(new entity_addr_t(i->second)); //this is a backward-compatibility hack else - osd_addrs->hb_addr[i->first].reset(new entity_addr_t(inc.new_hb_up[i->first])); + osd_addrs->hb_addr[i->first].reset( + new entity_addr_t(inc.new_hb_up.find(i->first)->second)); osd_info[i->first].up_from = epoch; } - for (map<int32_t,entity_addr_t>::iterator i = inc.new_up_internal.begin(); + for (map<int32_t,entity_addr_t>::const_iterator i = inc.new_up_internal.begin(); i != inc.new_up_internal.end(); i++) osd_addrs->cluster_addr[i->first].reset(new entity_addr_t(i->second)); // info - for (map<int32_t,epoch_t>::iterator i = inc.new_up_thru.begin(); + for (map<int32_t,epoch_t>::const_iterator i = inc.new_up_thru.begin(); i != inc.new_up_thru.end(); i++) osd_info[i->first].up_thru = i->second; - for (map<int32_t,pair<epoch_t,epoch_t> >::iterator i = inc.new_last_clean_interval.begin(); + for (map<int32_t,pair<epoch_t,epoch_t> >::const_iterator i = inc.new_last_clean_interval.begin(); i != inc.new_last_clean_interval.end(); i++) { osd_info[i->first].last_clean_begin = i->second.first; osd_info[i->first].last_clean_end = i->second.second; } - for (map<int32_t,epoch_t>::iterator p = inc.new_lost.begin(); p != inc.new_lost.end(); p++) + for (map<int32_t,epoch_t>::const_iterator p = inc.new_lost.begin(); p != inc.new_lost.end(); p++) osd_info[p->first].lost_at = p->second; // xinfo - for (map<int32_t,osd_xinfo_t>::iterator p = inc.new_xinfo.begin(); p != inc.new_xinfo.end(); ++p) + for (map<int32_t,osd_xinfo_t>::const_iterator p = inc.new_xinfo.begin(); p != inc.new_xinfo.end(); ++p) osd_xinfo[p->first] = p->second; // uuid - for (map<int32_t,uuid_d>::iterator p = inc.new_uuid.begin(); p != inc.new_uuid.end(); ++p) + for (map<int32_t,uuid_d>::const_iterator p = inc.new_uuid.begin(); p != inc.new_uuid.end(); ++p) (*osd_uuid)[p->first] = p->second; // pg rebuild - for (map<pg_t, vector<int> >::iterator p = inc.new_pg_temp.begin(); p != inc.new_pg_temp.end(); p++) { + for (map<pg_t, vector<int> >::const_iterator p = inc.new_pg_temp.begin(); p != inc.new_pg_temp.end(); p++) { if (p->second.empty()) pg_temp->erase(p->first); else @@ -825,11 +827,11 @@ int OSDMap::apply_incremental(Incremental &inc) } // blacklist - for (map<entity_addr_t,utime_t>::iterator p = inc.new_blacklist.begin(); + for (map<entity_addr_t,utime_t>::const_iterator p = inc.new_blacklist.begin(); p != inc.new_blacklist.end(); p++) blacklist[p->first] = p->second; - for (vector<entity_addr_t>::iterator p = inc.old_blacklist.begin(); + for (vector<entity_addr_t>::const_iterator p = inc.old_blacklist.begin(); p != inc.old_blacklist.end(); p++) blacklist.erase(*p); @@ -845,7 +847,8 @@ int OSDMap::apply_incremental(Incremental &inc) // do new crush map last (after up/down stuff) if (inc.crush.length()) { - bufferlist::iterator blp = inc.crush.begin(); + bufferlist bl(inc.crush); + bufferlist::iterator blp = bl.begin(); crush.reset(new CrushWrapper); crush->decode(blp); } @@ -1298,10 +1301,13 @@ void OSDMap::dump(Formatter *f) const for (map<pg_t,vector<int> >::const_iterator p = pg_temp->begin(); p != pg_temp->end(); p++) { + f->open_object_section("osds"); + f->dump_stream("pgid") << p->first; f->open_array_section("osds"); for (vector<int>::const_iterator q = p->second.begin(); q != p->second.end(); ++q) f->dump_int("osd", *q); f->close_section(); + f->close_section(); } f->close_section(); diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 632b2c2527b..4d4bbd0b031 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -388,7 +388,7 @@ private: return -1; } - int apply_incremental(Incremental &inc); + int apply_incremental(const Incremental &inc); /// try to re-use/reference addrs in oldmap from newmap static void dedup(const OSDMap *oldmap, OSDMap *newmap); diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 9d7fe67cf9d..6abada8f5d8 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -267,7 +267,7 @@ void Objecter::send_linger(LingerOp *info) o->snapid = info->snap; // do not resend this; we will send a new op to reregister - o->should_resend = !info->is_watch; + o->should_resend = false; if (info->session) { int r = recalc_op_target(o); @@ -278,7 +278,7 @@ void Objecter::send_linger(LingerOp *info) if (info->register_tid) { // repeat send. cancel old registeration op, if any. - if (info->is_watch && ops.count(info->register_tid)) { + if (ops.count(info->register_tid)) { Op *o = ops[info->register_tid]; cancel_op(o); } @@ -335,11 +335,6 @@ void Objecter::unregister_linger(uint64_t linger_id) } } -/** - * Note that this is meant to handle a watch OR a notify, but not both in the same ObjectOperation. - * This is because watches need to be resent with a new tid on map changes, while notifies - * need to resend using the old tid. - */ tid_t Objecter::linger(const object_t& oid, const object_locator_t& oloc, ObjectOperation& op, snapid_t snap, bufferlist& inbl, bufferlist *poutbl, int flags, @@ -354,18 +349,6 @@ tid_t Objecter::linger(const object_t& oid, const object_locator_t& oloc, info->snap = snap; info->flags = flags; info->ops = op.ops; - bool saw_notify = false; - for (vector<OSDOp>::const_iterator it = info->ops.begin(); - it != info->ops.end(); ++it) { - if (it->op.op == CEPH_OSD_OP_WATCH) - info->is_watch = true; - if (it->op.op == CEPH_OSD_OP_NOTIFY) - saw_notify = true; - if (info->is_watch) - assert(it->op.op != CEPH_OSD_OP_NOTIFY); - if (saw_notify) - assert(it->op.op != CEPH_OSD_OP_WATCH); - } info->inbl = inbl; info->poutbl = poutbl; info->pobjver = objver; @@ -439,10 +422,10 @@ void Objecter::scan_requests(bool skipped_map, } // check for changed request mappings - for (hash_map<tid_t,Op*>::iterator p = ops.begin(); - p != ops.end(); - ++p) { + map<tid_t,Op*>::iterator p = ops.begin(); + while (p != ops.end()) { Op *op = p->second; + ++p; // check_op_pool_dne() may touch ops; prevent iterator invalidation ldout(cct, 10) << " checking op " << op->tid << dendl; int r = recalc_op_target(op); switch (r) { @@ -568,7 +551,7 @@ void Objecter::handle_osd_map(MOSDMap *m) // unpause requests? if ((was_pauserd && !pauserd) || (was_pausewr && !pausewr)) - for (hash_map<tid_t,Op*>::iterator p = ops.begin(); + for (map<tid_t,Op*>::iterator p = ops.begin(); p != ops.end(); p++) { Op *op = p->second; @@ -900,7 +883,7 @@ void Objecter::tick() cutoff -= cct->_conf->objecter_timeout; // timeout unsigned laggy_ops = 0; - for (hash_map<tid_t,Op*>::iterator p = ops.begin(); + for (map<tid_t,Op*>::iterator p = ops.begin(); p != ops.end(); p++) { Op *op = p->second; @@ -2010,7 +1993,7 @@ void Objecter::ms_handle_remote_reset(Connection *con) void Objecter::dump_active() { ldout(cct, 20) << "dump_active .. " << num_homeless_ops << " homeless" << dendl; - for (hash_map<tid_t,Op*>::iterator p = ops.begin(); p != ops.end(); p++) { + for (map<tid_t,Op*>::iterator p = ops.begin(); p != ops.end(); p++) { Op *op = p->second; ldout(cct, 20) << op->tid << "\t" << op->pgid << "\tosd." << (op->session ? op->session->osd : -1) << "\t" << op->oid << "\t" << op->ops << dendl; @@ -2033,7 +2016,7 @@ void Objecter::dump_requests(Formatter& fmt) const void Objecter::dump_ops(Formatter& fmt) const { fmt.open_array_section("ops"); - for (hash_map<tid_t,Op*>::const_iterator p = ops.begin(); + for (map<tid_t,Op*>::const_iterator p = ops.begin(); p != ops.end(); ++p) { Op *op = p->second; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index e23f32a8d0f..baf600c53be 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -28,7 +28,6 @@ #include <list> #include <map> #include <memory> -#include <ext/hash_map> using namespace std; using namespace __gnu_cxx; @@ -816,14 +815,13 @@ public: tid_t register_tid; epoch_t map_dne_bound; - bool is_watch; LingerOp() : linger_id(0), flags(0), poutbl(NULL), pobjver(NULL), registered(false), on_reg_ack(NULL), on_reg_commit(NULL), session(NULL), session_item(this), register_tid(0), - map_dne_bound(0), is_watch(false) {} + map_dne_bound(0) {} // no copy! const LingerOp &operator=(const LingerOp& r); @@ -884,7 +882,7 @@ public: private: // pending ops - hash_map<tid_t,Op*> ops; + map<tid_t,Op*> ops; int num_homeless_ops; map<uint64_t, LingerOp*> linger_ops; map<tid_t,PoolStatOp*> poolstat_ops; diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 3a7007b6df8..64614b5f59b 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -304,7 +304,10 @@ int RGWPutObj_ObjStore_SWIFT::get_params() suffix++; if (*suffix) { string suffix_str(suffix); - s->generic_attrs[RGW_ATTR_CONTENT_TYPE] = rgw_find_mime_by_ext(suffix_str); + const char *mime = rgw_find_mime_by_ext(suffix_str); + if (mime) { + s->generic_attrs[RGW_ATTR_CONTENT_TYPE] = mime; + } } } } diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc index 2ce04074a03..9bb7cecad82 100644 --- a/src/rgw/rgw_swift.cc +++ b/src/rgw/rgw_swift.cc @@ -644,14 +644,14 @@ bool RGWSwift::verify_swift_token(RGWRados *store, req_state *s) int ret; - if (g_conf->rgw_swift_use_keystone) { + if (supports_keystone()) { ret = validate_keystone_token(store, s->os_auth_token, &info, s->user); return (ret >= 0); } ret = validate_token(s->os_auth_token, &info); if (ret < 0) - return ret; + return false; if (info.user.empty()) { ldout(cct, 5) << "swift auth didn't authorize a user" << dendl; @@ -678,7 +678,13 @@ bool RGWSwift::verify_swift_token(RGWRados *store, req_state *s) void RGWSwift::init() { get_str_list(cct->_conf->rgw_keystone_accepted_roles, roles_list); + if (supports_keystone()) + init_keystone(); +} + +void RGWSwift::init_keystone() +{ keystone_token_cache = new RGWKeystoneTokenCache(cct, cct->_conf->rgw_keystone_token_cache_size); keystone_revoke_thread = new KeystoneRevokeThread(cct, this); @@ -688,6 +694,12 @@ void RGWSwift::init() void RGWSwift::finalize() { + if (supports_keystone()) + finalize_keystone(); +} + +void RGWSwift::finalize_keystone() +{ delete keystone_token_cache; keystone_token_cache = NULL; diff --git a/src/rgw/rgw_swift.h b/src/rgw/rgw_swift.h index 6c5024e1a54..febc2675c27 100644 --- a/src/rgw/rgw_swift.h +++ b/src/rgw/rgw_swift.h @@ -64,11 +64,16 @@ class RGWSwift { void init(); void finalize(); + void init_keystone(); + void finalize_keystone(); + bool supports_keystone() { + return !cct->_conf->rgw_keystone_url.empty(); + } protected: int check_revoked(); public: - RGWSwift(CephContext *_cct) : cct(_cct) { + RGWSwift(CephContext *_cct) : cct(_cct), keystone_revoke_thread(NULL) { init(); } ~RGWSwift() { diff --git a/src/test/cli/crushtool/help.t b/src/test/cli/crushtool/help.t index 8f2f52c100a..18617a3d8a9 100644 --- a/src/test/cli/crushtool/help.t +++ b/src/test/cli/crushtool/help.t @@ -42,6 +42,8 @@ permutation before re-descent --set-choose-total-tries N set choose total descent attempts + --set-chooseleaf-descend-once <0|1> + set chooseleaf to (not) retry the recursive descent --output-name name prepend the data file(s) generated during the testing routine with name @@ -49,4 +51,38 @@ export select data generated during testing routine to CSV files for off-line post-processing use --help-output for more information - [1] + $ crushtool --help-output + data output from testing routine ... + absolute_weights + the decimal weight of each OSD + data layout: ROW MAJOR + OSD id (int), weight (int) + batch_device_expected_utilization_all + the expected number of objects each OSD should receive per placement batch + which may be a decimal value + data layout: COLUMN MAJOR + round (int), objects expected on OSD 0...OSD n (float) + batch_device_utilization_all + the number of objects stored on each OSD during each placement round + data layout: COLUMN MAJOR + round (int), objects stored on OSD 0...OSD n (int) + device_utilization_all + the number of objects stored on each OSD at the end of placements + data_layout: ROW MAJOR + OSD id (int), objects stored (int), objects expected (float) + device_utilization + the number of objects stored on each OSD marked 'up' at the end of placements + data_layout: ROW MAJOR + OSD id (int), objects stored (int), objects expected (float) + placement_information + the map of input -> OSD + data_layout: ROW MAJOR + input (int), OSD's mapped (int) + proportional_weights_all + the proportional weight of each OSD specified in the CRUSH map + data_layout: ROW MAJOR + OSD id (int), proportional weight (float) + proportional_weights + the proportional weight of each 'up' OSD specified in the CRUSH map + data_layout: ROW MAJOR + OSD id (int), proportional weight (float) diff --git a/src/tools/common.cc b/src/tools/common.cc index 9a454f7e7d8..9a3763a34ae 100644 --- a/src/tools/common.cc +++ b/src/tools/common.cc @@ -140,12 +140,14 @@ static void send_command(CephToolCtx *ctx) reply_rs = "error mapping pgid to an osd"; reply_rc = -EINVAL; reply = true; + cmd_cond.Signal(); return; } if (r == 0) { reply_rs = "pgid currently maps to no osd"; reply_rc = -ENOENT; reply = true; + cmd_cond.Signal(); return; } pending_target.set_name(entity_name_t::OSD(osds[0])); @@ -156,14 +158,23 @@ static void send_command(CephToolCtx *ctx) char *end; int n = strtoll(start, &end, 10); if (end <= start) { + stringstream ss; + ss << "invalid osd id " << pending_target; + reply_rs = ss.str(); reply_rc = -EINVAL; reply = true; + cmd_cond.Signal(); return; } if (!osdmap->is_up(n)) { + stringstream ss; + ss << pending_target << " is not up"; + reply_rs = ss.str(); reply_rc = -ESRCH; reply = true; + cmd_cond.Signal(); + return; } else { if (!ctx->concise) *ctx->log << ceph_clock_now(g_ceph_context) << " " << pending_target << " <- " << pending_cmd << std::endl; @@ -186,6 +197,7 @@ static void send_command(CephToolCtx *ctx) reply_rc = -EINVAL; reply = true; + cmd_cond.Signal(); } static void handle_osd_map(CephToolCtx *ctx, MOSDMap *m) @@ -282,8 +294,12 @@ int do_command(CephToolCtx *ctx, << reply_from.name << " -> '" << reply_rs << "' (" << reply_rc << ")" << std::endl; - else - cout << reply_rs << std::endl; + else { + if (reply_rc >= 0) + cout << reply_rs << std::endl; + else + cerr << reply_rs << std::endl; + } return reply_rc; } |