diff options
| -rwxr-xr-x | tools/kvm/kvm_stat/kvm_stat | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat index e10b90a8917a..b9e8d0def1ab 100755 --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat | |||
| @@ -766,6 +766,13 @@ class DebugfsProvider(Provider): | |||
| 766 | self.do_read = True | 766 | self.do_read = True |
| 767 | self.reset() | 767 | self.reset() |
| 768 | 768 | ||
| 769 | def _verify_paths(self): | ||
| 770 | """Remove invalid paths""" | ||
| 771 | for path in self.paths: | ||
| 772 | if not os.path.exists(os.path.join(PATH_DEBUGFS_KVM, path)): | ||
| 773 | self.paths.remove(path) | ||
| 774 | continue | ||
| 775 | |||
| 769 | def read(self, reset=0, by_guest=0): | 776 | def read(self, reset=0, by_guest=0): |
| 770 | """Returns a dict with format:'file name / field -> current value'. | 777 | """Returns a dict with format:'file name / field -> current value'. |
| 771 | 778 | ||
| @@ -780,6 +787,7 @@ class DebugfsProvider(Provider): | |||
| 780 | # If no debugfs filtering support is available, then don't read. | 787 | # If no debugfs filtering support is available, then don't read. |
| 781 | if not self.do_read: | 788 | if not self.do_read: |
| 782 | return results | 789 | return results |
| 790 | self._verify_paths() | ||
| 783 | 791 | ||
| 784 | paths = self.paths | 792 | paths = self.paths |
| 785 | if self._pid == 0: | 793 | if self._pid == 0: |
