From ddb3d02f0c80412a92f4b8b23185bda8a4763c3c Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Thu, 20 Nov 2025 13:11:41 +0100 Subject: [PATCH] Fix adoption issues with swift-ring-tool This commit fixes two issues: 1. Removing a node by hostname only works with the "--ip" flag, otherwise swift-ring-builder won't find the device itself. Using the "--ip" works both with IP addresses and hostnames. 2. After removing a device it is set to None within the ring, and the metaswap function raises an exception because "dev" is not a dict. Signed-off-by: Christian Schwede --- templates/swiftring/bin/swift-ring-tool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/swiftring/bin/swift-ring-tool b/templates/swiftring/bin/swift-ring-tool index 71070646..84c39270 100755 --- a/templates/swiftring/bin/swift-ring-tool +++ b/templates/swiftring/bin/swift-ring-tool @@ -77,7 +77,7 @@ function metaswap() { from swift.common.ring import RingBuilder builder = RingBuilder.load("$1") for dev in builder.devs: - if dev.get('meta') and dev.get('device') == 'pv': + if dev and dev.get('meta') and dev.get('device') == 'pv': dev['meta'], dev['ip'] = dev['ip'], dev['meta'] builder.save("$1") EOF @@ -111,7 +111,7 @@ function drain() { function remove() { for f in *.builder; do - swift-ring-builder $f remove $1 + swift-ring-builder $f remove --ip "$1" done }