Revert "Fix resize flavor for instance"
Story: 2008341
Task: 41244
This reverts commit f859692cc3
.
Change-Id: I690956927fb2558950362d1f223596db92e53d1e
This commit is contained in:
parent
f28390ee5d
commit
3647805c67
|
@ -509,21 +509,24 @@ class ResizeDatabaseInstanceFlavor(command.Command):
|
||||||
help=_('ID or name of the instance')
|
help=_('ID or name of the instance')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'flavor_id',
|
'flavor',
|
||||||
metavar='<flavor_id>',
|
|
||||||
type=str,
|
type=str,
|
||||||
help=_('New flavor ID of the instance')
|
help=_('ID or name of the new flavor.')
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
instance_mgr = self.app.client_manager.database.instances
|
instance_mgr = self.app.client_manager.database.instances
|
||||||
|
flavor_mgr = self.app.client_manager.database.flavors
|
||||||
|
|
||||||
instance_id = parsed_args.instance
|
instance_id = parsed_args.instance
|
||||||
|
|
||||||
if not uuidutils.is_uuid_like(instance_id):
|
if not uuidutils.is_uuid_like(instance_id):
|
||||||
instance_id = osc_utils.find_resource(instance_mgr, instance_id)
|
instance = osc_utils.find_resource(instance_mgr, instance_id)
|
||||||
|
instance_id = instance.id
|
||||||
|
|
||||||
instance_mgr.resize_instance(instance_id, parsed_args.flavor_id)
|
flavor = osc_utils.find_resource(flavor_mgr, parsed_args.flavor)
|
||||||
|
|
||||||
|
instance_mgr.resize_instance(instance_id, flavor.id)
|
||||||
|
|
||||||
|
|
||||||
class UpgradeDatabaseInstance(command.Command):
|
class UpgradeDatabaseInstance(command.Command):
|
||||||
|
|
|
@ -404,14 +404,15 @@ class TestDatabaseInstanceResizeFlavor(TestInstances):
|
||||||
@mock.patch.object(utils, 'find_resource')
|
@mock.patch.object(utils, 'find_resource')
|
||||||
def test_instance_resize_flavor(self, mock_find):
|
def test_instance_resize_flavor(self, mock_find):
|
||||||
args = ['instance1', 'flavor_id']
|
args = ['instance1', 'flavor_id']
|
||||||
mock_find.return_value = 'fake_instance_id'
|
mock_find.side_effect = [
|
||||||
|
mock.MagicMock(id='fake_instance_id'),
|
||||||
|
mock.MagicMock(id='fake_flavor_id')
|
||||||
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, args, [])
|
parsed_args = self.check_parser(self.cmd, args, [])
|
||||||
result = self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
self.instance_client.resize_instance.assert_called_with(
|
self.instance_client.resize_instance.assert_called_with(
|
||||||
'fake_instance_id', 'flavor_id')
|
'fake_instance_id', 'fake_flavor_id')
|
||||||
self.assertIsNone(result)
|
|
||||||
|
|
||||||
|
|
||||||
class TestDatabaseInstanceUpgrade(TestInstances):
|
class TestDatabaseInstanceUpgrade(TestInstances):
|
||||||
|
|
Loading…
Reference in New Issue