Enable object versioning for a container

This patch adds the config option rgw-swift-versioning-enabled boolean that enables swift versioning for the ceph-backed storage solution.  This uses X-Versions-Location as it is the only header that radosgw interprets.

closes-bug: #1910679
Change-Id: I5b42c34882b46e96f4cc92d91ec441a4bdfd76f6
This commit is contained in:
Jarred Wilson 2021-01-14 14:07:07 -05:00
parent dc12d2059b
commit 72a7184dc5
4 changed files with 15 additions and 0 deletions

View File

@ -500,3 +500,12 @@ options:
description: |
Value of bluestore compression max blob size for solid state media on
pools requested by this charm.
rgw-swift-versioning-enabled:
type: boolean
default: False
description: |
If True, swift object versioning will be enabled for radosgw.
NOTE: X-Versions-Location is the only versioning-related header that
radosgw interprets. X-History-Location, supported by native OpenStack
Swift, is currently not supported by radosgw.

View File

@ -207,6 +207,7 @@ class MonContext(context.CephContext):
# not available externally). ~tribaal
'unit_public_ip': unit_public_ip(),
'fsid': fsid,
'rgw_swift_versioning': config('rgw-swift-versioning-enabled'),
}
# NOTE(dosaboy): these sections must correspond to what is supported in

View File

@ -14,6 +14,7 @@ debug rgw = {{ loglevel }}/5
{% if ipv6 -%}
ms bind ipv6 = true
{% endif %}
rgw swift versioning enabled = {{ rgw_swift_versioning }}
{% if global -%}
# The following are user-provided options provided via the config-flags charm option.
# User-provided [global] section config

View File

@ -387,6 +387,7 @@ class MonContextTest(CharmTestCase):
'ipv6': False,
'rgw_zone': 'default',
'fsid': 'testfsid',
'rgw_swift_versioning': False,
}
self.assertEqual(expect, mon_ctxt())
self.assertFalse(mock_ensure_rsv_v6.called)
@ -435,6 +436,7 @@ class MonContextTest(CharmTestCase):
'ipv6': False,
'rgw_zone': 'default',
'fsid': 'testfsid',
'rgw_swift_versioning': False,
}
self.assertEqual(expect, mon_ctxt())
self.assertFalse(mock_ensure_rsv_v6.called)
@ -492,6 +494,7 @@ class MonContextTest(CharmTestCase):
'ipv6': False,
'rgw_zone': 'default',
'fsid': 'testfsid',
'rgw_swift_versioning': False,
}
self.assertEqual(expect, mon_ctxt())
@ -531,6 +534,7 @@ class MonContextTest(CharmTestCase):
'ipv6': False,
'rgw_zone': 'default',
'fsid': 'testfsid',
'rgw_swift_versioning': False,
}
self.assertEqual(expect, mon_ctxt())