From 770cc287aa340b5cae0d8750a864b332beaf52ec Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 23 Jul 2020 17:00:11 -0700 Subject: [PATCH] Treat add/remove/rebalance during part-power increase as error We weren't actually willing to change anything; sure sounds like an error to me. Change-Id: I033f6fba4ddb3dd502dfd5393dd2e9a2115672e0 --- swift/cli/ringbuilder.py | 6 +++--- test/unit/cli/test_ringbuilder.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/swift/cli/ringbuilder.py b/swift/cli/ringbuilder.py index 5ee04e04a4..1b99105788 100644 --- a/swift/cli/ringbuilder.py +++ b/swift/cli/ringbuilder.py @@ -777,7 +777,7 @@ swift-ring-builder add if builder.next_part_power: print('Partition power increase in progress. You need ') print('to finish the increase first before adding devices.') - exit(EXIT_WARNING) + exit(EXIT_ERROR) try: for new_dev in _parse_add_values(argv[3:]): @@ -996,7 +996,7 @@ swift-ring-builder remove if builder.next_part_power: print('Partition power increase in progress. You need ') print('to finish the increase first before removing devices.') - exit(EXIT_WARNING) + exit(EXIT_ERROR) devs, opts = _parse_remove_values(argv[3:]) @@ -1063,7 +1063,7 @@ swift-ring-builder rebalance [options] if builder.next_part_power: print('Partition power increase in progress.') print('You need to finish the increase first before rebalancing.') - exit(EXIT_WARNING) + exit(EXIT_ERROR) devs_changed = builder.devs_changed min_part_seconds_left = builder.min_part_seconds_left diff --git a/test/unit/cli/test_ringbuilder.py b/test/unit/cli/test_ringbuilder.py index 05505fe9b7..6327c980e5 100644 --- a/test/unit/cli/test_ringbuilder.py +++ b/test/unit/cli/test_ringbuilder.py @@ -535,7 +535,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin): argv = ["", self.tmpfile, "add", "r0z0-127.0.1.1:6200/sda1_some meta data", "100"] - self.assertSystemExit(EXIT_WARNING, ringbuilder.main, argv) + self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv) def test_remove_device(self): for search_value in self.search_values: @@ -817,7 +817,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin): ring.save(self.tmpfile) argv = ["", self.tmpfile, "remove", "d0"] - self.assertSystemExit(EXIT_WARNING, ringbuilder.main, argv) + self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv) def test_set_weight(self): for search_value in self.search_values: @@ -2536,7 +2536,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin): ring.save(self.tmpfile) argv = ["", self.tmpfile, "rebalance", "3"] - self.assertSystemExit(EXIT_WARNING, ringbuilder.main, argv) + self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv) def test_write_ring(self): self.create_sample_ring()