compute: Rename 'server migrate (confirm|revert)'
We're confirming or reverting a server migration, not a server migrate. We've a number of 'server migration *' commands now so it makes sense to move them under here. Change-Id: Ib95bb36511dad1aafe75f0c88d10ded382e4fa5c Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
f80fe2d8cf
commit
a52beacaa6
@ -3559,10 +3559,27 @@ Confirm (verify) success of resize operation and release the old server.""")
|
||||
server.confirm_resize()
|
||||
|
||||
|
||||
# TODO(stephenfin): Remove in OSC 7.0
|
||||
class MigrateConfirm(ResizeConfirm):
|
||||
_description = _("""Confirm server migrate.
|
||||
_description = _("""DEPRECATED: Confirm server migration.
|
||||
|
||||
Confirm (verify) success of migrate operation and release the old server.""")
|
||||
Use 'server migration confirm' instead.""")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
msg = _(
|
||||
"The 'server migrate confirm' command has been deprecated in "
|
||||
"favour of the 'server migration confirm' command."
|
||||
)
|
||||
self.log.warning(msg)
|
||||
|
||||
super().take_action(parsed_args)
|
||||
|
||||
|
||||
class ConfirmMigration(ResizeConfirm):
|
||||
_description = _("""Confirm server migration.
|
||||
|
||||
Confirm (verify) success of the migration operation and release the old
|
||||
server.""")
|
||||
|
||||
|
||||
class ResizeRevert(command.Command):
|
||||
@ -3590,10 +3607,26 @@ one.""")
|
||||
server.revert_resize()
|
||||
|
||||
|
||||
# TODO(stephenfin): Remove in OSC 7.0
|
||||
class MigrateRevert(ResizeRevert):
|
||||
_description = _("""Revert server migrate.
|
||||
_description = _("""Revert server migration.
|
||||
|
||||
Revert the migrate operation. Release the new server and restart the old
|
||||
Use 'server migration revert' instead.""")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
msg = _(
|
||||
"The 'server migrate revert' command has been deprecated in "
|
||||
"favour of the 'server migration revert' command."
|
||||
)
|
||||
self.log.warning(msg)
|
||||
|
||||
super().take_action(parsed_args)
|
||||
|
||||
|
||||
class RevertMigration(ResizeRevert):
|
||||
_description = _("""Revert server migration.
|
||||
|
||||
Revert the migration operation. Release the new server and restart the old
|
||||
one.""")
|
||||
|
||||
|
||||
|
@ -6401,6 +6401,82 @@ class TestServerResizeConfirm(TestServer):
|
||||
self.server.confirm_resize.assert_called_with()
|
||||
|
||||
|
||||
# TODO(stephenfin): Remove in OSC 7.0
|
||||
class TestServerMigrateConfirm(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
methods = {
|
||||
'confirm_resize': None,
|
||||
}
|
||||
self.server = compute_fakes.FakeServer.create_one_server(
|
||||
methods=methods)
|
||||
|
||||
# This is the return value for utils.find_resource()
|
||||
self.servers_mock.get.return_value = self.server
|
||||
|
||||
self.servers_mock.confirm_resize.return_value = None
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server.MigrateConfirm(self.app, None)
|
||||
|
||||
def test_migrate_confirm(self):
|
||||
arglist = [
|
||||
self.server.id,
|
||||
]
|
||||
verifylist = [
|
||||
('server', self.server.id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
with mock.patch.object(self.cmd.log, 'warning') as mock_warning:
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.servers_mock.get.assert_called_with(self.server.id)
|
||||
self.server.confirm_resize.assert_called_with()
|
||||
|
||||
mock_warning.assert_called_once()
|
||||
self.assertIn(
|
||||
"The 'server migrate confirm' command has been deprecated",
|
||||
str(mock_warning.call_args[0][0])
|
||||
)
|
||||
|
||||
|
||||
class TestServerConfirmMigration(TestServerResizeConfirm):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
methods = {
|
||||
'confirm_resize': None,
|
||||
}
|
||||
self.server = compute_fakes.FakeServer.create_one_server(
|
||||
methods=methods)
|
||||
|
||||
# This is the return value for utils.find_resource()
|
||||
self.servers_mock.get.return_value = self.server
|
||||
|
||||
self.servers_mock.confirm_resize.return_value = None
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server.ConfirmMigration(self.app, None)
|
||||
|
||||
def test_migration_confirm(self):
|
||||
arglist = [
|
||||
self.server.id,
|
||||
]
|
||||
verifylist = [
|
||||
('server', self.server.id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.servers_mock.get.assert_called_with(self.server.id)
|
||||
self.server.confirm_resize.assert_called_with()
|
||||
|
||||
|
||||
class TestServerResizeRevert(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
@ -6435,6 +6511,82 @@ class TestServerResizeRevert(TestServer):
|
||||
self.server.revert_resize.assert_called_with()
|
||||
|
||||
|
||||
# TODO(stephenfin): Remove in OSC 7.0
|
||||
class TestServerMigrateRevert(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
methods = {
|
||||
'revert_resize': None,
|
||||
}
|
||||
self.server = compute_fakes.FakeServer.create_one_server(
|
||||
methods=methods)
|
||||
|
||||
# This is the return value for utils.find_resource()
|
||||
self.servers_mock.get.return_value = self.server
|
||||
|
||||
self.servers_mock.revert_resize.return_value = None
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server.MigrateRevert(self.app, None)
|
||||
|
||||
def test_migrate_revert(self):
|
||||
arglist = [
|
||||
self.server.id,
|
||||
]
|
||||
verifylist = [
|
||||
('server', self.server.id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
with mock.patch.object(self.cmd.log, 'warning') as mock_warning:
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.servers_mock.get.assert_called_with(self.server.id)
|
||||
self.server.revert_resize.assert_called_with()
|
||||
|
||||
mock_warning.assert_called_once()
|
||||
self.assertIn(
|
||||
"The 'server migrate revert' command has been deprecated",
|
||||
str(mock_warning.call_args[0][0])
|
||||
)
|
||||
|
||||
|
||||
class TestServerRevertMigration(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
methods = {
|
||||
'revert_resize': None,
|
||||
}
|
||||
self.server = compute_fakes.FakeServer.create_one_server(
|
||||
methods=methods)
|
||||
|
||||
# This is the return value for utils.find_resource()
|
||||
self.servers_mock.get.return_value = self.server
|
||||
|
||||
self.servers_mock.revert_resize.return_value = None
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server.RevertMigration(self.app, None)
|
||||
|
||||
def test_migration_revert(self):
|
||||
arglist = [
|
||||
self.server.id,
|
||||
]
|
||||
verifylist = [
|
||||
('server', self.server.id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.servers_mock.get.assert_called_with(self.server.id)
|
||||
self.server.revert_resize.assert_called_with()
|
||||
|
||||
|
||||
class TestServerRestore(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The ``server migrate confirm`` and ``server migrate revert`` commands,
|
||||
introduced in OSC 5.0, have been deprecated in favour of
|
||||
``server migration confirm`` and ``server migration revert`` respectively.
|
||||
The deprecated commands will be removed in a future major version.
|
@ -111,8 +111,10 @@ openstack.compute.v2 =
|
||||
server_migrate_confirm = openstackclient.compute.v2.server:MigrateConfirm
|
||||
server_migrate_revert = openstackclient.compute.v2.server:MigrateRevert
|
||||
server_migration_abort = openstackclient.compute.v2.server:AbortMigration
|
||||
server_migration_confirm = openstackclient.compute.v2.server:ConfirmMigration
|
||||
server_migration_force_complete = openstackclient.compute.v2.server:ForceCompleteMigration
|
||||
server_migration_list = openstackclient.compute.v2.server:ListMigration
|
||||
server_migration_revert = openstackclient.compute.v2.server:RevertMigration
|
||||
server_migration_show = openstackclient.compute.v2.server:ShowMigration
|
||||
server_pause = openstackclient.compute.v2.server:PauseServer
|
||||
server_reboot = openstackclient.compute.v2.server:RebootServer
|
||||
|
Loading…
Reference in New Issue
Block a user