[Kimchi-devel] [PATCH V2] Add sos (sosreport) plugin for kimchi

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Mon Nov 17 19:05:48 UTC 2014


Any update here ?

On 11/06/2014 11:28 AM, Rodrigo Trujillo wrote:
> This patches adds a sos plugin to collect kimchi's configuration,
> log files and other information for diagnosis.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
> Signed-off-by: Eli Qiao <taget at linux.vnet.ibm.com>
> Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
> ---
>   Makefile.am                   |  3 +++
>   contrib/kimchi.spec.fedora.in |  3 +++
>   src/Makefile.am               |  1 +
>   src/sos.py                    | 43 +++++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 50 insertions(+)
>   create mode 100644 src/sos.py
>
> diff --git a/Makefile.am b/Makefile.am
> index ec88787..53b6b40 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -70,10 +70,13 @@ install-deb: install
>   	cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
>   	$(MKDIR_P) $(DESTDIR)/etc/init
>   	$(MKDIR_P) $(DESTDIR)/usr/lib/firewalld/services
> +	$(MKDIR_P) $(DESTDIR)/usr/share/sosreport/sos/plugins
>   	cp -R $(top_srcdir)/contrib/kimchid-upstart.conf.debian \
>   		$(DESTDIR)/etc/init/kimchid.conf
>   	cp -R $(top_srcdir)/src/firewalld.xml \
>   		$(DESTDIR)/usr/lib/firewalld/services/kimchid.xml
> +	cp -R $(top_srcdir)/src/sos.py \
> +		$(DESTDIR)/usr/share/sosreport/sos/plugins/kimchi.py
>
>
>   deb: contrib/make-deb.sh
> diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
> index 236c862..4d23ad0 100644
> --- a/contrib/kimchi.spec.fedora.in
> +++ b/contrib/kimchi.spec.fedora.in
> @@ -80,6 +80,8 @@ make
>   %install
>   rm -rf %{buildroot}
>   make DESTDIR=%{buildroot} install
> +install -Dm 0644 src/sos.py \
> +                 %{buildroot}/%{python_sitelib}/sos/plugins/kimchi.py
>
>   %if 0%{?with_systemd}
>   # Install the systemd scripts
> @@ -161,6 +163,7 @@ rm -rf $RPM_BUILD_ROOT
>   %{python_sitelib}/kimchi/xmlutils/*.py*
>   %{python_sitelib}/kimchi/API.json
>   %{python_sitelib}/kimchi/plugins/*.py*
> +%{python_sitelib}/sos/plugins/kimchi.py*
>   %{_datadir}/kimchi/doc/API.md
>   %{_datadir}/kimchi/doc/README.md
>   %{_datadir}/kimchi/doc/README-federation.md
> diff --git a/src/Makefile.am b/src/Makefile.am
> index dfeb24e..46ca1ab 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -23,6 +23,7 @@ EXTRA_DIST = kimchid.in \
>   	kimchi.conf.in \
>   	nginx.conf.in \
>   	firewalld.xml \
> +	sos.py \
>   	$(NULL)
>
>   bin_SCRIPTS = kimchid
> diff --git a/src/sos.py b/src/sos.py
> new file mode 100644
> index 0000000..5d1fa3f
> --- /dev/null
> +++ b/src/sos.py
> @@ -0,0 +1,43 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2014
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU Lesser General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +#
> +# 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
> +
> +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
> +from sos.utilities import sos_get_command_output
> +
> +
> +class Kimchi(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
> +    """
> +    kimchi-related information
> +    """
> +
> +    plugin_name = 'kimchi'
> +
> +    def setup(self):
> +        self.add_copy_specs([
> +            "/etc/kimchi/",
> +            "/var/log/kimchi*"
> +        ])
> +        self.add_cmd_output("virsh pool-list --details")
> +        rc, out, _ = sos_get_command_output('virsh pool-list')
> +        if rc == 0:
> +            for pool in out.splitlines()[2:]:
> +                if pool:
> +                    pool_name = pool.split()[0]
> +                    self.add_cmd_output("virsh vol-list --pool %s --details"
> +                                        % pool_name)




More information about the Kimchi-devel mailing list