Remove invalid 'unlock-volume' migration arg

There is an optional flag that can be passed in to a
volume migration to tell Cinder to 'lock' a volume so
no other process can abort the migration. This is
reflected correctly with the --lock-volume argument
flag to `openstack volume migrate`, but there is
another --unlock-volume flag that is shown in the help
text for this command that does not do anything and is
not used anywhere.

Since there is no action to "unlock" a volume, this
just causes confusion - including for Cinder developers
that know this API. To avoid confusion, this invalid
flag should just be removed from the command.

Change-Id: I5f111ed58803a1bf5d34e828341d735099247108
This commit is contained in:
Sean McGinnis 2018-04-04 14:56:27 -05:00
parent 06263bd585
commit f00ffebea6
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
4 changed files with 7 additions and 41 deletions

View File

@ -226,7 +226,7 @@ Migrate volume to a new host
openstack volume migrate openstack volume migrate
--host <host> --host <host>
[--force-host-copy] [--force-host-copy]
[--lock-volume | --unlock-volume] [--lock-volume]
<volume> <volume>
.. option:: --host <host> .. option:: --host <host>
@ -245,13 +245,6 @@ Migrate volume to a new host
*Volume version 2 only* *Volume version 2 only*
.. option:: --unlock-volume
If specified, the volume state will not be locked and the a
migration can be aborted (default) (possibly by another operation)
*Volume version 2 only*
.. _volume_migrate-volume: .. _volume_migrate-volume:
.. describe:: <volume> .. describe:: <volume>

View File

@ -1320,7 +1320,6 @@ class TestVolumeMigrate(TestVolume):
verifylist = [ verifylist = [
("force_host_copy", False), ("force_host_copy", False),
("lock_volume", False), ("lock_volume", False),
("unlock_volume", False),
("host", "host@backend-name#pool"), ("host", "host@backend-name#pool"),
("volume", self._volume.id), ("volume", self._volume.id),
] ]
@ -1342,7 +1341,6 @@ class TestVolumeMigrate(TestVolume):
verifylist = [ verifylist = [
("force_host_copy", True), ("force_host_copy", True),
("lock_volume", True), ("lock_volume", True),
("unlock_volume", False),
("host", "host@backend-name#pool"), ("host", "host@backend-name#pool"),
("volume", self._volume.id), ("volume", self._volume.id),
] ]
@ -1354,27 +1352,6 @@ class TestVolumeMigrate(TestVolume):
self._volume.id, "host@backend-name#pool", True, True) self._volume.id, "host@backend-name#pool", True, True)
self.assertIsNone(result) self.assertIsNone(result)
def test_volume_migrate_with_unlock_volume(self):
arglist = [
"--unlock-volume",
"--host", "host@backend-name#pool",
self._volume.id,
]
verifylist = [
("force_host_copy", False),
("lock_volume", False),
("unlock_volume", True),
("host", "host@backend-name#pool"),
("volume", self._volume.id),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
self.volumes_mock.get.assert_called_once_with(self._volume.id)
self.volumes_mock.migrate_volume.assert_called_once_with(
self._volume.id, "host@backend-name#pool", False, False)
self.assertIsNone(result)
def test_volume_migrate_without_host(self): def test_volume_migrate_without_host(self):
arglist = [ arglist = [
self._volume.id, self._volume.id,
@ -1382,7 +1359,6 @@ class TestVolumeMigrate(TestVolume):
verifylist = [ verifylist = [
("force_host_copy", False), ("force_host_copy", False),
("lock_volume", False), ("lock_volume", False),
("unlock_volume", False),
("volume", self._volume.id), ("volume", self._volume.id),
] ]

View File

@ -472,21 +472,13 @@ class MigrateVolume(command.Command):
help=_("Enable generic host-based force-migration, " help=_("Enable generic host-based force-migration, "
"which bypasses driver optimizations") "which bypasses driver optimizations")
) )
lock_group = parser.add_mutually_exclusive_group() parser.add_argument(
lock_group.add_argument(
'--lock-volume', '--lock-volume',
action="store_true", action="store_true",
help=_("If specified, the volume state will be locked " help=_("If specified, the volume state will be locked "
"and will not allow a migration to be aborted " "and will not allow a migration to be aborted "
"(possibly by another operation)") "(possibly by another operation)")
) )
lock_group.add_argument(
'--unlock-volume',
action="store_true",
help=_("If specified, the volume state will not be "
"locked and the a migration can be aborted "
"(default) (possibly by another operation)")
)
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
The ``volume migrate --unlock`` argument did not actually do anything and
has now been removed.