From cdb589c32dfdd0c515861909f09dc2c0ec42fec9 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Fri, 1 Jul 2016 13:20:12 +0200 Subject: [PATCH] Config option to specify default COS Currently, in certain HPSS configurations, it is not possible to make a PUT without adding the Header "X-HPSS-Class-Of-Service-Id". With this commit, a default COS can be specified in the config, in order to let the user allow to omit the Header on each PUT request. Change-Id: I4ad2fadc95cf557a1d226e336013324c339d51b6 --- swiftonhpss/swift/obj/server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/swiftonhpss/swift/obj/server.py b/swiftonhpss/swift/obj/server.py index 63d6537..f814db8 100644 --- a/swiftonhpss/swift/obj/server.py +++ b/swiftonhpss/swift/obj/server.py @@ -88,6 +88,7 @@ class ObjectController(server.ObjectController): config_true_value(conf.get('read_pickled_metadata', 'no')) self.allow_purgelock = \ config_true_value(conf.get('allow_purgelock', True)) + self.default_cos_id = conf.get('default_cos_id') def get_container_ring(self): """Get the container ring. Load it, if it hasn't been yet.""" @@ -161,7 +162,8 @@ class ObjectController(server.ObjectController): elapsed_time = 0 # (HPSS) Check for HPSS-specific metadata headers - cos = request.headers.get('X-Hpss-Class-Of-Service-Id', None) + cos = request.headers.get('X-Hpss-Class-Of-Service-Id', + self.default_cos_id) if self.allow_purgelock: purgelock = config_true_value(