summaryrefslogtreecommitdiff
path: root/xen-supportconfig
blob: 4d8c4ec326180418830fe46d4fb57a25e0e0d36f (plain)
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
#!/bin/bash
#############################################################
# Name:        Supportconfig Plugin for Xen
# Description: Gathers important troubleshooting information
#              about Xen and its tools
# Author:      Jim Fehlig <jfehlig@suse.com>
#############################################################

# TODO:
# - Anything needed for UEFI?
#

RCFILE="/usr/lib/supportconfig/resources/scplugin.rc"

GRUB2_CONF_FILES="/etc/default/grub"
XEN_CONF_FILES="/etc/xen/xl.conf /etc/sysconfig/xencommons /etc/sysconfig/xendomains"
XEN_SERVICES="xencommons xendomains xen-watchdog"
VM_CONF_FILES=""
XEN_LOG_FILES=""

if [ -s $RCFILE ]; then
    if ! source $RCFILE; then
        echo "ERROR: Initializing resource file: $RCFILE" >&2
        exit 1
    fi
fi

rpm_verify() {
    thisrpm="$1"
    local ret=0

    echo
    echo "#==[ Validating RPM ]=================================#"
    if rpm -q "$thisrpm" >/dev/null 2>&1; then
        echo "# rpm -V $thisrpm"

        if rpm -V "$thisrpm"; then
            echo "Status: Passed"
        else
            echo "Status: WARNING"
        fi
    else
        echo "package $thisrpm is not installed"
	ret=1
    fi
    echo
    return $ret
}

# if no xen package we are done
if ! rpm_verify xen; then
    echo "Skipped"
    exit 0
fi

# if not a xen host (dom0) we are done
echo "#==[ Checking if booted Xen ]=================================#"
if [ ! -d /proc/xen ] || [ ! -e /proc/xen/capabilities ] || [ `cat /proc/xen/capabilities` != "control_d" ]; then
    echo "No"
    echo "Skipped"
    exit 0
else
    echo "Yes"
    echo
fi

# basic system information:
plugin_command "uname -r"
for service in $XEN_SERVICES; do
    plugin_command "systemctl status $service"
    plugin_command "systemctl is-enabled $service"
done
plugin_command "lscpu"
plugin_command "xl info --numa"
plugin_command "xl list"
plugin_command "xl pci-assignable-list"
plugin_command "xenstore-ls"
plugin_command "ps -ef | grep xen"
# dump grub2-related conf files
pconf_files "$GRUB2_CONF_FILES"
# dump Xen-related conf files
pconf_files "$XEN_CONF_FILES"

# detailed system info:
plugin_command "xl list --long"
plugin_command "xl dmesg"
# network-related info often useful for debugging
if [ systemctl is-enabled NetworkManager.service 2>&1 > /dev/null ]; then
    echo "NOTE: NetworkManager should not be enabled on a Xen host"
fi
plugin_command "route -n"
plugin_command "arp -v"
plugin_command "ip link show type bridge"
plugin_command "bridge link show"
# list contents of common config and image directories
plugin_command "ls -alR /etc/xen/vm/"
plugin_command "ls -alR /etc/xen/auto/"
plugin_command "ls -alR /var/lib/xen/images/"
# dump VM-related conf files
test -d /etc/xen/vm && VM_CONF_FILES=$(find -L /etc/xen/vm/ -type f | sort)
pconf_files "$VM_CONF_FILES"
# dump log files
test -d /var/log/xen && XEN_LOG_FILES="$(find -L /var/log/xen/ -type f | grep 'log$' | sort)"
plog_files 0 "$XEN_LOG_FILES"

echo "Done"