Skip to content

Commit 609988e

Browse files
stephenfinDean Troyer
authored andcommitted
Add 'openstack server migrate (confirm|revert)' commands
While cold migration and resize are essentially the same operation under the hood, meaning one could use the 'openstack server resize confirm' and 'openstack server resize revert' commands instead, there is no reason the operator needs to know this. Add these flags as syntactic sugar to help simplify operators lives. The help texts for both the 'openstack server resize' and 'openstack server migrate' commands are updated to clarify the relationship between the two operations. Change-Id: I0cb6304c794bffaec785add9f7b8cf53ab28cacd Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent a15e474 commit 609988e

3 files changed

Lines changed: 34 additions & 5 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,15 @@ def take_action(self, parsed_args):
15551555
# then adding the groups doesn't seem to work
15561556

15571557
class MigrateServer(command.Command):
1558-
_description = _("Migrate server to different host")
1558+
_description = _("""Migrate server to different host.
1559+
1560+
A migrate operation is implemented as a resize operation using the same flavor
1561+
as the old server. This means that, like resize, migrate works by creating a
1562+
new server using the same flavor and copying the contents of the original disk
1563+
into a new one. As with resize, the migrate operation is a two-step process for
1564+
the user: the first step is to perform the migrate, and the second step is to
1565+
either confirm (verify) success and release the old server, or to declare a
1566+
revert to release the new server and restart the old one.""")
15591567

15601568
def get_parser(self, prog_name):
15611569
parser = super(MigrateServer, self).get_parser(prog_name)
@@ -2159,10 +2167,10 @@ class ResizeServer(command.Command):
21592167
_description = _("""Scale server to a new flavor.
21602168
21612169
A resize operation is implemented by creating a new server and copying the
2162-
contents of the original disk into a new one. It is also a two-step process for
2163-
the user: the first is to perform the resize, the second is to either confirm
2164-
(verify) success and release the old server, or to declare a revert to release
2165-
the new server and restart the old one.""")
2170+
contents of the original disk into a new one. It is a two-step process for the
2171+
user: the first step is to perform the resize, and the second step is to either
2172+
confirm (verify) success and release the old server or to declare a revert to
2173+
release the new server and restart the old one.""")
21662174

21672175
def get_parser(self, prog_name):
21682176
parser = super(ResizeServer, self).get_parser(prog_name)
@@ -2261,6 +2269,12 @@ def take_action(self, parsed_args):
22612269
server.confirm_resize()
22622270

22632271

2272+
class MigrateConfirm(ResizeConfirm):
2273+
_description = _("""Confirm server migrate.
2274+
2275+
Confirm (verify) success of migrate operation and release the old server.""")
2276+
2277+
22642278
class ResizeRevert(command.Command):
22652279
_description = _("""Revert server resize.
22662280
@@ -2286,6 +2300,13 @@ def take_action(self, parsed_args):
22862300
server.revert_resize()
22872301

22882302

2303+
class MigrateRevert(ResizeRevert):
2304+
_description = _("""Revert server migrate.
2305+
2306+
Revert the migrate operation. Release the new server and restart the old
2307+
one.""")
2308+
2309+
22892310
class RestoreServer(command.Command):
22902311
_description = _("Restore server(s)")
22912312

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Add ``server migrate confirm`` and ``server migrate revert`` commands.
5+
These are aliases of the ``server resize confirm`` and ``server resize revert``
6+
commands, respectively.

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ openstack.compute.v2 =
108108
server_list = openstackclient.compute.v2.server:ListServer
109109
server_lock = openstackclient.compute.v2.server:LockServer
110110
server_migrate = openstackclient.compute.v2.server:MigrateServer
111+
server_migrate_confirm = openstackclient.compute.v2.server:MigrateConfirm
112+
server_migrate_revert = openstackclient.compute.v2.server:MigrateRevert
111113
server_pause = openstackclient.compute.v2.server:PauseServer
112114
server_reboot = openstackclient.compute.v2.server:RebootServer
113115
server_rebuild = openstackclient.compute.v2.server:RebuildServer

0 commit comments

Comments
 (0)