Add support for triggering an crash dump
The triggering crash dump feature is supported by nova [1] and novaclient [2] now, it's time to introduce this feature into OSC correspondingly. [1]The change id is: I6ed777ff637254b4b79417008f9055dd19fc7405 [2]The change id is: If03b1864bbe7074c720b946fc2700bd5d07debc3 Change-Id: I5a411f283fdf0fc3c00380d069848a332c799cdd Closes-Bug: #1538372 Co-Authored-By: Tang Chen <chen.tang@easystack.cn>
This commit is contained in:
parent
42b607edf1
commit
6b3583ab06
@ -168,6 +168,25 @@ Delete server(s)
|
|||||||
|
|
||||||
Server(s) to delete (name or ID)
|
Server(s) to delete (name or ID)
|
||||||
|
|
||||||
|
server dump create
|
||||||
|
------------------
|
||||||
|
Create a dump file in server(s)
|
||||||
|
|
||||||
|
Trigger crash dump in server(s) with features like kdump in Linux. It will
|
||||||
|
create a dump file in the server(s) dumping the server(s)' memory, and also
|
||||||
|
crash the server(s). OSC sees the dump file (server dump) as a kind of
|
||||||
|
resource.
|
||||||
|
|
||||||
|
.. program:: server dump create
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
os server dump create
|
||||||
|
<server> [<server> ...]
|
||||||
|
|
||||||
|
.. describe:: <server>
|
||||||
|
|
||||||
|
Server(s) to create dump file (name or ID)
|
||||||
|
|
||||||
server list
|
server list
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ referring to both Compute and Volume quotas.
|
|||||||
* ``security group``: (**Compute**, **Network**) - groups of network access rules
|
* ``security group``: (**Compute**, **Network**) - groups of network access rules
|
||||||
* ``security group rule``: (**Compute**, **Network**) - the individual rules that define protocol/IP/port access
|
* ``security group rule``: (**Compute**, **Network**) - the individual rules that define protocol/IP/port access
|
||||||
* ``server``: (**Compute**) virtual machine instance
|
* ``server``: (**Compute**) virtual machine instance
|
||||||
|
* ``server dump``: (**Compute**) a dump file of a server created by features like kdump
|
||||||
* ``server image``: (**Compute**) saved server disk image
|
* ``server image``: (**Compute**) saved server disk image
|
||||||
* ``service``: (**Identity**) a cloud service
|
* ``service``: (**Identity**) a cloud service
|
||||||
* ``service provider``: (**Identity**) a resource that consumes assertions from an ``identity provider``
|
* ``service provider``: (**Identity**) a resource that consumes assertions from an ``identity provider``
|
||||||
|
@ -542,6 +542,34 @@ class CreateServer(command.ShowOne):
|
|||||||
return zip(*sorted(six.iteritems(details)))
|
return zip(*sorted(six.iteritems(details)))
|
||||||
|
|
||||||
|
|
||||||
|
class CreateServerDump(command.Command):
|
||||||
|
"""Create a dump file in server(s)
|
||||||
|
|
||||||
|
Trigger crash dump in server(s) with features like kdump in Linux.
|
||||||
|
It will create a dump file in the server(s) dumping the server(s)'
|
||||||
|
memory, and also crash the server(s). OSC sees the dump file
|
||||||
|
(server dump) as a kind of resource.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super(CreateServerDump, self).get_parser(prog_name)
|
||||||
|
parser.add_argument(
|
||||||
|
'server',
|
||||||
|
metavar='<server>',
|
||||||
|
nargs='+',
|
||||||
|
help=_('Server(s) to create dump file (name or ID)'),
|
||||||
|
)
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def take_action(self, parsed_args):
|
||||||
|
compute_client = self.app.client_manager.compute
|
||||||
|
for server in parsed_args.server:
|
||||||
|
utils.find_resource(
|
||||||
|
compute_client.servers,
|
||||||
|
server,
|
||||||
|
).trigger_crash_dump()
|
||||||
|
|
||||||
|
|
||||||
class CreateServerImage(command.ShowOne):
|
class CreateServerImage(command.ShowOne):
|
||||||
"""Create a new disk image from a running server"""
|
"""Create a new disk image from a running server"""
|
||||||
|
|
||||||
|
@ -490,6 +490,26 @@ class TestServerDelete(TestServer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TestServerDumpCreate(TestServer):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestServerDumpCreate, self).setUp()
|
||||||
|
|
||||||
|
# Get the command object to test
|
||||||
|
self.cmd = server.CreateServerDump(self.app, None)
|
||||||
|
|
||||||
|
# Set methods to be tested.
|
||||||
|
self.methods = {
|
||||||
|
'trigger_crash_dump': None,
|
||||||
|
}
|
||||||
|
|
||||||
|
def test_server_dump_one_server(self):
|
||||||
|
self.run_method_with_servers('trigger_crash_dump', 1)
|
||||||
|
|
||||||
|
def test_server_dump_multi_servers(self):
|
||||||
|
self.run_method_with_servers('trigger_crash_dump', 3)
|
||||||
|
|
||||||
|
|
||||||
class TestServerImageCreate(TestServer):
|
class TestServerImageCreate(TestServer):
|
||||||
|
|
||||||
columns = (
|
columns = (
|
||||||
|
5
releasenotes/notes/bug-1538372-ef3a30298357f972.yaml
Normal file
5
releasenotes/notes/bug-1538372-ef3a30298357f972.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add support for the `server dump create` command
|
||||||
|
[Bug `1538372 <https://bugs.launchpad.net/python-openstackclient/+bug/1538372>`_]
|
@ -133,6 +133,7 @@ openstack.compute.v2 =
|
|||||||
server_start = openstackclient.compute.v2.server:StartServer
|
server_start = openstackclient.compute.v2.server:StartServer
|
||||||
server_stop = openstackclient.compute.v2.server:StopServer
|
server_stop = openstackclient.compute.v2.server:StopServer
|
||||||
server_suspend = openstackclient.compute.v2.server:SuspendServer
|
server_suspend = openstackclient.compute.v2.server:SuspendServer
|
||||||
|
server_dump_create = openstackclient.compute.v2.server:CreateServerDump
|
||||||
server_unlock = openstackclient.compute.v2.server:UnlockServer
|
server_unlock = openstackclient.compute.v2.server:UnlockServer
|
||||||
server_unpause = openstackclient.compute.v2.server:UnpauseServer
|
server_unpause = openstackclient.compute.v2.server:UnpauseServer
|
||||||
server_unrescue = openstackclient.compute.v2.server:UnrescueServer
|
server_unrescue = openstackclient.compute.v2.server:UnrescueServer
|
||||||
|
Loading…
Reference in New Issue
Block a user