Fix openstack cluster resize

User should be allowed to resize cluster without
changing its size. This patch removes incorrect
constraint defined in openstack cluster resize
implementation.

Change-Id: I7592f76d23a583bcc696a86dc75ada41be6b0f9d
This commit is contained in:
yanyanhu 2016-06-13 04:32:16 -04:00
parent 10ac9cb4d7
commit 84916acf84
2 changed files with 12 additions and 11 deletions
senlinclient

@ -425,14 +425,20 @@ class TestClusterResize(TestCluster):
self.assertEqual("Only one of 'capacity', 'adjustment' "
"and 'percentage' can be specified.", str(error))
def test_cluster_resize_none_params(self):
def test_cluster_resize_only_constraints(self):
arglist = ['--min-size', '1', '--max-size', '20', 'my_cluster']
parsed_args = self.check_parser(self.cmd, arglist, [])
error = self.assertRaises(exc.CommandError,
self.cmd.take_action,
parsed_args)
self.assertEqual("At least one of 'capacity', 'adjustment' and "
"'percentage' should be specified.", str(error))
self.cmd.take_action(parsed_args)
kwargs = {
'min_size': 1,
'max_size': 20,
'adjustment_type': None,
'min_step': None,
'number': None,
'strict': False
}
self.mock_client.cluster_resize.assert_called_with('my_cluster',
**kwargs)
def test_cluster_resize_capacity(self):
arglist = ['--capacity', '2', '--min-size', '1', '--max-size', '20',

@ -405,11 +405,6 @@ class ResizeCluster(command.Command):
raise exc.CommandError(_("Only one of 'capacity', 'adjustment' and"
" 'percentage' can be specified."))
if sum(v is None for v in (capacity, adjustment, percentage)) == 3:
raise exc.CommandError(_("At least one of 'capacity', "
"'adjustment' and 'percentage' "
"should be specified."))
action_args['adjustment_type'] = None
action_args['number'] = None