console: extend screendump monitor cmd
PATCH 1/1 console: extend screendump monitor cmd
Add an optional device parameter to the screendump command.
https://bugzilla.redhat.com/show_bug.cgi?id=903910
--- hmp-commands.hx | 6 +++--- hmp.c | 3 ++- qapi-schema.json | 4 +++- qmp-commands.hx | 3 ++- ui/console.c | 17 ++++++++++++++++- 5 files changed, 26 insertions(+), 7 deletions(-)
hmp-commands.hx +3 -3
@@ -237,9 +237,9 @@ ETEXI { .name = "screendump", - .args_type = "filename:F", - .params = "filename", - .help = "save screen into PPM image 'filename'", + .args_type = "filename:F,device:B?", + .params = "filename [device]", + .help = "save screen from device into PPM image 'filename'", .mhandler.cmd = hmp_screen_dump, },
hmp.c +2 -1
@@ -1344,9 +1344,10 @@ err_out:void hmp_screen_dump (Monitor *mon,const QDict *qdict) {const char *filename =qdict_get_str (qdict,"filename" ); +const char *device =qdict_get_try_str (qdict,"device" );Error *err =NULL ; -qmp_screendump (filename, &err); +qmp_screendump (filename, device !=NULL , device, &err);hmp_handle_error (mon, &err); }
qapi-schema.json +3 -1
@@ -3117,12 +3117,14 @@ # Write a PPM of the VGA screen to a file. # # @filename: the path of a new PPM file to store the image +# @device: #optional device to take the screenshot from # # Returns: Nothing on success # # Since: 0.14.0 ## -{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', 'data': {'filename': 'str', + '*device' : 'str'} } ## # @nbd-server-start:
qmp-commands.hx +2 -1
@@ -145,7 +145,7 @@ EQMP { .name = "screendump", - .args_type = "filename:F", + .args_type = "filename:F,device:B?", .mhandler.cmd_new = qmp_marshal_input_screendump, },
@@ -158,6 +158,7 @@ Save screen into PPM image. Arguments: - "filename": file path (json-string) +- "device": video device (json-string, optional) Example:
ui/console.c +16 -1
@@ -313,10 +313,25 @@ write_err: goto out; } -void qmp_screendump (const char *filename,Error **errp) +void qmp_screendump (const char *filename, +bool has_device,const char *device,Error **errp) {QemuConsole *con =qemu_console_lookup_by_index (0 );DisplaySurface *surface; +DeviceState *dev; + +if (has_device) { + dev =qdev_find_recursive (sysbus_get_default (), device); +if (NULL == dev) { +error_set (errp,QERR_DEVICE_NOT_FOUND , device); +return ; + } + con =qemu_console_lookup_by_device (dev); +if (NULL == con) { +error_setg (errp,"There is no QemuConsole linked to %s" , device); +return ; + } + }if (con ==NULL ) {error_setg (errp,"There is no QemuConsole I can screendump from." );
Signature · 1 line
1.7.9.7
Quoted 53 lines · On Wed, 12 Jun 2013 13:51:17 +0200 Gerd Hoffmann <[email protected]> wrote:
Add an optional device parameter to the screendump command.
https://bugzilla.redhat.com/show_bug.cgi?id=903910
Signed-off-by Gerd Hoffmann <[email protected]>--- hmp-commands.hx | 6 +++--- hmp.c | 3 ++- qapi-schema.json | 4 +++- qmp-commands.hx | 3 ++- ui/console.c | 17 ++++++++++++++++- 5 files changed, 26 insertions(+), 7 deletions(-)hmp-commands.hx +3
-3@@ -237,9 +237,9 @@ ETEXI { .name = "screendump", - .args_type = "filename:F", - .params = "filename", - .help = "save screen into PPM image 'filename'", + .args_type = "filename:F,device:B?", + .params = "filename [device]", + .help = "save screen from device into PPM image 'filename'", .mhandler.cmd = hmp_screen_dump, },hmp.c +2
-1@@ -1344,9 +1344,10 @@ err_out:void hmp_screen_dump (Monitor *mon,const QDict *qdict) {const char *filename =qdict_get_str (qdict,"filename" ); +const char *device =qdict_get_try_str (qdict,"device" );Error *err =NULL ; -qmp_screendump (filename, &err); +qmp_screendump (filename, device !=NULL , device, &err);hmp_handle_error (mon, &err); }qapi-schema.json +0
-0@@ -3117,12 +3117,14 @@ # Write a PPM of the VGA screen to a file. #
qapi-schema.json line 3127
Quoted 10 lines
qapi-schema.json +3
-1# @filename: the path of a new PPM file to store the image +# @device: #optional device to take the screenshot from # # Returns: Nothing on success # # Since: 0.14.0 ## -{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', 'data': {'filename': 'str', + '*device' : 'str'} }
We can't add new optional parameters to QMP commands because it's currently impossible for mngt apps to discover them.
We have two options: 1. add this as a new command or 2. wait for full schema introspection (which we might get for 1.6).
Quoted 55 lines
qapi-schema.json +0
-0## # @nbd-server-start:qmp-commands.hx +2
-1@@ -145,7 +145,7 @@ EQMP { .name = "screendump", - .args_type = "filename:F", + .args_type = "filename:F,device:B?", .mhandler.cmd_new = qmp_marshal_input_screendump, },@@ -158,6 +158,7 @@ Save screen into PPM image. Arguments: - "filename": file path (json-string) +- "device": video device (json-string, optional) Example:ui/console.c +16
-1@@ -313,10 +313,25 @@ write_err: goto out; } -void qmp_screendump (const char *filename,Error **errp) +void qmp_screendump (const char *filename, +bool has_device,const char *device,Error **errp) {QemuConsole *con =qemu_console_lookup_by_index (0 );DisplaySurface *surface; +DeviceState *dev; + +if (has_device) { + dev =qdev_find_recursive (sysbus_get_default (), device); +if (NULL == dev) { +error_set (errp,QERR_DEVICE_NOT_FOUND , device); +return ; + } + con =qemu_console_lookup_by_device (dev); +if (NULL == con) { +error_setg (errp,"There is no QemuConsole linked to %s" , device); +return ; + } + }if (con ==NULL ) {error_setg (errp,"There is no QemuConsole I can screendump from." );
Hi,
Quoted 9 lines
qapi-schema.json line 3127
Quoted 3 lines
qapi-schema.json +2
-1-{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', 'data': {'filename': 'str', + '*device' : 'str'} }We can't add new optional parameters to QMP commands because it's currently impossible for mngt apps to discover them.
We have two options: 1. add this as a new command or 2. wait for full schema introspection (which we might get for 1.6).
"might get" sounds like it isn't a save bet, so I guess I better should go for option (1) ...
cheers,
Gerd
Quoted 9 lines · On Wed, 12 Jun 2013 15:21:20 +0200 Gerd Hoffmann <[email protected]> wrote:
Hi,
Quoted 7 lines
qapi-schema.json line 3127
Quoted 3 lines
qapi-schema.json +2
-1-{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', 'data': {'filename': 'str', + '*device' : 'str'} }We can't add new optional parameters to QMP commands because it's currently impossible for mngt apps to discover them.
Quoted 5 lines
Quoted 2 lines
We have two options: 1. add this as a new command or 2. wait for full schema introspection (which we might get for 1.6).
"might get" sounds like it isn't a save bet, so I guess I better should go for option (1) ...
Amos, do you think we'll get it for 1.6?
Quoted 12 lines · Luiz Capitulino
Quoted 9 lines · On Wed, 12 Jun 2013 15:21:20 +0200 Gerd Hoffmann <[email protected]> wrote:
Hi,
Quoted 7 lines
qapi-schema.json line 3127
Quoted 3 lines
qapi-schema.json +2
-1-{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', 'data': {'filename': 'str', + '*device' : 'str'} }We can't add new optional parameters to QMP commands because it's currently impossible for mngt apps to discover them.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
We have two options: 1. add this as a new command or 2. wait for full schema introspection (which we might get for 1.6).
"might get" sounds like it isn't a save bet, so I guess I better should go for option (1) ...
Amos, do you think we'll get it for 1.6?
Yes, we can.
2013-07-29 Hard feature freeze
2013-08-01 Tag v1.6.0-rc1
Signature · 1 line
Amos.