summaryrefslogtreecommitdiff
path: root/cinderclient
diff options
context:
space:
mode:
authorliuyamin <liuyamin@fiberhome.com>2018-05-17 14:48:54 +0800
committerliuyamin <liuyamin@fiberhome.com>2018-05-25 03:26:58 +0000
commiteafde59a3ed028d460e1b449cf50e16f032c94fa (patch)
treec794efa9200f50e68410a727d6afc58f9c40d8c4 /cinderclient
parenta45faf0f47111023c78f70843fe3e9ac912add43 (diff)
downloadpython-cinderclient-eafde59a3ed028d460e1b449cf50e16f032c94fa.tar.gz
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
Diffstat (limited to 'cinderclient')
-rw-r--r--cinderclient/tests/unit/v3/test_shell.py6
-rw-r--r--cinderclient/v3/shell.py9
2 files changed, 12 insertions, 3 deletions
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py
index 84ca4cb..16af0c2 100644
--- a/cinderclient/tests/unit/v3/test_shell.py
+++ b/cinderclient/tests/unit/v3/test_shell.py
@@ -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)
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index f012cc8..8445d24 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -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}