Added migration functionality.
This commit is contained in:
parent
cee51f8aff
commit
9b31d54aa2
@ -79,6 +79,7 @@ You'll find complete documentation on the shell by running
|
||||
ipgroup-list Show IP groups.
|
||||
ipgroup-show Show details about a particular IP group.
|
||||
list List active servers.
|
||||
migrate Migrate a server to a new host in the same zone.
|
||||
reboot Reboot a server.
|
||||
rebuild Shutdown, re-image, and re-boot a server.
|
||||
rename Rename a server.
|
||||
|
@ -166,6 +166,12 @@ class Server(base.Resource):
|
||||
"""
|
||||
self.manager.revert_resize(self)
|
||||
|
||||
def migrate(self):
|
||||
"""
|
||||
Migrate a server to a new host in the same zone.
|
||||
"""
|
||||
self.manager.migrate(self)
|
||||
|
||||
@property
|
||||
def backup_schedule(self):
|
||||
"""
|
||||
@ -432,6 +438,14 @@ class ServerManager(base.BootingManagerWithFind):
|
||||
"""
|
||||
self._action('revertResize', server)
|
||||
|
||||
def migrate(self, server):
|
||||
"""
|
||||
Migrate a server to a new host in the same zone.
|
||||
|
||||
:param server: The :class:`Server` (or its ID).
|
||||
"""
|
||||
self._action('migrate', server)
|
||||
|
||||
def _action(self, action, server, info=None):
|
||||
"""
|
||||
Perform a server "action" -- reboot/rebuild/resize/etc.
|
||||
|
@ -622,6 +622,11 @@ class OpenStackShell(object):
|
||||
flavor = self._find_flavor(args.flavor)
|
||||
server.resize(flavor)
|
||||
|
||||
@arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
def do_migrate(self, args):
|
||||
"""Migrate a server."""
|
||||
self._find_server(args.server).migrate()
|
||||
|
||||
@arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
def do_pause(self, args):
|
||||
"""Pause a server."""
|
||||
|
@ -273,6 +273,8 @@ class FakeClient(OpenStackClient):
|
||||
return (204, None)
|
||||
elif action == 'revertResize':
|
||||
assert_equal(body[action], None)
|
||||
elif action == 'migrate':
|
||||
assert_equal(body[action], None)
|
||||
else:
|
||||
fail("Unexpected server action: %s" % action)
|
||||
return (202, None)
|
||||
|
@ -148,3 +148,10 @@ def test_revert_resized_server():
|
||||
cs.assert_called('POST', '/servers/1234/action')
|
||||
cs.servers.revert_resize(s)
|
||||
cs.assert_called('POST', '/servers/1234/action')
|
||||
|
||||
def test_migrate_server():
|
||||
s = cs.servers.get(1234)
|
||||
s.migrate()
|
||||
cs.assert_called('POST', '/servers/1234/action')
|
||||
cs.servers.migrate(s)
|
||||
cs.assert_called('POST', '/servers/1234/action')
|
||||
|
Loading…
x
Reference in New Issue
Block a user