diff options
author | Ritesh Paiboina <rsritesh@rediff.com> | 2015-02-09 07:32:36 +0100 |
---|---|---|
committer | Ritesh Paiboina <rsritesh@rediff.com> | 2015-02-10 06:03:09 +0100 |
commit | a0481e1c8008935d34e8f6e2cf896723b5e36f0a (patch) | |
tree | 8fd70a90e7c090e623b8a7a478daee6140dd4c6f /novaclient/v2 | |
parent | 578390ee7e74c0998b9590f0327449ae19a5c8f0 (diff) | |
download | python-novaclient-a0481e1c8008935d34e8f6e2cf896723b5e36f0a.tar.gz |
Add all tenants search opt to del instnce by name
Nova delete command deletes an instance by name
or ID. Nova delete command is able to delete an
instance within the same the tenant by name or
ID. When admin credentials are sourced and try
to delete a non admin tenant instances, nova
delete command is able to delete an instance by
ID only, it is not able to delete an instance by
name.
Nova delete command deletes an instances by id
using following api call
/v2/{tenant_id}/servers/{server_id}
But to delete an instance by name, nova delete
command first find the resources by name using
following api call
/servers?name={server_name}
This api call is not able to retrive the list
of other tenant instances.
Adding all tenants parameter to this api call
will retrive the list of other tenant
instances. The following will be new api
call
/servers?all_tenants=1&name={server_name}
Closes-Bug: #1247030
Change-Id: I03e578d58214c835d9a411752bd618d77ced37ff
Diffstat (limited to 'novaclient/v2')
-rw-r--r-- | novaclient/v2/shell.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 190d07fe..29f26693 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -1876,16 +1876,17 @@ def do_show(cs, args): help=_('Name or ID of server(s).')) def do_delete(cs, args): """Immediately shut down and delete specified server(s).""" + find_args = {'all_tenants': '1'} utils.do_action_on_many( - lambda s: _find_server(cs, s).delete(), + lambda s: _find_server(cs, s, **find_args).delete(), args.server, _("Request to delete server %s has been accepted."), _("Unable to delete the specified server(s).")) -def _find_server(cs, server): +def _find_server(cs, server, **find_args): """Get a server by name or ID.""" - return utils.find_resource(cs.servers, server) + return utils.find_resource(cs.servers, server, **find_args) def _find_image(cs, image): |