Merge "Follow up on reconstructor handoffs_only"
This commit is contained in:
commit
30524392f8
@ -152,7 +152,7 @@ class ObjectReconstructor(Daemon):
|
|||||||
if 'handoffs_first' in conf:
|
if 'handoffs_first' in conf:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
'The handoffs_first option is deprecated in favor '
|
'The handoffs_first option is deprecated in favor '
|
||||||
'of handoffs_only. This option may be ignored in a '
|
'of handoffs_only. This option may be ignored in a '
|
||||||
'future release.')
|
'future release.')
|
||||||
# honor handoffs_first for backwards compatibility
|
# honor handoffs_first for backwards compatibility
|
||||||
default_handoffs_only = config_true_value(conf['handoffs_first'])
|
default_handoffs_only = config_true_value(conf['handoffs_first'])
|
||||||
@ -1032,11 +1032,11 @@ class ObjectReconstructor(Daemon):
|
|||||||
if self.handoffs_only:
|
if self.handoffs_only:
|
||||||
if self.handoffs_remaining > 0:
|
if self.handoffs_remaining > 0:
|
||||||
self.logger.info(_(
|
self.logger.info(_(
|
||||||
"Handoffs only mode still has handoffs remaining. "
|
"Handoffs only mode still has handoffs remaining. "
|
||||||
"Next pass will continue to revert handoffs."))
|
"Next pass will continue to revert handoffs."))
|
||||||
else:
|
else:
|
||||||
self.logger.warning(_(
|
self.logger.warning(_(
|
||||||
"Handoffs only mode found no handoffs remaining. "
|
"Handoffs only mode found no handoffs remaining. "
|
||||||
"You should disable handoffs_only once all nodes "
|
"You should disable handoffs_only once all nodes "
|
||||||
"are reporting no handoffs remaining."))
|
"are reporting no handoffs remaining."))
|
||||||
|
|
||||||
|
@ -1191,22 +1191,22 @@ class TestObjectReconstructor(unittest.TestCase):
|
|||||||
|
|
||||||
def test_handoffs_only_default(self):
|
def test_handoffs_only_default(self):
|
||||||
# sanity neither option added to default conf
|
# sanity neither option added to default conf
|
||||||
self.conf.pop('handoffs_only', None)
|
|
||||||
self.conf.pop('handoffs_first', None)
|
self.conf.pop('handoffs_first', None)
|
||||||
|
self.conf.pop('handoffs_only', None)
|
||||||
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
self.conf, logger=self.logger)
|
self.conf, logger=self.logger)
|
||||||
self.assertFalse(self.reconstructor.handoffs_only)
|
self.assertFalse(self.reconstructor.handoffs_only)
|
||||||
|
|
||||||
def test_handoffs_first_enables_handoffs_only(self):
|
def test_handoffs_first_enables_handoffs_only(self):
|
||||||
|
self.conf['handoffs_first'] = "True"
|
||||||
self.conf.pop('handoffs_only', None) # sanity
|
self.conf.pop('handoffs_only', None) # sanity
|
||||||
self.conf['handoffs_first'] = True
|
|
||||||
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
self.conf, logger=self.logger)
|
self.conf, logger=self.logger)
|
||||||
self.assertTrue(self.reconstructor.handoffs_only)
|
self.assertTrue(self.reconstructor.handoffs_only)
|
||||||
warnings = self.logger.get_lines_for_level('warning')
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
expected = [
|
expected = [
|
||||||
'The handoffs_first option is deprecated in favor '
|
'The handoffs_first option is deprecated in favor '
|
||||||
'of handoffs_only. This option may be ignored in a '
|
'of handoffs_only. This option may be ignored in a '
|
||||||
'future release.',
|
'future release.',
|
||||||
'Handoff only mode is not intended for normal operation, '
|
'Handoff only mode is not intended for normal operation, '
|
||||||
'use handoffs_only with care.',
|
'use handoffs_only with care.',
|
||||||
@ -1214,22 +1214,22 @@ class TestObjectReconstructor(unittest.TestCase):
|
|||||||
self.assertEqual(expected, warnings)
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
def test_handoffs_only_ignores_handoffs_first(self):
|
def test_handoffs_only_ignores_handoffs_first(self):
|
||||||
self.conf['handoffs_first'] = True
|
self.conf['handoffs_first'] = "True"
|
||||||
self.conf['handoffs_only'] = False
|
self.conf['handoffs_only'] = "False"
|
||||||
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
self.conf, logger=self.logger)
|
self.conf, logger=self.logger)
|
||||||
self.assertFalse(self.reconstructor.handoffs_only)
|
self.assertFalse(self.reconstructor.handoffs_only)
|
||||||
warnings = self.logger.get_lines_for_level('warning')
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
expected = [
|
expected = [
|
||||||
'The handoffs_first option is deprecated in favor of '
|
'The handoffs_first option is deprecated in favor of '
|
||||||
'handoffs_only. This option may be ignored in a future release.',
|
'handoffs_only. This option may be ignored in a future release.',
|
||||||
'Ignored handoffs_first option in favor of handoffs_only.',
|
'Ignored handoffs_first option in favor of handoffs_only.',
|
||||||
]
|
]
|
||||||
self.assertEqual(expected, warnings)
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
def test_handoffs_only_enabled(self):
|
def test_handoffs_only_enabled(self):
|
||||||
self.conf.pop('handoffs_first', None) # sanity
|
self.conf.pop('handoffs_first', None) # sanity
|
||||||
self.conf['handoffs_only'] = True
|
self.conf['handoffs_only'] = "True"
|
||||||
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
self.conf, logger=self.logger)
|
self.conf, logger=self.logger)
|
||||||
self.assertTrue(self.reconstructor.handoffs_only)
|
self.assertTrue(self.reconstructor.handoffs_only)
|
||||||
@ -1240,6 +1240,71 @@ class TestObjectReconstructor(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
self.assertEqual(expected, warnings)
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
|
def test_handoffs_only_true_and_first_true(self):
|
||||||
|
self.conf['handoffs_first'] = "True"
|
||||||
|
self.conf['handoffs_only'] = "True"
|
||||||
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
|
self.conf, logger=self.logger)
|
||||||
|
self.assertTrue(self.reconstructor.handoffs_only)
|
||||||
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
|
expected = [
|
||||||
|
'The handoffs_first option is deprecated in favor of '
|
||||||
|
'handoffs_only. This option may be ignored in a future release.',
|
||||||
|
'Handoff only mode is not intended for normal operation, '
|
||||||
|
'use handoffs_only with care.',
|
||||||
|
]
|
||||||
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
|
def test_handoffs_only_false_and_first_false(self):
|
||||||
|
self.conf['handoffs_only'] = "False"
|
||||||
|
self.conf['handoffs_first'] = "False"
|
||||||
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
|
self.conf, logger=self.logger)
|
||||||
|
self.assertFalse(self.reconstructor.handoffs_only)
|
||||||
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
|
expected = [
|
||||||
|
'The handoffs_first option is deprecated in favor of '
|
||||||
|
'handoffs_only. This option may be ignored in a future release.',
|
||||||
|
]
|
||||||
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
|
def test_handoffs_only_none_and_first_false(self):
|
||||||
|
self.conf['handoffs_first'] = "False"
|
||||||
|
self.conf.pop('handoffs_only', None) # sanity
|
||||||
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
|
self.conf, logger=self.logger)
|
||||||
|
self.assertFalse(self.reconstructor.handoffs_only)
|
||||||
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
|
expected = [
|
||||||
|
'The handoffs_first option is deprecated in favor of '
|
||||||
|
'handoffs_only. This option may be ignored in a future release.',
|
||||||
|
]
|
||||||
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
|
def test_handoffs_only_false_and_first_none(self):
|
||||||
|
self.conf.pop('handoffs_first', None) # sanity
|
||||||
|
self.conf['handoffs_only'] = "False"
|
||||||
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
|
self.conf, logger=self.logger)
|
||||||
|
self.assertFalse(self.reconstructor.handoffs_only)
|
||||||
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
|
self.assertEqual(len(warnings), 0)
|
||||||
|
|
||||||
|
def test_handoffs_only_true_and_first_false(self):
|
||||||
|
self.conf['handoffs_first'] = "False"
|
||||||
|
self.conf['handoffs_only'] = "True"
|
||||||
|
self.reconstructor = object_reconstructor.ObjectReconstructor(
|
||||||
|
self.conf, logger=self.logger)
|
||||||
|
self.assertTrue(self.reconstructor.handoffs_only)
|
||||||
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
|
expected = [
|
||||||
|
'The handoffs_first option is deprecated in favor of '
|
||||||
|
'handoffs_only. This option may be ignored in a future release.',
|
||||||
|
'Handoff only mode is not intended for normal operation, '
|
||||||
|
'use handoffs_only with care.',
|
||||||
|
]
|
||||||
|
self.assertEqual(expected, warnings)
|
||||||
|
|
||||||
def test_two_ec_policies(self):
|
def test_two_ec_policies(self):
|
||||||
with patch_policies([
|
with patch_policies([
|
||||||
StoragePolicy(0, name='zero', is_deprecated=True),
|
StoragePolicy(0, name='zero', is_deprecated=True),
|
||||||
|
Loading…
Reference in New Issue
Block a user