]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: 'zone placement' commands validate compression type 18434/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 12 Oct 2017 17:26:29 +0000 (13:26 -0400)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 20 Oct 2017 14:55:56 +0000 (16:55 +0200)
Fixes: http://tracker.ceph.com/issues/21775
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 33f8ee8b6fa5605edbbfe12d8e097123e509ad9f)

src/rgw/rgw_admin.cc

index 9c0826822de8e28a2966749fd499192fb4e3d6e6..bd770160710c169d7e17c2b6c50ff5b05b39acd2 100644 (file)
@@ -9,6 +9,7 @@
 #include <boost/optional.hpp>
 
 #include "auth/Crypto.h"
+#include "compressor/Compressor.h"
 
 #include "common/armor.h"
 #include "common/ceph_json.h"
@@ -4250,6 +4251,13 @@ int main(int argc, const char **argv)
           cerr << "ERROR: --placement-id not specified" << std::endl;
           return EINVAL;
         }
+        // validate compression type
+        if (compression_type && *compression_type != "random"
+            && !Compressor::get_comp_alg_type(*compression_type)) {
+          std::cerr << "Unrecognized compression type" << std::endl;
+          return EINVAL;
+        }
+
        RGWZoneParams zone(zone_id, zone_name);
        int ret = zone.init(g_ceph_context, store);
         if (ret < 0) {