Commit b74faa93 authored by Stefan Raspl's avatar Stefan Raspl Committed by Paolo Bonzini

tools/kvm_stat: fix extra handling of 'help' with fields filter

Commit 67fbcd62 ("tools/kvm_stat: add '-f help' to get the available
event list") added support for '-f help'. However, the extra handling of
'help' will also take effect when 'help' is specified as a regex in
interactive mode via 'f'. This results in display of all events while
only those matching this regex should be shown.
Signed-off-by: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 67c162b0
...@@ -478,7 +478,7 @@ class Provider(object): ...@@ -478,7 +478,7 @@ class Provider(object):
@staticmethod @staticmethod
def is_field_wanted(fields_filter, field): def is_field_wanted(fields_filter, field):
"""Indicate whether field is valid according to fields_filter.""" """Indicate whether field is valid according to fields_filter."""
if not fields_filter or fields_filter == "help": if not fields_filter:
return True return True
return re.match(fields_filter, field) is not None return re.match(fields_filter, field) is not None
...@@ -1567,6 +1567,7 @@ def main(): ...@@ -1567,6 +1567,7 @@ def main():
stats = Stats(options) stats = Stats(options)
if options.fields == "help": if options.fields == "help":
stats.fields_filter = None
event_list = "\n" event_list = "\n"
s = stats.get() s = stats.get()
for key in s.keys(): for key in s.keys():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment