]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: informative message when erasure-code-profile set fails 4064/head
authorLoic Dachary <ldachary@redhat.com>
Wed, 18 Mar 2015 10:40:36 +0000 (11:40 +0100)
committerLoic Dachary <ldachary@redhat.com>
Wed, 18 Mar 2015 10:53:20 +0000 (11:53 +0100)
When erasure-code-profile set refuses to override an existing profile,
it may be non trivial to figure out why. For instance:

   ceph osd set default ruleset-failure-domain=host

fails with:

   Error EPERM: will not override erasure code profile default

although ruleset-failure-domain=host is documented to be the
default. The error message now includes the two profiles that have been
compared to not be equal so that the user can verify the difference.

   Error EPERM: will not override erasure code profile default
   because the existing profile
   {directory=.libs,k=2,m=1,plugin=jerasure,technique=reed_sol_van}
   is different from the proposed profile
   {directory=.libs,k=2,m=1,plugin=jerasure,ruleset-failure-domain=host,technique=reed_sol_van}

http://tracker.ceph.com/issues/10488 Fixes: #10488

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/mon/OSDMonitor.cc
src/test/mon/osd-erasure-code-profile.sh

index d02288ae054123834351a7bb536a2f9e56f0f1a2..261d21e7fa028c47a4b2d4c9437dee40d8d89ba2 100644 (file)
@@ -5143,7 +5143,11 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
       }
       if (!force) {
        err = -EPERM;
-       ss << "will not override erasure code profile " << name;
+       ss << "will not override erasure code profile " << name
+          << " because the existing profile "
+          << osdmap.get_erasure_code_profile(name)
+          << " is different from the proposed profile "
+          << profile_map;
        goto reply;
       }
     }
index b16b6640a9c2608c74fd067ae8fc6a5920e90c16..6cac118bcfe66169b10fee017effed9e707bc362 100755 (executable)
@@ -120,6 +120,40 @@ function SHARE_MON_TEST_experimental_shec() {
     ! ./ceph osd erasure-code-profile ls | grep $profile || return 1
 }
 
+function SHARE_MON_TEST_set_idempotent() {
+    local dir=$1
+    local id=$2
+
+    #
+    # The default profile is set using a code path different from 
+    # ceph osd erasure-code-profile set: verify that it is idempotent,
+    # as if it was using the same code path.
+    #
+    ./ceph osd erasure-code-profile set default k=2 m=1 2>&1 || return 1
+    local profile
+    #
+    # Because plugin=jerasure is the default, it uses a slightly
+    # different code path where defaults (m=1 for instance) are added
+    # implicitly.
+    #
+    profile=profileidempotent1
+    ! ./ceph osd erasure-code-profile ls | grep $profile || return 1
+    ./ceph osd erasure-code-profile set $profile k=2 ruleset-failure-domain=osd 2>&1 || return 1
+    ./ceph osd erasure-code-profile ls | grep $profile || return 1
+    ./ceph osd erasure-code-profile set $profile k=2 ruleset-failure-domain=osd 2>&1 || return 1
+    ./ceph osd erasure-code-profile rm $profile # cleanup
+
+    #
+    # In the general case the profile is exactly what is on
+    #
+    profile=profileidempotent2
+    ! ./ceph osd erasure-code-profile ls | grep $profile || return 1
+    ./ceph osd erasure-code-profile set $profile plugin=lrc k=4 m=2 l=3 ruleset-failure-domain=osd 2>&1 || return 1
+    ./ceph osd erasure-code-profile ls | grep $profile || return 1
+    ./ceph osd erasure-code-profile set $profile plugin=lrc k=4 m=2 l=3 ruleset-failure-domain=osd 2>&1 || return 1
+    ./ceph osd erasure-code-profile rm $profile # cleanup
+}
+
 function TEST_format_invalid() {
     local dir=$1