]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix swift cannot disable object versioning with empty X-Versions-Location 13823/head
authorJing Wenjun <jingwenjun@cmss.chinamobile.com>
Wed, 8 Feb 2017 07:07:43 +0000 (15:07 +0800)
committerAlexey Sheplyakov <asheplyakov@mirantis.com>
Tue, 7 Mar 2017 07:04:34 +0000 (11:04 +0400)
we should be able to disable object verioning by removing its X-Versions-Location
metadata header by sending an empty key value. this description can be found at
No.8 in http://docs.openstack.org/user-guide/cli-swift-set-object-versions.html.

Fixes: http://tracker.ceph.com/issues/18852
Signed-off-by: Jing Wenjun <jingwenjun@cmss.chinamobile.com>
(cherry picked from commit 17c5a0edd2227703cec867f0f588d4eae36dfe1c)

src/rgw/rgw_rest_swift.cc

index 7b4a3e1ffc72ceb77cc1415e7d543090be6aadc5..d63a772c2e79d39ff7e9b7893af06a1c6a23cdc2 100644 (file)
@@ -528,8 +528,7 @@ static int get_swift_versioning_settings(
     swift_ver_location = boost::in_place(std::string());
   }
 
-  std::string vloc = s->info.env->get("HTTP_X_VERSIONS_LOCATION", "");
-  if (vloc.size()) {
+  if (s->info.env->exists("HTTP_X_VERSIONS_LOCATION")) {
     /* If the Swift's versioning is globally disabled but someone wants to
      * enable it for a given container, new version of Swift will generate
      * the precondition failed error. */
@@ -537,7 +536,7 @@ static int get_swift_versioning_settings(
       return -ERR_PRECONDITION_FAILED;
     }
 
-    swift_ver_location = std::move(vloc);
+    swift_ver_location = s->info.env->get("HTTP_X_VERSIONS_LOCATION", "");
   }
 
   return 0;