Merge "Fix find volume for migrate command"

This commit is contained in:
Jenkins 2013-10-03 23:25:32 +00:00 committed by Gerrit Code Review
commit 5e925f8fd3
4 changed files with 17 additions and 2 deletions

@ -260,3 +260,9 @@ class ShellTest(utils.TestCase):
Test encryption-type-delete shell command.
"""
self.skipTest("Not implemented")
def test_migrate_volume(self):
self.run_command('migrate 1234 fakehost --force-host-copy=True')
expected = {'os-migrate_volume': {'force_host_copy': 'True',
'host': 'fakehost'}}
self.assert_called('POST', '/volumes/1234/action', body=expected)

@ -238,3 +238,9 @@ class ShellTest(utils.TestCase):
Test encryption-type-delete shell command.
"""
self.skipTest("Not implemented")
def test_migrate_volume(self):
self.run_command('migrate 1234 fakehost --force-host-copy=True')
expected = {'os-migrate_volume': {'force_host_copy': 'True',
'host': 'fakehost'}}
self.assert_called('POST', '/volumes/1234/action', body=expected)

@ -1065,6 +1065,7 @@ def do_encryption_type_create(cs, args):
@utils.arg('volume', metavar='<volume>', help='ID of the volume to migrate')
@utils.arg('host', metavar='<host>', help='Destination host')
@utils.arg('--force-host-copy', metavar='<True|False>',
choices=['True', 'False'], required=False,
help='Optional flag to force the use of the generic '
'host-based migration mechanism, bypassing driver '
'optimizations (Default=False).',
@ -1072,7 +1073,8 @@ def do_encryption_type_create(cs, args):
@utils.service_type('volume')
def do_migrate(cs, args):
"""Migrate the volume to the new host."""
volume = _find_volume(cs, args.volume)
volume = utils.find_volume(cs, args.volume)
volume.migrate_volume(args.host, args.force_host_copy)

@ -805,6 +805,7 @@ def do_upload_to_image(cs, args):
@utils.arg('volume', metavar='<volume>', help='ID of the volume to migrate')
@utils.arg('host', metavar='<host>', help='Destination host')
@utils.arg('--force-host-copy', metavar='<True|False>',
choices=['True', 'False'], required=False,
help='Optional flag to force the use of the generic '
'host-based migration mechanism, bypassing driver '
'optimizations (Default=False).',
@ -812,7 +813,7 @@ def do_upload_to_image(cs, args):
@utils.service_type('volumev2')
def do_migrate(cs, args):
"""Migrate the volume to the new host."""
volume = _find_volume(cs, args.volume)
volume = utils.find_volume(cs, args.volume)
volume.migrate_volume(args.host, args.force_host_copy)