Add Swift storage policy to extend testing

Swift supports storage policies for a long time, making it possible to
store specific objects on different devices[1].

This patch adds a second storage policy to support testing API features
that rely on storage policies, eg. per-policy quotas[2]. There are no
additional Swift devices created and the existing ones are re-used to
keep the overhead to the minimum.

[1] https://docs.openstack.org/swift/latest/overview_policies.html
[2] https://github.com/openstack/swift/commit/cbba65ac

Signed-off-by: Christian Schwede <cschwede@redhat.com>
Change-Id: I6b1a35dbf1490b25e103f008eb058f406f0a24ea
This commit is contained in:
Christian Schwede
2025-07-21 14:47:30 +02:00
parent a8f98073b9
commit bab34bbade

View File

@@ -477,6 +477,9 @@ function configure_swift {
iniset ${SWIFT_CONF_DIR}/swift.conf swift-constraints max_header_size ${SWIFT_MAX_HEADER_SIZE}
iniset ${SWIFT_CONF_DIR}/swift.conf swift-constraints max_file_size ${SWIFT_MAX_FILE_SIZE}
# Create an additional storage policy
iniset ${SWIFT_CONF_DIR}/swift.conf storage-policy:1 name silver
local node_number
for node_number in ${SWIFT_REPLICAS_SEQ}; do
local swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf
@@ -713,6 +716,10 @@ function init_swift {
$SWIFT_BIN_DIR/swift-ring-builder object.builder rebalance 42
$SWIFT_BIN_DIR/swift-ring-builder container.builder rebalance 42
$SWIFT_BIN_DIR/swift-ring-builder account.builder rebalance 42
# An additional storage policy requires an object ring as well.
# Re-using the previously created one to use the same devices.
cp object.ring.gz object-1.ring.gz
} && popd >/dev/null
}