Config option to (dis)allow purgelock header
Before this commit, users could submit a file with a purge lock by adding a specific HTTP header. This is not desired for every HPSS deployment. This commit adds a boolean option, which indicates if the header should be ignored or processed. Change-Id: I39a9da6537fd4984e9af01c0235ec10f938b8238
This commit is contained in:
parent
baf6a24490
commit
dc62c40a01
@ -86,6 +86,8 @@ class ObjectController(server.ObjectController):
|
|||||||
# future releases
|
# future releases
|
||||||
utils.read_pickled_metadata = \
|
utils.read_pickled_metadata = \
|
||||||
config_true_value(conf.get('read_pickled_metadata', 'no'))
|
config_true_value(conf.get('read_pickled_metadata', 'no'))
|
||||||
|
self.allow_purgelock = \
|
||||||
|
config_true_value(conf.get('allow_purgelock', True))
|
||||||
|
|
||||||
def get_container_ring(self):
|
def get_container_ring(self):
|
||||||
"""Get the container ring. Load it, if it hasn't been yet."""
|
"""Get the container ring. Load it, if it hasn't been yet."""
|
||||||
@ -160,8 +162,12 @@ class ObjectController(server.ObjectController):
|
|||||||
|
|
||||||
# (HPSS) Check for HPSS-specific metadata headers
|
# (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', None)
|
||||||
purgelock = config_true_value(
|
|
||||||
request.headers.get('X-Hpss-Purgelock-Status', 'false'))
|
if self.allow_purgelock:
|
||||||
|
purgelock = config_true_value(
|
||||||
|
request.headers.get('X-Hpss-Purgelock-Status', 'false'))
|
||||||
|
else:
|
||||||
|
purgelock = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Feed DiskFile our HPSS-specific stuff
|
# Feed DiskFile our HPSS-specific stuff
|
||||||
@ -490,7 +496,11 @@ class ObjectController(server.ObjectController):
|
|||||||
return HTTPInsufficientStorage(drive=device, request=request)
|
return HTTPInsufficientStorage(drive=device, request=request)
|
||||||
|
|
||||||
# Set Purgelock status if we got it
|
# Set Purgelock status if we got it
|
||||||
purgelock = request.headers.get('X-HPSS-Purgelock-Status')
|
if self.allow_purgelock:
|
||||||
|
purgelock = request.headers.get('X-HPSS-Purgelock-Status')
|
||||||
|
else:
|
||||||
|
purgelock = False
|
||||||
|
|
||||||
if purgelock:
|
if purgelock:
|
||||||
try:
|
try:
|
||||||
hpssfs.ioctl(disk_file._fd, hpssfs.HPSSFS_PURGE_LOCK,
|
hpssfs.ioctl(disk_file._fd, hpssfs.HPSSFS_PURGE_LOCK,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user