summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Raspl <stefan.raspl@de.ibm.com>2018-08-24 14:04:01 +0200
committerRadim Krčmář <rkrcmar@redhat.com>2018-08-30 17:15:12 +0200
commitc012a0f2677529a0ae8f53a15bd7c61dc4ca5b5e (patch)
tree6c9e4ee6a072c35afce5037140400d402fa8e3a7
parent404517e40867aef60554ef497d5cf8d089a5b9cf (diff)
downloadlinux-c012a0f2677529a0ae8f53a15bd7c61dc4ca5b5e.tar.bz2
tools/kvm_stat: re-animate display of dead guests
When filtering by guest (interactive commands 'p'/'g'), and the respective guest was destroyed, detect when the guest is up again through the guest name if possible. I.e. when displaying events for a specific guest, it is not necessary anymore to restart kvm_stat in case the guest is restarted. Signed-off-by: Stefan Raspl <raspl@linux.ibm.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
-rwxr-xr-xtools/kvm/kvm_stat/kvm_stat10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 5c2422b0f2f8..439b8a27488d 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1103,6 +1103,7 @@ class Tui(object):
pid = self.stats.pid_filter
self.screen.erase()
gname = self.get_gname_from_pid(pid)
+ self._gname = gname
if gname:
gname = ('({})'.format(gname[:MAX_GUEST_NAME_LEN] + '...'
if len(gname) > MAX_GUEST_NAME_LEN
@@ -1170,6 +1171,15 @@ class Tui(object):
return sorted_items
if not self._is_running_guest(self.stats.pid_filter):
+ if self._gname:
+ try: # ...to identify the guest by name in case it's back
+ pids = self.get_pid_from_gname(self._gname)
+ if len(pids) == 1:
+ self._refresh_header(pids[0])
+ self._update_pid(pids[0])
+ return
+ except:
+ pass
self._display_guest_dead()
# leave final data on screen
return