diff mbox

scripts/kvm/kvm_stat: Fix tracefs access checking

Message ID 56B1B26C.3080709@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini Feb. 3, 2016, 7:55 a.m. UTC
On 03/02/2016 08:41, Janosch Frank wrote:
> The following patch fixes the access checking behavior changed in
> 7aa4ee5. Kvm_stat will now fall back to debugfs statistics if the
> tracefs ones were chosen but are not available. It will then print a
> warning and wait five seconds until it continues.
> 
> Five seconds are not long, but I do not want to annoy users with
> longer delays and the message is still visible after closing
> kvm_stat.
> 
> Janosch Frank (1):
>   scripts/kvm/kvm_stat: Fix tracefs access checking
> 
>  scripts/kvm/kvm_stat | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 

I think exiting is better if the -t flag is explicitly passed:


Otherwise okay.

Paolo
diff mbox

Patch

diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index bab34bb..3cf1181 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -796,11 +796,12 @@  def check_access(options):
         sys.stderr.write("Please enable CONFIG_TRACING in your kernel "
                          "when using the option -t (default).\n"
                          "If it is enabled, make {0} readable by the "
-                         "current user.\n"
-                         "Falling back to debugfs statistics!\n"
-                         .format(PATH_DEBUGFS_TRACING))
+                         "current user.\n")
+        if options.tracepoints:
+            sys.exit(1)
+
+        sys.stderr.write("Falling back to debugfs statistics!\n"
         options.debugfs = True
-        options.tracepoints = False
         sleep(5)

     return options