[1/9] trace: do not always call exit() in trace_enable_events
diff mbox

Message ID 1457954501-26528-2-git-send-email-den@openvz.org
State New
Headers show

Commit Message

Denis V. Lunev March 14, 2016, 11:21 a.m. UTC
The problem is that
  virsh qemu-monitor-command --hmp VM log trace:help
forces QEMU to exit even when running VM normally.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
---
 trace/control.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini March 14, 2016, 2:25 p.m. UTC | #1
On 14/03/2016 12:21, Denis V. Lunev wrote:
> The problem is that
>   virsh qemu-monitor-command --hmp VM log trace:help
> forces QEMU to exit even when running VM normally.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  trace/control.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/trace/control.c b/trace/control.c
> index 20d3370..2d404c3 100644
> --- a/trace/control.c
> +++ b/trace/control.c
> @@ -19,6 +19,7 @@
>  #include "qemu/log.h"
>  #endif
>  #include "qemu/error-report.h"
> +#include "monitor/monitor.h"
>  
>  int trace_events_enabled_count;
>  bool trace_events_dstate[TRACE_EVENT_COUNT];
> @@ -131,7 +132,9 @@ void trace_enable_events(const char *line_buf)
>  {
>      if (is_help_option(line_buf)) {
>          trace_list_events();
> -        exit(0);
> +        if (cur_mon == NULL) {
> +            exit(0);
> +        }
>      } else {
>          do_trace_enable_events(line_buf);
>      }
> 

Ouch. :)

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

Patch
diff mbox

diff --git a/trace/control.c b/trace/control.c
index 20d3370..2d404c3 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -19,6 +19,7 @@ 
 #include "qemu/log.h"
 #endif
 #include "qemu/error-report.h"
+#include "monitor/monitor.h"
 
 int trace_events_enabled_count;
 bool trace_events_dstate[TRACE_EVENT_COUNT];
@@ -131,7 +132,9 @@  void trace_enable_events(const char *line_buf)
 {
     if (is_help_option(line_buf)) {
         trace_list_events();
-        exit(0);
+        if (cur_mon == NULL) {
+            exit(0);
+        }
     } else {
         do_trace_enable_events(line_buf);
     }