diff --git a/cinder/api/contrib/backups.py b/cinder/api/contrib/backups.py index 84a3e2d3616..200d5a53b53 100644 --- a/cinder/api/contrib/backups.py +++ b/cinder/api/contrib/backups.py @@ -103,7 +103,8 @@ class BackupsController(wsgi.Controller): sort_keys, sort_dirs = common.get_sort_params(filters) show_count = False - if req_version.matches(mv.SUPPORT_COUNT_INFO): + if req_version.matches( + mv.SUPPORT_COUNT_INFO) and 'with_count' in filters: show_count = utils.get_bool_param('with_count', filters) filters.pop('with_count') self._convert_sort_name(req_version, sort_keys) diff --git a/cinder/api/v3/snapshots.py b/cinder/api/v3/snapshots.py index 276967d6c92..2595cf02540 100644 --- a/cinder/api/v3/snapshots.py +++ b/cinder/api/v3/snapshots.py @@ -80,7 +80,8 @@ class SnapshotsController(snapshots_v2.SnapshotsController): req_version = req.api_version_request show_count = False - if req_version.matches(mv.SUPPORT_COUNT_INFO): + if req_version.matches( + mv.SUPPORT_COUNT_INFO) and 'with_count' in search_opts: show_count = utils.get_bool_param('with_count', search_opts) search_opts.pop('with_count') diff --git a/cinder/api/v3/volumes.py b/cinder/api/v3/volumes.py index 4509eeec295..9fc8dc2ccf8 100644 --- a/cinder/api/v3/volumes.py +++ b/cinder/api/v3/volumes.py @@ -99,7 +99,8 @@ class VolumeController(volumes_v2.VolumeController): filters = params show_count = False - if req_version.matches(mv.SUPPORT_COUNT_INFO): + if req_version.matches( + mv.SUPPORT_COUNT_INFO) and 'with_count' in filters: show_count = utils.get_bool_param('with_count', filters) filters.pop('with_count')