[Pkg-ceph-commits] [ceph] 03/04: patch rbd defaults
Dmitry Smirnov
onlyjob at moszumanska.debian.org
Thu Jul 17 20:37:18 UTC 2014
This is an automated email from the git hooks/post-receive script.
onlyjob pushed a commit to branch master
in repository ceph.
commit f0252ca
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date: Thu Jul 17 16:32:11 2014
patch rbd defaults
---
debian/patches/bug-8821.patch | 353 ++++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 354 insertions(+)
diff --git a/debian/patches/bug-8821.patch b/debian/patches/bug-8821.patch
new file mode 100644
index 0000000..c3c70f9
--- /dev/null
+++ b/debian/patches/bug-8821.patch
@@ -0,0 +1,353 @@
+From 0f87c55355ace952befce773498a3b5d8fac4f01 Mon Sep 17 00:00:00 2001
+From: Josh Durgin <josh.durgin at inktank.com>
+Date: Wed, 16 Jul 2014 13:29:29 -0700
+Subject: [PATCH 1/3] librbd: use order-agnostic default stripe parameters
+
+ This way the default striping style of splitting into
+ object-sized chunks still works with non-default orders
+ specified.
+
+ Signed-off-by: Josh Durgin <josh.durgin at inktank.com>
+
+Subject: [PATCH 2/3] rbd: remove accidental repeated option
+
+ --stripe-count is already parsed above this
+
+ Signed-off-by: Josh Durgin <josh.durgin at inktank.com>
+
+Subject: [PATCH 3/3] rbd: respect rbd_default_* parameters
+
+ Treat rbd_default_{format,order,stripe_unit,stripe_count} as defaults for
+ the usual arguments for specifying those properties.
+
+ librbd::create() is affected by rbd_default_format, so we need to
+ explicitly override it if --image-format is set. The rest of the
+ parameters are passed explicitly when they are used, so their rbd_default
+ equivalents don't matter.
+
+ Fixes: #8821
+ Signed-off-by: Josh Durgin <josh.durgin at inktank.com>
+
+--- a/src/common/config_opts.h
++++ b/src/common/config_opts.h
+@@ -737,10 +737,10 @@
+ * affected by rbd_default_order.
+ */
+ OPTION(rbd_default_format, OPT_INT, 1)
+ OPTION(rbd_default_order, OPT_INT, 22)
+-OPTION(rbd_default_stripe_count, OPT_U64, 1) // changing requires stripingv2 feature
+-OPTION(rbd_default_stripe_unit, OPT_U64, 4194304) // changing to non-object size requires stripingv2 feature
++OPTION(rbd_default_stripe_count, OPT_U64, 0) // changing requires stripingv2 feature
++OPTION(rbd_default_stripe_unit, OPT_U64, 0) // changing to non-object size requires stripingv2 feature
+ OPTION(rbd_default_features, OPT_INT, 3) // 1 for layering, 3 for layering+stripingv2. only applies to format 2 images
+
+ OPTION(nss_db_path, OPT_STR, "") // path to nss db
+
+--- a/src/rbd.cc
++++ b/src/rbd.cc
+@@ -2344,9 +2344,10 @@
+
+ const char *poolname = NULL;
+ uint64_t size = 0; // in bytes
+ int order = 0;
+- bool format_specified = false, output_format_specified = false;
++ bool format_specified = false,
++ output_format_specified = false;
+ int format = 1;
+ uint64_t features = RBD_FEATURE_LAYERING;
+ const char *imgname = NULL, *snapname = NULL, *destname = NULL,
+ *dest_poolname = NULL, *dest_snapname = NULL, *path = NULL,
+@@ -2358,9 +2359,9 @@
+ long long stripe_unit = 0, stripe_count = 0;
+ long long bench_io_size = 4096, bench_io_threads = 16, bench_bytes = 1 << 30;
+ string bench_pattern = "seq";
+
+- std::string val;
++ std::string val, parse_err;
+ std::ostringstream err;
+ long long sizell = 0;
+ std::vector<const char*>::iterator i;
+ for (i = args.begin(); i != args.end(); ) {
+@@ -2374,15 +2375,17 @@
+ return 0;
+ } else if (ceph_argparse_flag(args, i, "--new-format", (char*)NULL)) {
+ format = 2;
+ format_specified = true;
+- } else if (ceph_argparse_withint(args, i, &format, &err, "--image-format",
++ } else if (ceph_argparse_witharg(args, i, &val, "--image-format",
+ (char*)NULL)) {
+- if (!err.str().empty()) {
+- cerr << "rbd: " << err.str() << std::endl;
++ format = strict_strtol(val.c_str(), 10, &parse_err);
++ if (!parse_err.empty()) {
++ cerr << "rbd: error parsing --image-format: " << parse_err << std::endl;
+ return EXIT_FAILURE;
+ }
+ format_specified = true;
++ g_conf->set_val_or_die("rbd_default_format", val.c_str());
+ } else if (ceph_argparse_witharg(args, i, &val, "-p", "--pool", (char*)NULL)) {
+ poolname = strdup(val.c_str());
+ } else if (ceph_argparse_witharg(args, i, &val, "--dest-pool", (char*)NULL)) {
+ dest_poolname = strdup(val.c_str());
+@@ -2415,9 +2418,8 @@
+ } else if (ceph_argparse_withlonglong(args, i, &bench_io_size, &err, "--io-size", (char*)NULL)) {
+ } else if (ceph_argparse_withlonglong(args, i, &bench_io_threads, &err, "--io-threads", (char*)NULL)) {
+ } else if (ceph_argparse_withlonglong(args, i, &bench_bytes, &err, "--io-total", (char*)NULL)) {
+ } else if (ceph_argparse_witharg(args, i, &bench_pattern, &err, "--io-pattern", (char*)NULL)) {
+- } else if (ceph_argparse_withlonglong(args, i, &stripe_count, &err, "--stripe-count", (char*)NULL)) {
+ } else if (ceph_argparse_witharg(args, i, &val, "--path", (char*)NULL)) {
+ path = strdup(val.c_str());
+ } else if (ceph_argparse_witharg(args, i, &val, "--dest", (char*)NULL)) {
+ destname = strdup(val.c_str());
+@@ -2440,11 +2442,11 @@
+ progress = false;
+ } else if (ceph_argparse_flag(args, i , "--allow-shrink", (char *)NULL)) {
+ resize_allow_shrink = true;
+ } else if (ceph_argparse_witharg(args, i, &val, "--format", (char *) NULL)) {
+- std::string err;
+- long long ret = strict_strtoll(val.c_str(), 10, &err);
+- if (err.empty()) {
++ long long ret = strict_strtoll(val.c_str(), 10, &parse_err);
++ if (parse_err.empty()) {
++ g_conf->set_val_or_die("rbd_default_format", val.c_str());
+ format = ret;
+ format_specified = true;
+ cerr << "rbd: using --format for specifying the rbd image format is"
+ << " deprecated, use --image-format instead"
+@@ -2556,8 +2558,19 @@
+ break;
+ }
+ }
+
++ /* get defaults from rbd_default_* options to keep behavior consistent with
++ manual short-form options */
++ if (!format_specified)
++ format = g_conf->rbd_default_format;
++ if (!order)
++ order = g_conf->rbd_default_order;
++ if (!stripe_unit)
++ stripe_unit = g_conf->rbd_default_stripe_unit;
++ if (!stripe_count)
++ stripe_count = g_conf->rbd_default_stripe_count;
++
+ if (format_specified && opt_cmd != OPT_IMPORT && opt_cmd != OPT_CREATE) {
+ cerr << "rbd: image format can only be set when "
+ << "creating or importing an image" << std::endl;
+ return EXIT_FAILURE;
+--- /dev/null
++++ b/src/test/cli-integration/rbd/defaults.t
+@@ -0,0 +1,214 @@
++Plain create with various options specified via usual cli arguments
++===================================================================
++ $ rbd create -s 1 test
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rb.0.*", (glob)
++ "format": 1,
++ "name": "test",
++ "object_size": 4194304,
++ "objects": 1,
++ "order": 22,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 --order 20 test
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rb.0.*", (glob)
++ "format": 1,
++ "name": "test",
++ "object_size": 1048576,
++ "objects": 1,
++ "order": 20,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --image-format 2
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 4194304,
++ "objects": 1,
++ "order": 22,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --image-format 2 --order 20
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 1048576,
++ "objects": 1,
++ "order": 20,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --image-format 2 --stripe-unit 1048576 --stripe-count 8
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 4194304,
++ "objects": 1,
++ "order": 22,
++ "size": 1048576,
++ "stripe_count": 8,
++ "stripe_unit": 1048576
++ }
++ $ rbd rm test --no-progress
++
++Format 2 Usual arguments with custom rbd_default_* params
++=========================================================
++ $ rbd create -s 1 test --image-format 2 --stripe-unit 1048576 --stripe-count 8 --rbd-default-order 21
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 2097152,
++ "objects": 1,
++ "order": 21,
++ "size": 1048576,
++ "stripe_count": 8,
++ "stripe_unit": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --image-format 2 --stripe-unit 1048576 --stripe-count 8 --order 23 --rbd-default-order 20
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 8388608,
++ "objects": 1,
++ "order": 23,
++ "size": 1048576,
++ "stripe_count": 8,
++ "stripe_unit": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --image-format 2 --rbd-default-stripe-unit 1048576 --rbd-default-stripe-count 8
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 4194304,
++ "objects": 1,
++ "order": 22,
++ "size": 1048576,
++ "stripe_count": 8,
++ "stripe_unit": 1048576
++ }
++ $ rbd rm test --no-progress
++
++Format 1 Usual arguments with custom rbd_default_* params
++=========================================================
++ $ rbd create -s 1 test --rbd-default-order 20
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rb.0.*", (glob)
++ "format": 1,
++ "name": "test",
++ "object_size": 1048576,
++ "objects": 1,
++ "order": 20,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --rbd-default-format 2
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 4194304,
++ "objects": 1,
++ "order": 22,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --rbd-default-format 2 --rbd-default-order 20
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 1048576,
++ "objects": 1,
++ "order": 20,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --rbd-default-format 2 --rbd-default-order 20 --rbd-default-features 1
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 1048576,
++ "objects": 1,
++ "order": 20,
++ "size": 1048576
++ }
++ $ rbd rm test --no-progress
++ $ rbd create -s 1 test --rbd-default-format 2 --stripe-unit 1048576 --stripe-count 8
++ $ rbd info test --format json | python -mjson.tool
++ {
++ "block_name_prefix": "rbd_data.*", (glob)
++ "features": [
++ "layering",
++ "striping"
++ ],
++ "format": 2,
++ "name": "test",
++ "object_size": 4194304,
++ "objects": 1,
++ "order": 22,
++ "size": 1048576,
++ "stripe_count": 8,
++ "stripe_unit": 1048576
++ }
++ $ rbd rm test --no-progress
diff --git a/debian/patches/series b/debian/patches/series
index e504701..066bb62 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,6 +3,7 @@ firefly-post-release.patch
bug-8342.patch
bug-8624a.patch
bug-8624b.patch
+bug-8821.patch
client-sleep1.patch
client-sleep2.patch
client-sleep3.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ceph/ceph.git
More information about the Pkg-ceph-commits
mailing list