Skip to content

Commit 69870ae

Browse files
committed
Fix faulthy state argument choice
The correct state name for a failing volume snapshot deletion is 'error_deleting' instead of 'error-deleting'. [1] [1] https://opendev.org/openstack/cinder/src/commit/89d6a5042fcb2ede5a0b1112d72fae805ea52fcd/cinder/objects/fields.py#L126 Task: #37844 Story: #2007037 Change-Id: Ia99900ece4f1cd29769b22ddaa3965789d719556
1 parent 5b3a827 commit 69870ae

5 files changed

Lines changed: 25 additions & 7 deletions

File tree

doc/source/cli/command-objects/volume-snapshot.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ List volume snapshots
115115
.. option:: --status <status>
116116
117117
Filters results by a status.
118-
('available', 'error', 'creating', 'deleting' or 'error-deleting')
118+
('available', 'error', 'creating', 'deleting' or 'error_deleting')
119119
120120
.. option:: --name <name>
121121

openstackclient/tests/functional/volume/v2/test_volume_snapshot.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,24 @@ def test_volume_snapshot_list(self):
121121
cmd_output["size"],
122122
)
123123
self.wait_for_status('volume snapshot', name2, 'available')
124+
125+
raw_output = self.openstack(
126+
'volume snapshot set ' +
127+
'--state error_deleting ' +
128+
name2
129+
)
130+
self.assertOutput('', raw_output)
131+
132+
# Test list --long, --status
133+
cmd_output = json.loads(self.openstack(
134+
'volume snapshot list -f json ' +
135+
'--long ' +
136+
'--status error_deleting'
137+
))
138+
names = [x["Name"] for x in cmd_output]
139+
self.assertNotIn(name1, names)
140+
self.assertIn(name2, names)
141+
124142
raw_output = self.openstack(
125143
'volume snapshot set ' +
126144
'--state error ' +

openstackclient/volume/v1/volume_snapshot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ def get_parser(self, prog_name):
175175
'--status',
176176
metavar='<status>',
177177
choices=['available', 'error', 'creating', 'deleting',
178-
'error-deleting'],
178+
'error_deleting'],
179179
help=_("Filters results by a status. "
180180
"('available', 'error', 'creating', 'deleting'"
181-
" or 'error-deleting')")
181+
" or 'error_deleting')")
182182
)
183183
parser.add_argument(
184184
'--volume',

openstackclient/volume/v2/consistency_group_snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def get_parser(self, prog_name):
129129
'--status',
130130
metavar="<status>",
131131
choices=['available', 'error', 'creating', 'deleting',
132-
'error-deleting'],
132+
'error_deleting'],
133133
help=_('Filters results by a status ("available", "error", '
134134
'"creating", "deleting" or "error_deleting")')
135135
)

openstackclient/volume/v2/volume_snapshot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ def get_parser(self, prog_name):
230230
'--status',
231231
metavar='<status>',
232232
choices=['available', 'error', 'creating', 'deleting',
233-
'error-deleting'],
233+
'error_deleting'],
234234
help=_("Filters results by a status. "
235235
"('available', 'error', 'creating', 'deleting'"
236-
" or 'error-deleting')")
236+
" or 'error_deleting')")
237237
)
238238
parser.add_argument(
239239
'--volume',
@@ -345,7 +345,7 @@ def get_parser(self, prog_name):
345345
'--state',
346346
metavar='<state>',
347347
choices=['available', 'error', 'creating', 'deleting',
348-
'error-deleting'],
348+
'error_deleting'],
349349
help=_('New snapshot state. ("available", "error", "creating", '
350350
'"deleting", or "error_deleting") (admin only) '
351351
'(This option simply changes the state of the snapshot '

0 commit comments

Comments
 (0)