summaryrefslogtreecommitdiff
path: root/tools/kvm
diff options
context:
space:
mode:
authorStefan Raspl <stefan.raspl@de.ibm.com>2017-12-11 14:25:26 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-12-14 11:25:46 +0300
commit822cfe3e4813c8f52199362b0e689fba9459ddc9 (patch)
treedf755bd5baf19f41c256a6ffb817c8531fbef559 /tools/kvm
parent08e20a6300e106d5feb89c9e47ea479533fec46f (diff)
downloadlinux-822cfe3e4813c8f52199362b0e689fba9459ddc9.tar.xz
tools/kvm_stat: suppress usage information on command line errors
Errors while parsing the '-g' command line argument result in display of usage information prior to the error message. This is a bit confusing, as the command line is syntactically correct. To reproduce, run 'kvm_stat -g' and specify a non-existing or inactive guest. Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/kvm')
-rwxr-xr-xtools/kvm/kvm_stat/kvm_stat13
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 29c56f3a05dc..bf65531570f5 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1453,16 +1453,13 @@ Press any other key to refresh statistics immediately.
try:
pids = Tui.get_pid_from_gname(val)
except:
- raise optparse.OptionValueError('Error while searching for guest '
- '"{}", use "-p" to specify a pid '
- 'instead'.format(val))
+ sys.exit('Error while searching for guest "{}". Use "-p" to '
+ 'specify a pid instead?'.format(val))
if len(pids) == 0:
- raise optparse.OptionValueError('No guest by the name "{}" '
- 'found'.format(val))
+ sys.exit('Error: No guest by the name "{}" found'.format(val))
if len(pids) > 1:
- raise optparse.OptionValueError('Multiple processes found (pids: '
- '{}) - use "-p" to specify a pid '
- 'instead'.format(" ".join(pids)))
+ sys.exit('Error: Multiple processes found (pids: {}). Use "-p" '
+ 'to specify the desired pid'.format(" ".join(pids)))
parser.values.pid = pids[0]
optparser = optparse.OptionParser(description=description_text,