Add the parameter service-id for service cleanup command

There isn't service_id param in cinderclient. We have this param
in cinder, so add this param in the cinderclient.

Change-Id: I579741595f91802bcf117029889567f234b5b14c
Closes-bug: #1771721
This commit is contained in:
liuyamin 2018-05-17 14:48:54 +08:00
parent a45faf0f47
commit eafde59a3e
2 changed files with 12 additions and 3 deletions
cinderclient
tests/unit/v3
v3

@ -1264,13 +1264,15 @@ class ShellTest(utils.TestCase):
self.run_command('--os-volume-api-version 3.24 '
'work-cleanup --cluster clustername --host hostname '
'--binary binaryname --is-up false --disabled true '
'--resource-id uuid --resource-type Volume')
'--resource-id uuid --resource-type Volume '
'--service-id 1')
expected = {'cluster_name': 'clustername',
'host': 'hostname',
'binary': 'binaryname',
'is_up': 'false',
'disabled': 'true',
'resource_id': 'uuid',
'resource_type': 'Volume'}
'resource_type': 'Volume',
'service_id': 1}
self.assert_called('POST', '/workers/cleanup', body=expected)

@ -1080,12 +1080,19 @@ def do_cluster_disable(cs, args):
@utils.arg('--resource-type', metavar='<Volume|Snapshot>', default=None,
choices=('Volume', 'Snapshot'),
help='Type of resource to cleanup.')
@utils.arg('--service-id',
metavar='<service-id>',
type=int,
default=None,
help='The service id field from the DB, not the uuid of the'
' service. Default=None.')
def do_work_cleanup(cs, args):
"""Request cleanup of services with optional filtering."""
filters = dict(cluster_name=args.cluster, host=args.host,
binary=args.binary, is_up=args.is_up,
disabled=args.disabled, resource_id=args.resource_id,
resource_type=args.resource_type)
resource_type=args.resource_type,
service_id=args.service_id)
filters = {k: v for k, v in filters.items() if v is not None}