Accepting request 520003 from home:jfehlig:branches:Virtualization

- Add a supportconfig plugin
  qemu-supportconfig
  FATE#323661

OBS-URL: https://build.opensuse.org/request/show/520003
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=360
This commit is contained in:
Bruce Rogers 2017-08-31 18:04:33 +00:00 committed by Git OBS Bridge
parent 7236326045
commit d00064eab3
8 changed files with 125 additions and 12 deletions

View File

@ -97,13 +97,13 @@ index 67a0a4a58b..1c73e5aeae 100644
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "integer");
+ return;
+ }
}
+
+ parse_str(siv, name, true, errp);
+
+ if (!siv->ranges) {
+ goto error;
}
+ }
+
+ if (!siv->cur_range) {
+ Range *r;

View File

@ -17,18 +17,18 @@ diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor
index 79313a7f7a..e00194a649 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -55,6 +55,14 @@ static void test_visitor_in_int(TestInputVisitorData *data,
v = visitor_input_test_init(data, "-42");
+ visit_type_int(v, NULL, &res, &err);
+ g_assert(!err);
+ g_assert_cmpint(res, ==, value);
@@ -58,6 +58,14 @@ static void test_visitor_in_int(TestInputVisitorData *data,
visit_type_int(v, NULL, &res, &err);
g_assert(!err);
g_assert_cmpint(res, ==, value);
+ visitor_input_teardown(data, unused);
+
+ value = INT64_MAX;
+ v = visitor_input_test_init(data, g_strdup_printf("%" PRId64, value));
+
visit_type_int(v, NULL, &res, &err);
g_assert(!err);
g_assert_cmpint(res, ==, value);
+ visit_type_int(v, NULL, &res, &err);
+ g_assert(!err);
+ g_assert_cmpint(res, ==, value);
v = visitor_input_test_init(data, "not an int");

78
qemu-supportconfig Normal file
View File

@ -0,0 +1,78 @@
#!/bin/bash
#############################################################
# Name: Supportconfig Plugin for QEMU/KVM
# Description: Gathers important troubleshooting information
# about QEMU
# Author: Jim Fehlig <jfehlig@suse.com>
#############################################################
RCFILE="/usr/lib/supportconfig/resources/scplugin.rc"
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 ! rpm_verify qemu; then
echo "Skipped"
exit 0
fi
# skip if the host is xen
echo "#==[ Checking if booted Xen ]=================================#"
if [ -d /proc/xen ] && [ -e /proc/xen/capabilities ] && [ `cat /proc/xen/capabilities` = "control_d" ]; then
echo "Yes"
echo "Skipped"
exit 0
else
echo "No"
echo
fi
# basic system information
plugin_command "uname -r"
plugin_command "lscpu"
plugin_command "kvm_stat -1"
plugin_command "lsmod | grep ^kvm"
for MODULE in `lsmod | grep ^kvm | cut -d ' ' -f 1`; do
plugin_command "modinfo $MODULE"
done
plugin_command "ps -ef | grep qemu"
# list contents of common config and image directories
plugin_command "ls -alR /var/lib/kvm/images/"
# 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 KVM host"
fi
plugin_command "route -n"
plugin_command "arp -v"
plugin_command "ip link show type bridge"
plugin_command "bridge link show"
echo "Done"

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 31 18:34:27 UTC 2017 - jfehlig@suse.com
- Add a supportconfig plugin
qemu-supportconfig
FATE#323661
-------------------------------------------------------------------
Wed Aug 30 19:52:26 UTC 2017 - brogers@suse.com

View File

@ -129,6 +129,7 @@ Source12: supported.x86.txt
Source13: supported.s390.txt
Source14: supported.arm.txt
Source15: supported.ppc.txt
Source16: qemu-supportconfig
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch
@ -1201,6 +1202,9 @@ install -D -m 0644 %{SOURCE13} %{buildroot}%{_docdir}/qemu-s390/supported.txt
install -D -m 0644 %{SOURCE14} %{buildroot}%{_docdir}/qemu-arm/supported.txt
install -D -m 0644 %{SOURCE15} %{buildroot}%{_docdir}/qemu-ppc/supported.txt
%endif
# install supportconfig plugin
mkdir -p %{buildroot}%{_libexecdir}/supportconfig/plugins
install -D -m 0755 %{SOURCE16} %{buildroot}%{_libexecdir}/supportconfig/plugins/qemu
%if %{legacy_qemu_kvm}
cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh
@ -1363,6 +1367,9 @@ fi
%_datadir/%name/qemu_logo_no_text.svg
%dir %_sysconfdir/%name
%_datadir/%name/qemu-ifup
%dir %_libexecdir/supportconfig
%dir %_libexecdir/supportconfig/plugins
%_libexecdir/supportconfig/plugins/qemu
%if %{kvm_available}
%if 0%{?suse_version} <= 1320
%_bindir/kvm_stat

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 31 18:34:27 UTC 2017 - jfehlig@suse.com
- Add a supportconfig plugin
qemu-supportconfig
FATE#323661
-------------------------------------------------------------------
Wed Aug 30 19:52:26 UTC 2017 - brogers@suse.com

View File

@ -129,6 +129,7 @@ Source12: supported.x86.txt
Source13: supported.s390.txt
Source14: supported.arm.txt
Source15: supported.ppc.txt
Source16: qemu-supportconfig
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch
@ -1201,6 +1202,9 @@ install -D -m 0644 %{SOURCE13} %{buildroot}%{_docdir}/qemu-s390/supported.txt
install -D -m 0644 %{SOURCE14} %{buildroot}%{_docdir}/qemu-arm/supported.txt
install -D -m 0644 %{SOURCE15} %{buildroot}%{_docdir}/qemu-ppc/supported.txt
%endif
# install supportconfig plugin
mkdir -p %{buildroot}%{_libexecdir}/supportconfig/plugins
install -D -m 0755 %{SOURCE16} %{buildroot}%{_libexecdir}/supportconfig/plugins/qemu
%if %{legacy_qemu_kvm}
cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh
@ -1363,6 +1367,9 @@ fi
%_datadir/%name/qemu_logo_no_text.svg
%dir %_sysconfdir/%name
%_datadir/%name/qemu-ifup
%dir %_libexecdir/supportconfig
%dir %_libexecdir/supportconfig/plugins
%_libexecdir/supportconfig/plugins/qemu
%if %{kvm_available}
%if 0%{?suse_version} <= 1320
%_bindir/kvm_stat

View File

@ -129,6 +129,7 @@ Source12: supported.x86.txt
Source13: supported.s390.txt
Source14: supported.arm.txt
Source15: supported.ppc.txt
Source16: qemu-supportconfig
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
PATCH_FILES
@ -1137,6 +1138,9 @@ install -D -m 0644 %{SOURCE13} %{buildroot}%{_docdir}/qemu-s390/supported.txt
install -D -m 0644 %{SOURCE14} %{buildroot}%{_docdir}/qemu-arm/supported.txt
install -D -m 0644 %{SOURCE15} %{buildroot}%{_docdir}/qemu-ppc/supported.txt
%endif
# install supportconfig plugin
mkdir -p %{buildroot}%{_libexecdir}/supportconfig/plugins
install -D -m 0755 %{SOURCE16} %{buildroot}%{_libexecdir}/supportconfig/plugins/qemu
%if %{legacy_qemu_kvm}
cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh
@ -1299,6 +1303,9 @@ fi
%_datadir/%name/qemu_logo_no_text.svg
%dir %_sysconfdir/%name
%_datadir/%name/qemu-ifup
%dir %_libexecdir/supportconfig
%dir %_libexecdir/supportconfig/plugins
%_libexecdir/supportconfig/plugins/qemu
%if %{kvm_available}
%if 0%{?suse_version} <= 1320
%_bindir/kvm_stat