From bab34bbade0da8f6b7f3fd23628522ec24688807 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Mon, 21 Jul 2025 14:47:30 +0200 Subject: [PATCH] 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 Change-Id: I6b1a35dbf1490b25e103f008eb058f406f0a24ea --- lib/swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/swift b/lib/swift index 862927437d..9532efb45c 100644 --- a/lib/swift +++ b/lib/swift @@ -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 }