Remove the exception from the unit test, since we don't bomb out anymore. Also, add a warning to swift-ring-builder if you're building an empty ring, or do a write_ring and you aren't rebalanced
This commit is contained in:
@@ -533,10 +533,16 @@ Exit codes: 0 = ring changed, 1 = ring did not change, 2 = error
|
||||
exit(EXIT_RING_UNCHANGED)
|
||||
|
||||
elif argv[2] == 'write_ring':
|
||||
pickle.dump(builder.get_ring(),
|
||||
ring_data = builder.get_ring()
|
||||
if not ring_data._replica2part2dev_id:
|
||||
if ring_data.devs:
|
||||
print 'Warning: Writing a ring with no partition assignments but with devices; did you forget to run "rebalance"?'
|
||||
else:
|
||||
print 'Warning: Writing an empty ring'
|
||||
pickle.dump(ring_data,
|
||||
GzipFile(pathjoin(backup_dir, '%d.' % time() +
|
||||
basename(ring_file)), 'wb'), protocol=2)
|
||||
pickle.dump(builder.get_ring(), GzipFile(ring_file, 'wb'), protocol=2)
|
||||
pickle.dump(ring_data, GzipFile(ring_file, 'wb'), protocol=2)
|
||||
exit(EXIT_RING_CHANGED)
|
||||
|
||||
elif argv[2] == 'pretend_min_part_hours_passed':
|
||||
|
@@ -43,7 +43,6 @@ class TestRingBuilder(unittest.TestCase):
|
||||
|
||||
def test_get_ring(self):
|
||||
rb = ring.RingBuilder(8, 3, 1)
|
||||
self.assertRaises(Exception, rb.get_ring)
|
||||
rb.add_dev({'id': 0, 'zone': 0, 'weight': 1, 'ip': '127.0.0.1',
|
||||
'port': 10000, 'device': 'sda1'})
|
||||
rb.add_dev({'id': 1, 'zone': 1, 'weight': 1, 'ip': '127.0.0.1',
|
||||
|
Reference in New Issue
Block a user