Fix faulthy state argument choice

The correct state name for a failing volume snapshot deletion is
'error_deleting' instead of 'error-deleting'. [1]

[1] 89d6a5042f/cinder/objects/fields.py (L126)

Task: #37844
Story: #2007037

Change-Id: Ia99900ece4f1cd29769b22ddaa3965789d719556
This commit is contained in:
Bram Verschueren
2019-12-13 11:13:54 +01:00
parent 5b3a827a1f
commit 69870ae439
5 changed files with 25 additions and 7 deletions

View File

@@ -115,7 +115,7 @@ List volume snapshots
.. option:: --status <status> .. option:: --status <status>
Filters results by a status. Filters results by a status.
('available', 'error', 'creating', 'deleting' or 'error-deleting') ('available', 'error', 'creating', 'deleting' or 'error_deleting')
.. option:: --name <name> .. option:: --name <name>

View File

@@ -121,6 +121,24 @@ class VolumeSnapshotTests(common.BaseVolumeTests):
cmd_output["size"], cmd_output["size"],
) )
self.wait_for_status('volume snapshot', name2, 'available') self.wait_for_status('volume snapshot', name2, 'available')
raw_output = self.openstack(
'volume snapshot set ' +
'--state error_deleting ' +
name2
)
self.assertOutput('', raw_output)
# Test list --long, --status
cmd_output = json.loads(self.openstack(
'volume snapshot list -f json ' +
'--long ' +
'--status error_deleting'
))
names = [x["Name"] for x in cmd_output]
self.assertNotIn(name1, names)
self.assertIn(name2, names)
raw_output = self.openstack( raw_output = self.openstack(
'volume snapshot set ' + 'volume snapshot set ' +
'--state error ' + '--state error ' +

View File

@@ -175,10 +175,10 @@ class ListVolumeSnapshot(command.Lister):
'--status', '--status',
metavar='<status>', metavar='<status>',
choices=['available', 'error', 'creating', 'deleting', choices=['available', 'error', 'creating', 'deleting',
'error-deleting'], 'error_deleting'],
help=_("Filters results by a status. " help=_("Filters results by a status. "
"('available', 'error', 'creating', 'deleting'" "('available', 'error', 'creating', 'deleting'"
" or 'error-deleting')") " or 'error_deleting')")
) )
parser.add_argument( parser.add_argument(
'--volume', '--volume',

View File

@@ -129,7 +129,7 @@ class ListConsistencyGroupSnapshot(command.Lister):
'--status', '--status',
metavar="<status>", metavar="<status>",
choices=['available', 'error', 'creating', 'deleting', choices=['available', 'error', 'creating', 'deleting',
'error-deleting'], 'error_deleting'],
help=_('Filters results by a status ("available", "error", ' help=_('Filters results by a status ("available", "error", '
'"creating", "deleting" or "error_deleting")') '"creating", "deleting" or "error_deleting")')
) )

View File

@@ -230,10 +230,10 @@ class ListVolumeSnapshot(command.Lister):
'--status', '--status',
metavar='<status>', metavar='<status>',
choices=['available', 'error', 'creating', 'deleting', choices=['available', 'error', 'creating', 'deleting',
'error-deleting'], 'error_deleting'],
help=_("Filters results by a status. " help=_("Filters results by a status. "
"('available', 'error', 'creating', 'deleting'" "('available', 'error', 'creating', 'deleting'"
" or 'error-deleting')") " or 'error_deleting')")
) )
parser.add_argument( parser.add_argument(
'--volume', '--volume',
@@ -345,7 +345,7 @@ class SetVolumeSnapshot(command.Command):
'--state', '--state',
metavar='<state>', metavar='<state>',
choices=['available', 'error', 'creating', 'deleting', choices=['available', 'error', 'creating', 'deleting',
'error-deleting'], 'error_deleting'],
help=_('New snapshot state. ("available", "error", "creating", ' help=_('New snapshot state. ("available", "error", "creating", '
'"deleting", or "error_deleting") (admin only) ' '"deleting", or "error_deleting") (admin only) '
'(This option simply changes the state of the snapshot ' '(This option simply changes the state of the snapshot '