forked from xenserver/status-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xen-bugtool
executable file
·2244 lines (1930 loc) · 81.8 KB
/
xen-bugtool
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Copyright (c) 2005, 2007 XenSource Ltd.
#
# To add new entries to the bugtool, you need to:
#
# Create a new capability. These declare the new entry to the GUI, including
# the expected size, time to collect, privacy implications, and whether the
# capability should be selected by default. One capability may refer to
# multiple files, assuming that they can be reasonably grouped together, and
# have the same privacy implications. You need:
#
# A new CAP_ constant.
# A cap() invocation to declare the capability.
#
# You then need to add calls to main() to collect the files. These will
# typically be calls to the helpers file_output(), tree_output(), cmd_output(),
# or func_output().
#
# Special pylint disables for latest pylint on xen-bugtool itself (for the moment):
# The old Pylint-1.9.x thinks some of these are useless:
# pylint: disable=useless-suppression
# pylint: disable=missing-docstring,line-too-long,multiple-statements,unnecessary-pass
# pylint: disable=broad-exception-raised,missing-type-doc,useless-object-inheritance
# pylint: disable=undefined-variable,unnecessary-comprehension
from __future__ import print_function
import fcntl
import getopt
import glob
import io
import json
import logging
import os
import platform
import pprint
import re
import socket
import sys
import tarfile
import time
import traceback
import xml
import zipfile
from hashlib import md5 as md5_new
from select import select
from signal import SIGHUP, SIGTERM, SIGUSR1
from subprocess import PIPE, Popen
from xml.dom.minidom import getDOMImplementation, parse
from xml.etree import ElementTree
from xml.etree.ElementTree import Element
import defusedxml.sax
if sys.version_info.major == 2: # pragma: no cover
from commands import getoutput # pyright: ignore[reportMissingImports]
from urllib import urlopen # type:ignore[attr-defined]
unicode_type = unicode # pyright:ignore[reportUndefinedVariable] # pylint: disable=unicode-builtin
else:
from subprocess import getoutput
from urllib.request import urlopen
from typing import TYPE_CHECKING
if TYPE_CHECKING: # Used for type checking only:
from _typeshed import ReadableBuffer # pylint: disable=unused-import
unicode_type = str
# Fixed in 3.7: https://github.com/python/cpython/pull/12628
# Monkey-patch zipfile's __del__ function to be less stupid
# Specifically, it calls close which further writes to the file, which
# fails with ENOSPC if the root filesystem is full
if sys.version < "3.7":
zipfile_del = zipfile.ZipFile.__del__ # type: ignore[attr-defined] # mypy,pyright
def exceptionless_del(*argl, **kwargs):
try:
zipfile_del(*argl, **kwargs)
except OSError:
pass
zipfile.ZipFile.__del__ = exceptionless_del # type: ignore[attr-defined] # mypy,pyright
def xapi_local_session():
import XenAPI # Import on first use.
return XenAPI.xapi_local()
OS_RELEASE = platform.release()
#
# Files & directories
#
BUG_DIR = "/var/opt/xen/bug-report"
PLUGIN_DIR = "/etc/xensource/bugtool"
XAPI_BLOBS = '/var/xapi/blobs'
GRUB_BIOS_CONFIG = '/boot/grub/grub.cfg'
GRUB_EFI_CONFIG = '/boot/efi/EFI/xenserver/grub.cfg'
BOOT_KERNEL = '/boot/vmlinuz-' + OS_RELEASE
BOOT_INITRD = '/boot/initrd-' + OS_RELEASE + '.img'
PROC_PARTITIONS = '/proc/partitions'
FCOE_BLACKLIST_FILE = '/etc/sysconfig/fcoe-blacklist'
FCOE_CONFIG_DIR = '/etc/fcoe/'
FSTAB = '/etc/fstab'
PROC_MOUNTS = '/proc/mounts'
ISCSI_CONF = '/etc/iscsi/iscsid.conf'
ISCSI_INITIATOR = '/etc/iscsi/initiatorname.iscsi'
LVM_CACHE = '/etc/lvm/cache/.cache'
LVM_CONFIG = '/etc/lvm/lvm.conf'
PROC_BUDDYINFO = '/proc/buddyinfo'
PROC_CPUINFO = '/proc/cpuinfo'
PROC_MEMINFO = '/proc/meminfo'
PROC_PAGETYINFO = '/proc/pagetypeinfo'
PROC_SLABINFO = '/proc/slabinfo'
PROC_VMSTAT = '/proc/vmstat'
PROC_ZONEINFO = '/proc/zoneinfo'
PROC_IOMEM = '/proc/iomem'
PROC_IOPORTS = '/proc/ioports'
PROC_INTERRUPTS = '/proc/interrupts'
PROC_SOFTIRQS = '/proc/softirqs'
PROC_SCSI = '/proc/scsi/scsi'
FIRSTBOOT_DIR = '/etc/firstboot.d'
PROC_VERSION = '/proc/version'
PROC_MDSTAT = '/proc/mdstat'
PROC_MODULES = '/proc/modules'
PROC_DEVICES = '/proc/devices'
PROC_FILESYSTEMS = '/proc/filesystems'
PROC_CMDLINE = '/proc/cmdline'
PROC_CONFIG = '/proc/config.gz'
PROC_USB_DEV = '/proc/bus/usb/devices'
PROC_XEN_BALLOON = '/proc/xen/balloon'
PROC_NET_BONDING_DIR = '/proc/net/bonding'
PROC_NET_VLAN_DIR = '/proc/net/vlan'
PROC_NET_SOFTNET_STAT = '/proc/net/softnet_stat'
PROC_XSVERSION = '/proc/xsversion'
ETC_MDADM_CONF = '/etc/mdadm.conf'
ETC_MDADM_MDADM_CONF = '/etc/mdadm/mdadm.conf'
AD_USERS = '/etc/security/hcp_ad_users.conf'
AD_GROUPS = '/etc/security/hcp_ad_groups.conf'
MODPROBE_CONF = '/etc/modprobe.conf'
MODPROBE_DIR = '/etc/modprobe.d'
BOOT_TIME_CPUS = '/etc/xensource/boot_time_cpus'
BOOT_TIME_MEMORY = '/etc/xensource/boot_time_memory'
SYSCONFIG_CLOCK = '/etc/sysconfig/clock'
SYSCONFIG_HWCONF = '/etc/sysconfig/hwconf'
SYSCONFIG_NETWORK = '/etc/sysconfig/network'
SYSCONFIG_NETWORK_SCRIPTS = '/etc/sysconfig/network-scripts'
SYSCONFIG_RENAME_DATA_DIR = '/etc/sysconfig/network-scripts/interface-rename-data'
NET_UDEV_RULES = '/etc/udev/rules.d/60-net.rules'
IFCFG_RE = re.compile(r'^.*/ifcfg-.*')
ROUTE_RE = re.compile(r'^.*/route-.*')
NETWORK_DBCACHE = '/var/xapi/network.dbcache'
NETWORKD_DB = '/var/xapi/networkd.db'
RESOLV_CONF = '/etc/resolv.conf'
MULTIPATH_CONF = '/etc/multipath.conf'
MULTIPATH_CONFD = '/etc/multipath/conf.d/*'
NSSWITCH_CONF = '/etc/nsswitch.conf'
CHRONY_CONF = '/etc/chrony.conf'
IPTABLES_CONFIG = '/etc/sysconfig/iptables-config'
HOSTS = '/etc/hosts'
HOSTS_ALLOW = '/etc/hosts.allow'
HOSTS_DENY = '/etc/hosts.deny'
DHCP_LEASE_DIR = '/var/lib/xcp/dhclient'
OPENVSWITCH_CORE_DIR = '/var/xen/openvswitch'
OPENVSWITCH_CONF = '/etc/ovs-vswitchd.conf'
OPENVSWITCH_CONF_DB = '/run/openvswitch/conf.db'
OPENVSWITCH_VSWITCHD_PID = '/var/run/openvswitch/ovs-vswitchd.pid'
VAR_LOG_DIR = '/var/log/'
XENSOURCE_INVENTORY = '/etc/xensource-inventory'
OEM_CONFIG_DIR = '/var/xsconfig'
OEM_CONFIG_FILES_RE = re.compile(r'^.*xensource-inventory$')
OEM_DB_FILES_RE = re.compile(r'^.*state\.db')
INITIAL_INVENTORY = '/opt/xensource/etc/initial-inventory'
VENDORKERNEL_INVENTORY = '/etc/vendorkernel-inventory'
STATIC_VDIS = '/etc/xensource/static-vdis'
POOL_CONF = '/etc/xensource/pool.conf'
NETWORK_CONF = '/etc/xensource/network.conf'
XAPI_CONF = '/etc/xapi.conf'
XAPI_CONF_DIR = '/etc/xapi.conf.d'
XENOPSD_CONF = '/etc/xenopsd.conf'
XAPI_SSL_CONF = '/etc/xensource/xapi-ssl.conf'
XAPI_GLOBS_CONF = '/etc/xensource/xapi_globs.conf'
SSHD_CONFIG = '/etc/ssh/sshd_config'
DB_CONF = '/etc/xensource/db.conf'
DB_CONF_RIO = '/etc/xensource/db.conf.rio'
DB_DEFAULT_FIELDS = '/etc/xensource/db-default-fields'
DB_SCHEMA_SQL = '/etc/xensource/db_schema.sql'
SYSTEMD_CONF_DIR = '/etc/systemd'
CGRULES_CONF = '/etc/cgrules.conf'
XAPI_LOCAL_DB = '/var/xapi/local.db'
HOST_CRASHDUMPS_DIR = '/var/crash'
HOST_CRASHDUMP_LOGS_EXCLUDES_RE = re.compile(r".*/(\.sacrificial-space-for-logs|coredump\.bin)$")
XAPI_DEBUG_DIR = '/var/xapi/debug'
INSTALLED_REPOS_DIR = '/etc/xensource/installed-repos'
UPDATE_APPLIED_DIR = '/var/update/applied'
OEM_XENSERVER_LOGS_RE = re.compile(r'^.*xensource\.log$')
XHA_LOG = '/var/log/xha.log'
XHAD_CONF = '/etc/xensource/xhad.conf'
YUM_LOG = '/var/log/yum.log'
YUM_REPOS_DIR = '/etc/yum.repos.d'
PAM_DIR = '/etc/pam.d'
FIST_RE = re.compile(r'.*/fist_')
KRB5_CONF = '/etc/krb5.conf'
SAMBA_CONFIG_DIR = '/etc/samba'
# SAMBA_DATA_DIR = '/var/lib/samba'
QEMU_DIR = '/var/lib/xen'
QEMU_RESUME_RE = re.compile(r'.*/qemu-resume\..*')
INTERFACE_RENAME_LOG = '/var/log/interface-rename.log'
SYS_NETBACK_DEBUG = '/sys/kernel/debug/xen-netback'
SYS_EFIVARS = '/sys/firmware/efi/efivars'
BLKTAP_DEVICE_PATH = '/dev/blktap'
SYS_KERNEL_NOTES = '/sys/kernel/notes'
SIGNING_KEY_INFO_DIR = '/etc/pki/rpm-gpg'
XAPI_CLUSTERD = '/var/opt/xapi-clusterd/db'
SWTPM_IC = '/var/lib/swtpm-localca/issuercert.pem'
SWTPM_RCA ='/var/lib/swtpm-localca/swtpm-localca-rootca-cert.pem'
SWTPM_CS = '/var/lib/swtpm-localca/certserial'
NRPE_CONF = '/etc/nagios/nrpe.cfg'
NRPE_DIR = '/etc/nrpe.d'
XEN_BUGTOOL_LOG = 'xen-bugtool.log'
CRON_DIRS = '/etc/cron*'
CRON_SPOOL = '/var/spool/cron'
#
# External programs
#
ACPIDUMP = 'acpidump'
ARP = 'arp'
ARPTABLES = 'arptables'
BIN_STATIC_VDIS = 'static-vdis'
BIOSDEVNAME = 'biosdevname'
BRCTL = 'brctl'
CHKCONFIG = 'chkconfig'
CHRONYC = 'chronyc'
CSL = '/opt/Citrix/StorageLink/bin/csl'
DCBTOOL = 'dcbtool'
DF = 'df'
DU = 'du'
DMESG = 'dmesg'
DMIDECODE = 'dmidecode'
DMSETUP = 'dmsetup'
EBTABLES = 'ebtables'
EFIBOOTMGR = 'efibootmgr'
ETHTOOL = 'ethtool'
FCOEADM = 'fcoeadm'
FDISK = 'fdisk'
HA_QUERY_LIVESET = '/opt/xensource/debug/debug_ha_query_liveset'
HDPARM = 'hdparm'
IFCONFIG = 'ifconfig'
IPTABLES = 'iptables'
ISCSIADM = 'iscsiadm'
KPATCH = 'kpatch'
LIST_DOMAINS = 'list_domains'
LLDPTOOL = 'lldptool'
LOSETUP = 'losetup'
LS = 'ls'
LSBLK = 'lsblk'
LSPCI = 'lspci'
LVDISPLAY = 'lvdisplay'
LVS = 'lvs'
MD5SUM = 'md5sum'
MDADM = 'mdadm'
MODINFO = 'modinfo'
MULTIPATHD = 'multipathd'
NETSTAT = 'netstat'
NSTAT = 'nstat'
SS = 'ss'
OVS_APPCTL = 'ovs-appctl'
OVS_DPCTL = 'ovs-dpctl'
OVS_OFCTL = 'ovs-ofctl'
OVS_VSCTL = 'ovs-vsctl'
PS = 'ps'
PVS = 'pvs'
QLOGIC_FW = 'strings /lib/firmware/ql2*.bin | grep -i ver'
ROUTE = 'route'
RPM = 'rpm'
SG_MAP = 'sg_map'
SYSCTL = 'sysctl'
SYSTEMCTL = 'systemctl'
TC = 'tc'
ULIMIT = 'ulimit -a'
UPTIME = 'uptime'
VGS = 'vgs'
VGSCAN = 'vgscan'
XE = 'xe'
XENPM = 'xenpm'
XEN_CPUID = 'xen-cpuid'
XEN_LIVEPATCH = 'xen-livepatch'
XEN_MICROCODE = 'xen-ucode'
XENSTORE_LS = 'xenstore-ls'
XL = 'xl'
ZCAT = 'zcat'
#
# PII -- Personally identifiable information. Of particular concern are
# things that would identify customers, or their network topology.
# Passwords are never to be included in any bug report, regardless of any PII
# declaration.
#
# NO -- No PII will be in these entries.
# YES -- PII will likely or certainly be in these entries.
# MAYBE -- The user may wish to audit these entries for PII.
# IF_CUSTOMIZED -- If the files are unmodified, then they will contain no PII,
# but since we encourage customers to edit these files, PII may have been
# introduced by the customer. This is used in particular for the networking
# scripts in dom0.
#
PII_NO = 'no'
PII_YES = 'yes'
PII_MAYBE = 'maybe'
PII_IF_CUSTOMIZED = 'if_customized'
KEY = 0
PII = 1
MIN_SIZE = 2
MAX_SIZE = 3
MIN_TIME = 4
MAX_TIME = 5
MIME = 6
CHECKED = 7
HIDDEN = 8
VERBOSITY = 9
MIME_DATA = 'application/data'
MIME_TEXT = 'text/plain'
INVENTORY_XML_ROOT = "system-status-inventory"
INVENTORY_XML_SUMMARY = 'system-summary'
INVENTORY_XML_ELEMENT = 'inventory-entry'
CAP_XML_ROOT = "system-status-capabilities"
CAP_XML_ELEMENT = 'capability'
CAP_BLOBS = 'blobs'
CAP_BOOT_LOADER = 'boot-loader'
CAP_CVSM = 'CVSM'
CAP_DEVICE_MODEL = 'device-model'
CAP_DISK_INFO = 'disk-info'
CAP_FCOE = 'fcoe'
CAP_FIRSTBOOT = 'firstboot'
CAP_HARDWARE_INFO = 'hardware-info'
CAP_HDPARM_T = 'hdparm-t'
CAP_HIGH_AVAILABILITY = 'high-availability'
CAP_HOST_CRASHDUMP_LOGS = 'host-crashdump-logs'
CAP_KERNEL_INFO = 'kernel-info'
CAP_LOSETUP_A = 'loopback-devices'
CAP_MULTIPATH = 'multipath'
CAP_NETWORK_CONFIG = 'network-config'
CAP_NETWORK_STATUS = 'network-status'
CAP_OEM = 'oem'
CAP_PAM = 'pam'
CAP_PROCESS_LIST = 'process-list'
CAP_PERSISTENT_STATS = 'persistent-stats'
CAP_BLOCK_SCHEDULER = 'block-scheduler'
CAP_SYSTEM_LOAD = 'system-load'
CAP_SYSTEM_LOGS = 'system-logs'
CAP_SYSTEM_SERVICES = 'system-services'
CAP_TAPDISK_LOGS = 'tapdisk-logs'
CAP_VTPM = 'vtpm'
CAP_XAPI_DEBUG = 'xapi-debug'
CAP_XAPI_SUBPROCESS = 'xapi-subprocess'
CAP_XEN_BUGTOOL = 'xen-bugtool'
CAP_XENRT = 'xenrt'
CAP_XENSERVER_CONFIG = 'xenserver-config'
CAP_XENSERVER_DOMAINS = 'xenserver-domains'
CAP_XENSERVER_DATABASES = 'xenserver-databases'
CAP_XENSERVER_INSTALL = 'xenserver-install'
CAP_XENSERVER_LOGS = 'xenserver-logs'
CAP_XEN_INFO = 'xen-info'
CAP_XHA_LIVESET = 'xha-liveset'
CAP_YUM = 'yum'
CAP_CRON = 'cron'
KB = 1024
MB = 1024 * 1024
# max size of vswitch database
CAP_NETWORK_CONFIG_OVERHEAD = 10 * MB
# max size of xenserver databases
CAP_XENSERVER_DATABASES_SIZE_OVERHEAD = 2 * MB
# max capture time of xenserver databases
CAP_XENSERVER_DATABASES_TIME_OVERHEAD = 40
caps = {}
cap_sizes = {}
unlimited_data = False
unlimited_time = False
dbg = False
def cap(key, pii=PII_MAYBE, min_size=-1, max_size=-1, min_time=-1,
max_time=-1, mime=MIME_TEXT, checked=True, hidden=False, verbosity=9):
if os.getenv('XEN_RT') and max_time > 0:
max_time *= 5
caps[key] = (key, pii, min_size, max_size, min_time, max_time, mime,
checked, hidden, verbosity)
cap_sizes[key] = 0
cap(CAP_BLOBS, PII_NO, max_size=5*MB)
cap(CAP_BOOT_LOADER, PII_NO, max_size=3*KB,
max_time=10)
cap(CAP_CVSM, PII_NO, max_size=3*MB,
max_time=120)
cap(CAP_DEVICE_MODEL, PII_YES, min_size=200*KB, max_size=8*MB)
cap(CAP_DISK_INFO, PII_MAYBE, max_size=8*MB,
max_time=120)
cap(CAP_FCOE, PII_YES, max_size=4*KB, max_time=10)
cap(CAP_FIRSTBOOT, PII_YES, min_size=60*KB, max_size=80*KB)
cap(CAP_HARDWARE_INFO, PII_MAYBE, max_size=800*KB,
max_time=60)
cap(CAP_HDPARM_T, PII_NO, min_size=0, max_size=5*KB,
min_time=20, max_time=90, checked=False, hidden=True)
cap(CAP_HIGH_AVAILABILITY, PII_MAYBE, max_size=5*MB)
cap(CAP_HOST_CRASHDUMP_LOGS, PII_MAYBE)
cap(CAP_KERNEL_INFO, PII_MAYBE, max_size=360*KB,
max_time=50)
cap(CAP_LOSETUP_A, PII_MAYBE, max_size=KB, max_time=5)
cap(CAP_MULTIPATH, PII_MAYBE, max_size=20*KB,
max_time=10)
cap(CAP_NETWORK_CONFIG, PII_IF_CUSTOMIZED,
min_size=0, max_size=100*KB)
cap(CAP_NETWORK_STATUS, PII_YES, max_size=20*KB,
max_time=30)
cap(CAP_PAM, PII_YES, max_size=50*MB)
cap(CAP_PERSISTENT_STATS, PII_NO, max_size=50*MB,
max_time=60, checked=False, hidden=True)
cap(CAP_PROCESS_LIST, PII_YES, max_size=30*KB,
max_time=60)
cap(CAP_SYSTEM_LOAD, PII_MAYBE, max_size=70*MB, max_time=30)
cap(CAP_SYSTEM_LOGS, PII_MAYBE, max_size=50*MB,
max_time=10)
cap(CAP_SYSTEM_SERVICES, PII_NO, max_size=128*KB,
max_time=20)
cap(CAP_TAPDISK_LOGS, PII_NO, max_size=10*MB)
cap(CAP_VTPM, PII_NO, max_size=5*KB)
cap(CAP_XAPI_DEBUG, PII_MAYBE, max_size=10*MB)
cap(CAP_XAPI_SUBPROCESS, PII_NO, max_size=5*KB,
max_time=10)
cap(CAP_XEN_BUGTOOL, PII_NO, min_size=0)
cap(CAP_XENRT, PII_NO, min_size=0, max_size=500*MB,
checked=False, hidden=True)
cap(CAP_XENSERVER_CONFIG, PII_MAYBE, max_size=80*KB,
max_time=10)
cap(CAP_XENSERVER_DOMAINS, PII_NO, max_size=1*KB,
max_time=10)
cap(CAP_XENSERVER_DATABASES, PII_YES, max_size=10*KB,
max_time=5)
cap(CAP_XENSERVER_INSTALL, PII_MAYBE, min_size=10*KB, max_size=4*MB)
cap(CAP_XENSERVER_LOGS, PII_MAYBE, min_size=0, max_size=70*MB)
cap(CAP_XEN_INFO, PII_MAYBE, max_size=20*KB,
max_time=10)
cap(CAP_XHA_LIVESET, PII_MAYBE, max_size=10*KB,
max_time=10)
cap(CAP_YUM, PII_IF_CUSTOMIZED, max_size=100*KB,
max_time=30)
cap(CAP_CRON, PII_IF_CUSTOMIZED, max_size=100*KB,
max_time=30)
cap(CAP_BLOCK_SCHEDULER, PII_NO, max_size=100*KB,
max_time=30)
ANSWER_YES_TO_ALL = False
SILENT_MODE = False
entries = None
data = {}
dev_null = open('/dev/null', 'r+')
def no_unicode(x):
if isinstance(x, unicode_type):
return x.encode('utf-8')
return x
def log(x, print_output=True):
if print_output:
output(x)
with open(XEN_BUGTOOL_LOG, "a") as logFile:
print(x, file=logFile)
def output(x):
if not SILENT_MODE:
print(x)
def output_ts(x):
output("[%s] %s" % (time.strftime("%x %X %Z"), x))
def cmd_output(cap, args, label = None, filter = None):
if cap in entries:
if not label:
if isinstance(args, list):
a = [aa for aa in args]
a[0] = os.path.basename(a[0])
label = ' '.join(a)
else:
label = args
data[label] = {'cap': cap, 'cmd_args': args, 'filter': filter}
def dir_list(cap, path_list, recursive = False):
flags = '-l'
if recursive:
flags = '-lR'
pl = []
for path in path_list:
pl.extend(glob.glob(path))
for p in pl:
cmd_output(cap, [LS, flags, p])
def file_output(cap, path_list):
if cap in entries:
pl = []
for path in path_list:
pl.extend(glob.glob(path))
for p in pl:
try:
s = os.stat(p)
if unlimited_data or caps[cap][MAX_SIZE] == -1 or \
cap_sizes[cap] < caps[cap][MAX_SIZE] or s.st_size == 0:
data[p] = {'cap': cap, 'filename': p}
cap_sizes[cap] += s.st_size
else:
log("Omitting %s, size constraint of %s exceeded" % (p, cap))
except:
pass
def tree_output(cap, path, pattern = None, negate = False):
if cap in entries:
if os.path.exists(path):
for f in os.listdir(path):
fn = os.path.join(path, f)
if os.path.isfile(fn) and matches(fn, pattern, negate):
file_output(cap, [fn])
elif os.path.isdir(fn):
tree_output(cap, fn, pattern, negate)
def func_output(cap, label, func):
if cap in entries:
data[label] = {'cap': cap, 'func': func}
def get_recent_logs(logs, verbosity):
"""Return list of filenames, sorted by mtime. On verbosity<9, only the first x"""
# Get the mtime of each logfile in a list of tuples and sort the tuples by mtime:
logs = sorted([(os.stat(e).st_mtime, e) for e in logs])
# On verbosity<9, return the latest <verbosity> elements, otherwise all logfiles:
return [x[1] for x in (logs[-verbosity:] if verbosity < 9 else logs)]
def include_inventory(archive, dir):
"""Add the inventory.xml to the archive, filled from the current data"""
info = StringIOmtime(make_inventory(data, dir))
archive.add_path_with_data(construct_filename(dir, "inventory.xml", {}), info)
def collect_data(subdir, archive):
process_lists = {}
for (k, v) in data.items():
name = construct_filename(subdir, k, v)
cap = v['cap']
filename = v.get('filename')
if "cmd_args" in v:
v['output'] = StringIOmtime()
if cap not in process_lists:
process_lists[cap] = []
process_lists[cap].append(ProcOutputAndArchive(v['cmd_args'], caps[cap][MAX_TIME], name, archive, v))
elif filename and (filename.startswith('/proc/') or
filename.startswith('/sys/')):
# proc files must be read into memory
try:
f = open(v["filename"], "rb")
s = f.read(unlimited_data and -1 or caps[cap][MAX_SIZE])
f.close()
if unlimited_data or caps[cap][MAX_SIZE] == -1 or \
cap_sizes[cap] < caps[cap][MAX_SIZE] or len(s) == 0:
v['output'] = StringIOmtime(s)
archive.add_path_with_data(name, v['output'])
v['md5'] = md5sum(v)
del v['output']
cap_sizes[cap] += len(s)
else:
log("Omitting %s, size constraint of %s exceeded" % (v['filename'], cap))
except IOError as e:
if e.errno != 2:
log("IOError reading %s: %s" % (filename, e))
elif "func" in v:
try:
s = no_unicode(v["func"](cap))
except Exception:
s = traceback.format_exc()
log(s)
if unlimited_data or caps[cap][MAX_SIZE] == -1 or \
cap_sizes[cap] < caps[cap][MAX_SIZE]:
v['output'] = StringIOmtime(s)
archive.add_path_with_data(name, v['output'])
v['md5'] = md5sum(v)
del v['output']
cap_sizes[cap] += len(s)
else:
log("Omitting %s, size constraint of %s exceeded" % (k, cap))
elif filename:
try:
archive.addRealFile(name, filename)
except:
pass
run_procs(process_lists.values())
# collect all output (output from processes)
for (k, v) in data.items():
if 'output' in v:
archive.add_path_with_data(construct_filename(subdir, k, v), v['output'])
v['md5'] = md5sum(v)
del v['output']
def usage():
return '''Usage: xenserver-status-report [OPTION]...
Capture information to help diagnose bugs.
--capabilities output capabilities informations
--output specify output format (tar, tar.bz2 or zip)
-s, --silent silent mode
--entries=<list> specify which capabilities (separated by commas)
-y, --yestoall confirm every file automatically
--outfd=<file> specify output file
-a, --all enable all capabilities
-u, --unlimited do not limit file size and execution time
-d, --debug enable debug output
--help this help'''
def main(argv=None): # pylint: disable=too-many-statements,too-many-branches
global ANSWER_YES_TO_ALL, SILENT_MODE
global entries, dbg
global unlimited_data, unlimited_time
output_type = 'tar.bz2'
output_fd = -1
# Set a default PATH
path = ['/opt/xensource/bin', '/usr/local/sbin', '/usr/local/bin',
'/usr/sbin', '/usr/bin', '/root/bin']
if 'PATH' in os.environ:
for element in os.environ['PATH'].split(':'):
if element not in path:
path.append(element)
os.environ['PATH'] = ':'.join(path)
if argv is None:
argv = sys.argv
# Ensure we have a clean bugtool log file
try:
os.remove(XEN_BUGTOOL_LOG)
except:
pass
log(" ".join(argv), print_output=False)
log("PATH=%s" % os.environ['PATH'], print_output=False)
try:
(options, params) = getopt.gnu_getopt(
argv, 'adsuy', ['capabilities', 'silent', 'yestoall', 'entries=',
'output=', 'outfd=', 'all', 'unlimited', 'debug',
'help'])
except getopt.GetoptError as opterr:
logging.fatal("xen-bugtool: %s", opterr)
logging.fatal(usage())
return 2
for (k, v) in options:
if k == '--help':
print(usage())
return 0
# we need access to privileged files, exit if we are not running as root
if os.getuid() != 0:
logging.fatal("Error: xen-bugtool must be run as root")
return 1
try:
load_plugins(True)
except:
pass
inventory = readKeyValueFile(XENSOURCE_INVENTORY)
if "OEM_BUILD_NUMBER" in inventory:
cap(CAP_OEM, PII_MAYBE, max_size=5*MB,
max_time=90)
if os.getenv('XEN_RT'):
entries = [CAP_BLOBS, CAP_BOOT_LOADER, CAP_CVSM, CAP_DEVICE_MODEL, CAP_DISK_INFO, CAP_FCOE, CAP_FIRSTBOOT,
CAP_HARDWARE_INFO, CAP_HOST_CRASHDUMP_LOGS, CAP_KERNEL_INFO, CAP_LOSETUP_A,
CAP_NETWORK_CONFIG, CAP_NETWORK_STATUS, CAP_PROCESS_LIST, CAP_HIGH_AVAILABILITY,
CAP_PAM, CAP_MULTIPATH,
CAP_SYSTEM_LOGS, CAP_SYSTEM_SERVICES, CAP_TAPDISK_LOGS,
CAP_XAPI_DEBUG, CAP_XAPI_SUBPROCESS, CAP_VTPM,
CAP_XENRT, CAP_XENSERVER_CONFIG, CAP_XENSERVER_DOMAINS, CAP_XENSERVER_DATABASES,
CAP_XENSERVER_INSTALL, CAP_XENSERVER_LOGS, CAP_XEN_INFO, CAP_XHA_LIVESET, CAP_YUM]
else:
entries = [cap_key for cap_key in caps if caps[cap_key][CHECKED]]
update_capabilities()
for (k, v) in options:
if k == '--capabilities':
print_capabilities()
return 0
if k == '--output':
if v in ['tar', 'tar.bz2', 'zip']:
output_type = v
else:
logging.fatal("Invalid output format '%s'", v)
return 2
# "-s" or "--silent" means suppress output (except for the final
# output filename at the end)
if k in ['-s', '--silent']:
SILENT_MODE = True
if k == '--entries' and v != '':
# parse verbosity option in entries string
entries = []
items = v.split(',')
for item in items:
item = item.split(':')
entries.append(item[0])
if item[0] in caps and len(item) > 1:
update_cap(item[0], VERBOSITY, min(9, max(1, int(item[1]))))
for key in entries:
if key not in caps:
logging.warning("--entries=%s is not known!", key)
entries.remove(key)
# If the user runs the script with "-y" or "--yestoall" we don't ask
# all the really annoying questions.
if k in ['-y', '--yestoall']:
ANSWER_YES_TO_ALL = True
if k == '--outfd':
output_fd = int(v)
try:
old = fcntl.fcntl(output_fd, fcntl.F_GETFD)
fcntl.fcntl(output_fd, fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)
except:
logging.fatal("Invalid output file descriptor: %d", output_fd)
return 2
elif k in ['-a', '--all']:
entries = list(caps.keys())
elif k in ['-u', '--unlimited']:
unlimited_data = True
unlimited_time = True
elif k in ['-d', '--debug']:
dbg = True
ProcOutput.debug = True
logging.getLogger().setLevel(logging.DEBUG) # Activates logging.debug("log messages")
if len(params) != 1:
logging.fatal("Invalid additional arguments: %s", str(params))
return 2
if output_fd != -1 and output_type != 'tar':
logging.fatal("Option '--outfd' only valid with '--output=tar'")
return 2
if ANSWER_YES_TO_ALL:
output("Warning: '--yestoall' argument provided, will not prompt for individual files.")
output('''
This application will collate the Xen dmesg output, details of the
hardware configuration of your machine, information about the build of
Xen that you are using, plus, if you allow it, various logs.
The collated information will be saved as a .%s for archiving or
sending to a Technical Support Representative.
The logs may contain private information, and if you are at all
worried about that, you should exit now, or you should explicitly
exclude those logs from the archive.
''' % output_type)
# assemble potential data
tree_output(CAP_BLOBS, XAPI_BLOBS)
file_output(CAP_BOOT_LOADER, [GRUB_BIOS_CONFIG])
file_output(CAP_BOOT_LOADER, [GRUB_EFI_CONFIG])
cmd_output(CAP_BOOT_LOADER, [LS, '-lR', '/boot'])
cmd_output(CAP_BOOT_LOADER, [MD5SUM, BOOT_KERNEL, BOOT_INITRD], label='vmlinuz-initrd.md5sum')
cmd_output(CAP_BOOT_LOADER, [EFIBOOTMGR, '-v'])
file_output(CAP_CRON, [CRON_DIRS + "/*"])
file_output(CAP_CRON, [os.path.join(CRON_SPOOL, '*')])
func_output(CAP_CVSM, 'csl_logs', csl_logs)
tree_output(CAP_DEVICE_MODEL, QEMU_DIR, QEMU_RESUME_RE)
cmd_output(CAP_DISK_INFO, [FDISK, '-l'])
file_output(CAP_DISK_INFO, [PROC_PARTITIONS, PROC_MOUNTS])
file_output(CAP_DISK_INFO, [FSTAB, ISCSI_CONF, ISCSI_INITIATOR])
cmd_output(CAP_DISK_INFO, [DF, '-alT'])
cmd_output(CAP_DISK_INFO, [DF, '-alTi'])
cmd_output(CAP_DISK_INFO, [DU, '-ax', '/'])
for d in disk_list():
cmd_output(CAP_DISK_INFO, [HDPARM, '-I', '/dev/%s' % d])
if len(pidof('iscsid')) != 0:
cmd_output(CAP_DISK_INFO, [ISCSIADM, '-m', 'node'])
cmd_output(CAP_DISK_INFO, [ISCSIADM, '-m', 'session', '-P', '3'])
cmd_output(CAP_DISK_INFO, [ISCSIADM, '-m', 'iface'])
cmd_output(CAP_DISK_INFO, [VGSCAN])
cmd_output(CAP_DISK_INFO, [PVS])
cmd_output(CAP_DISK_INFO, [VGS])
cmd_output(CAP_DISK_INFO, [LVS])
file_output(CAP_DISK_INFO, [LVM_CACHE, LVM_CONFIG])
cmd_output(CAP_DISK_INFO, [LS, '-R', '/sys/class/scsi_host'])
cmd_output(CAP_DISK_INFO, [LS, '-R', '/sys/class/scsi_disk'])
cmd_output(CAP_DISK_INFO, [LS, '-R', '/sys/class/fc_transport'])
cmd_output(CAP_DISK_INFO, [SG_MAP, '-x'])
func_output(CAP_DISK_INFO, 'scsi-hosts', dump_scsi_hosts)
cmd_output(CAP_DISK_INFO, [LVDISPLAY, '--map'])
cmd_output(CAP_BLOCK_SCHEDULER, [LSBLK, '-io', 'type,name,sched,tran,rota,log-sec,rq-size,vendor,model'], label='lsblk')
# mdadm information
cmd_output(CAP_DISK_INFO, [MDADM, '--detail-platform'])
cmd_output(CAP_DISK_INFO, [MDADM, '--detail', '--scan'])
file_output(CAP_DISK_INFO, [PROC_MDSTAT, ETC_MDADM_CONF, ETC_MDADM_MDADM_CONF])
for a in mdadm_arrays():
cmd_output(CAP_DISK_INFO, [MDADM, '--query', '--detail', a])
tree_output(CAP_FIRSTBOOT, FIRSTBOOT_DIR)
file_output(CAP_HARDWARE_INFO, [PROC_CPUINFO, PROC_MEMINFO, PROC_IOMEM, PROC_IOPORTS, PROC_INTERRUPTS])
file_output(CAP_HARDWARE_INFO, [PROC_SOFTIRQS])
file_output(CAP_HARDWARE_INFO, [PROC_BUDDYINFO])
file_output(CAP_HARDWARE_INFO, [PROC_PAGETYINFO])
file_output(CAP_HARDWARE_INFO, [PROC_SLABINFO])
file_output(CAP_HARDWARE_INFO, [PROC_VMSTAT])
file_output(CAP_HARDWARE_INFO, [PROC_ZONEINFO])
cmd_output(CAP_HARDWARE_INFO, [DMIDECODE])
cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-n'])
cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-tv'])
cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-vv'])
cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-nm'])
cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-nnm'])
cmd_output(CAP_HARDWARE_INFO, [ACPIDUMP])
file_output(CAP_HARDWARE_INFO, [PROC_USB_DEV, PROC_SCSI])
file_output(CAP_HARDWARE_INFO, [BOOT_TIME_CPUS, BOOT_TIME_MEMORY])
file_output(CAP_HARDWARE_INFO, [SYSCONFIG_HWCONF])
cmd_output(CAP_HARDWARE_INFO, [LS, '-lR', '/dev'])
cmd_output(CAP_HARDWARE_INFO, [XENPM, 'get-cpu-topology'])
cmd_output(CAP_HARDWARE_INFO, [XENPM, 'get-cpufreq-states'])
cmd_output(CAP_HARDWARE_INFO, [XENPM, 'get-cpuidle-states'])
tree_output(CAP_HARDWARE_INFO, SYS_EFIVARS)
# FIXME IDE?
for d in disk_list():
cmd_output(CAP_HDPARM_T, [HDPARM, '-tT', '/dev/%s' % d])
file_output(CAP_HIGH_AVAILABILITY, [XHAD_CONF, XHA_LOG])
tree_output(CAP_HOST_CRASHDUMP_LOGS, HOST_CRASHDUMPS_DIR,
HOST_CRASHDUMP_LOGS_EXCLUDES_RE, True)
file_output(CAP_KERNEL_INFO, [PROC_VERSION, PROC_MODULES, PROC_DEVICES,
PROC_FILESYSTEMS, PROC_CMDLINE])
cmd_output(CAP_KERNEL_INFO, [ZCAT, PROC_CONFIG], label='config')
cmd_output(CAP_KERNEL_INFO, [SYSCTL, '-A'])
file_output(CAP_KERNEL_INFO, [MODPROBE_CONF])
tree_output(CAP_KERNEL_INFO, MODPROBE_DIR)
func_output(CAP_KERNEL_INFO, 'modinfo', module_info)
cmd_output(CAP_KERNEL_INFO, QLOGIC_FW, label='qlogic_fw')
cmd_output(CAP_KERNEL_INFO, ULIMIT, label='ulimit-a')
cmd_output(CAP_KERNEL_INFO, [KPATCH, 'list'])
file_output(CAP_KERNEL_INFO, [SYS_KERNEL_NOTES])
file_output(CAP_KERNEL_INFO, [PROC_XSVERSION])
cmd_output(CAP_LOSETUP_A, [LOSETUP, '-a'])
file_output(CAP_MULTIPATH, [MULTIPATH_CONF, MULTIPATH_CONFD])
cmd_output(CAP_MULTIPATH, [DMSETUP, 'table'])
cmd_output(CAP_MULTIPATH, [DMSETUP, 'info'])
func_output(CAP_MULTIPATH, 'multipathd_topology', multipathd_topology)
file_output(CAP_NETWORK_CONFIG, [NET_UDEV_RULES])
tree_output(CAP_NETWORK_CONFIG, SYSCONFIG_RENAME_DATA_DIR)
file_output(CAP_NETWORK_CONFIG, [INTERFACE_RENAME_LOG])
file_output(CAP_NETWORK_CONFIG, [NETWORK_CONF])
file_output(CAP_NETWORK_CONFIG, [NETWORK_DBCACHE])
file_output(CAP_NETWORK_CONFIG, [NETWORKD_DB])
tree_output(CAP_NETWORK_CONFIG, SYSCONFIG_NETWORK_SCRIPTS, IFCFG_RE)
tree_output(CAP_NETWORK_CONFIG, SYSCONFIG_NETWORK_SCRIPTS, ROUTE_RE)
file_output(CAP_NETWORK_CONFIG, [SYSCONFIG_NETWORK, RESOLV_CONF, NSSWITCH_CONF, HOSTS])
file_output(CAP_NETWORK_CONFIG, [CHRONY_CONF, IPTABLES_CONFIG, HOSTS_ALLOW, HOSTS_DENY])
file_output(CAP_NETWORK_CONFIG, [OPENVSWITCH_CONF, OPENVSWITCH_CONF_DB])
cmd_output(CAP_NETWORK_STATUS, [IFCONFIG, '-a'])
cmd_output(CAP_NETWORK_STATUS, [ROUTE, '-n'])
cmd_output(CAP_NETWORK_STATUS, [ARP, '-n'])
cmd_output(CAP_NETWORK_STATUS, [NETSTAT, '-anop'])
cmd_output(CAP_NETWORK_STATUS, [NETSTAT, '-s'])
cmd_output(CAP_NETWORK_STATUS, [NETSTAT, '-gn'])
cmd_output(CAP_NETWORK_STATUS, [NSTAT, '-a'])
cmd_output(CAP_NETWORK_STATUS, [SS, '-nampi'])
tree_output(CAP_NETWORK_STATUS, DHCP_LEASE_DIR)
cmd_output(CAP_NETWORK_STATUS, [ARPTABLES, '-nvL'])
cmd_output(CAP_NETWORK_STATUS, [EBTABLES, '-L'])
cmd_output(CAP_NETWORK_STATUS, [IPTABLES, '-nvL'])
cmd_output(CAP_NETWORK_STATUS, [BRCTL, 'show'])
cmd_output(CAP_NETWORK_STATUS, [BIOSDEVNAME, '-d'])
for p in os.listdir('/sys/class/net/'):
if os.path.isdir('/sys/class/net/%s/bridge' % p):
cmd_output(CAP_NETWORK_STATUS, [BRCTL, 'showmacs', p])
else:
try:
f = open('/sys/class/net/%s/type' % p, 'r')
t = f.readline()
f.close()
if int(t) == 1:
# ARPHRD_ETHER
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, p])
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-S', p])
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-k', p])
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-i', p])
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-c', p])
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-g', p])
cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-l', p])
except:
pass
tree_output(CAP_NETWORK_STATUS, PROC_NET_BONDING_DIR)
tree_output(CAP_NETWORK_STATUS, PROC_NET_VLAN_DIR)
cmd_output(CAP_NETWORK_STATUS, [TC, '-s', 'qdisc'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'activity'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'clients'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'ntpdata'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'rtcdata'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'serverstats'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'smoothing'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'sources', '-v'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'sourcestats', '-v'])
cmd_output(CAP_NETWORK_STATUS, [CHRONYC, 'tracking'])
file_output(CAP_NETWORK_STATUS, [PROC_NET_SOFTNET_STAT])
tree_output(CAP_NETWORK_STATUS, OPENVSWITCH_CORE_DIR)
if os.path.exists(OPENVSWITCH_VSWITCHD_PID) and CAP_NETWORK_STATUS in entries:
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list', 'open_vswitch'])
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list', 'bridge'])
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list', 'port'])
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list', 'interface'])
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list-br'])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'upcall/show'])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'memory/show'])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'coverage/show'])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'dpif/show'])
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list', 'controller'])
for b in br_list():
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list-ports', b])
cmd_output(CAP_NETWORK_STATUS, [OVS_VSCTL, 'list-ifaces', b])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'fdb/show', b])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'mdb/show', b])
# Assumed br has one-to-one mapping to dp
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'dpif/dump-flows', b])
cmd_output(CAP_NETWORK_STATUS, [OVS_OFCTL, 'show', b])
cmd_output(CAP_NETWORK_STATUS, [OVS_OFCTL, 'dump-flows', b])
cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'show'])
cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'show', '-s'])
for d in dp_list():
cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'dump-flows', d])
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'bond/list'])
for b in bond_list():
cmd_output(CAP_NETWORK_STATUS, [OVS_APPCTL, 'bond/show', b])
tree_output(CAP_NETWORK_STATUS, SYS_NETBACK_DEBUG)
cmd_output(CAP_FCOE, [FCOEADM, '-i'])
cmd_output(CAP_FCOE, [FCOEADM, '-t'])
tree_output(CAP_FCOE, FCOE_CONFIG_DIR)
file_output(CAP_FCOE, [FCOE_BLACKLIST_FILE])
for p in os.listdir('/sys/class/net/'):