Bug 2216468 - openstack volume snapshot list --state should be using error_deleting but is using error-deleting
Summary: openstack volume snapshot list --state should be using error_deleting but is ...
Keywords:
Status: NEW
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-openstackclient
Version: 16.2 (Train)
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Cinder Bugs List
QA Contact: Nobody
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-21 14:14 UTC by coldford@redhat.com
Modified: 2023-08-01 12:28 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker OSP-25945 0 None None None 2023-06-21 14:17:26 UTC

Description coldford@redhat.com 2023-06-21 14:14:46 UTC
Description of problem:

$ openstack volume snapshot list --state should be using error_deleting but is using error-deleting.

Here we see volume snapshots with the status error_deleting:

(overcloud) [stack@director ~]$ openstack volume snapshot list  --all-projects | grep error_deleting
| bac27b54-b468-4e52-a30a-514066359199 | TrilioVaultSnapshot-534ab6fe-a3b5-41fa-873e-99a172dd9c24                        | TrilioVault initiated snapshot     | error_deleting |  5537 |

But when we check for that status we get the following:

(overcloud) [stack@director ~]$ openstack volume snapshot list  --all-projects --status error_deleting

usage: openstack volume snapshot list [-h] [-f {csv,json,table,value,yaml}]
                                      [-c COLUMN]
                                      [--quote {all,minimal,none,nonnumeric}]
                                      [--noindent] [--max-width <integer>]
                                      [--fit-width] [--print-empty]
                                      [--sort-column SORT_COLUMN]
                                      [--all-projects] [--project <project>]
                                      [--project-domain <project-domain>]
                                      [--long] [--marker <volume-snapshot>]
                                      [--limit <num-snapshots>]
                                      [--name <name>] [--status <status>]
                                      [--volume <volume>]
openstack volume snapshot list: error: argument --status: invalid choice: 'error_deleting' (choose from 'available', 'error', 'creating', 'deleting', 'error-deleting')

If we try with the suggested error-deleting we get no matches:

(overcloud) [stack@director ~]$ openstack volume snapshot list  --all-projects --status error-deleting
(overcloud) [stack@director ~]$

It seems the latest version python3-openstackclient-4.0.2-2.20221012154730.54bf2c0.el8ost.noarch.rpm for RHOSP 16.2 has this bug in both the API v1 and v2 code paths:

./usr/lib/python3.6/site-packages/openstackclient/volume/v1/volume_snapshot.py
./usr/lib/python3.6/site-packages/openstackclient/volume/v2/volume_snapshot.py

// EXAMPLE:
class ListVolumeSnapshot(command.Lister):
    _description = _("List volume snapshots")

    def get_parser(self, prog_name):
        parser = super(ListVolumeSnapshot, self).get_parser(prog_name)
        parser.add_argument(
            '--all-projects',
            action='store_true',
            default=False,
            help=_('Include all projects (admin only)'),
        )
        parser.add_argument(
            '--long', 
            action='store_true',
            default=False,
            help=_('List additional fields in output'),
        )
        parser.add_argument(
            '--name',
            metavar='<name>',
            default=None,
            help=_('Filters results by a name.')
        )
        parser.add_argument(
            '--status',
            metavar='<status>', 
            choices=['available', 'error', 'creating', 'deleting',
                     'error-deleting'],                                             <------ INCORRECT
            help=_("Filters results by a status. "
                   "('available', 'error', 'creating', 'deleting'"
                   " or 'error-deleting')")                                         <------ INCORRECT
        )
        parser.add_argument(
            '--volume',
            metavar='<volume>',
            default=None,
            help=_('Filters results by a volume (name or ID).')
        )
        return parser



Version-Release number of selected component (if applicable):
python3-openstackclient-4.0.2-2.20221012154730.54bf2c0.el8ost.noarch.rpm

How reproducible:

Every execution of:
- openstack volume snapshot list --state error_deleting

Expected results:

It should match the error_deleting state of the volumes of interest.

This seems to be fixed both upstream and in the beta rpm:
- python3-openstackclient-5.5.2-1.20230404121004.42d9b6e.el9ost.noarch.rpm

class ListVolumeSnapshot(command.Lister):
    _description = _("List volume snapshots")

    def get_parser(self, prog_name):
        parser = super(ListVolumeSnapshot, self).get_parser(prog_name)
        parser.add_argument(
            '--all-projects',
            action='store_true',
            default=False,
            help=_('Include all projects (admin only)'),
        )
        parser.add_argument(
            '--long',
            action='store_true',
            default=False,
            help=_('List additional fields in output'),
        )
        parser.add_argument(
            '--name',
            metavar='<name>', 
            default=None,
            help=_('Filters results by a name.')
        )
        parser.add_argument(
            '--status',
            metavar='<status>',
            choices=['available', 'error', 'creating', 'deleting', 
                     'error_deleting'],                                                <----- CORRECT
            help=_("Filters results by a status. "
                   "('available', 'error', 'creating', 'deleting'"
                   " or 'error_deleting')")                                            <----- CORRECT


Additional info:
- None.


Note You need to log in before you can comment on or make changes to this bug.