[PATCH V2 0/4] Power (ppc) support patches

v1 -> v2: * Re-wrote commit message for patch 2/5 (now 2/4) with 80 characters/line * Joined patches 3/5 and 4/5 in only one (now 3/4) about sosreport support V1: This patch set enables Power(ppc) support by default on Kimchi. Whithout them, the upstream code of Kimchi is not fully compatible with the Power architecture. Eli Qiao (1): Support tablet type as input device in VM's XML. Mark Wu (1): Add sos plugin for kimchi Paulo Vital (2): PowerKVM: Workaround of numpy byte order bug on PowerPC Add PowerKVM information as ISO otpion to installation. contrib/kimchi.spec.fedora.in | 3 +++ src/kimchi/Makefile.am | 4 +++- src/kimchi/isoinfo.py | 1 + src/kimchi/osinfo.py | 5 +++-- src/kimchi/sos.py | 37 +++++++++++++++++++++++++++++++++++++ src/kimchi/vmtemplate.py | 5 +++++ src/kimchi/websocket.py | 7 +++++-- 7 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 src/kimchi/sos.py -- 1.9.3

A numpy byte order bug cause the novnc handshake failure. To workaround this problem, we swap bytes after unmasking. After it's fixed on the numpy side, we can drop this patch. Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- src/kimchi/websocket.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kimchi/websocket.py b/src/kimchi/websocket.py index a98fc6d..870c453 100644 --- a/src/kimchi/websocket.py +++ b/src/kimchi/websocket.py @@ -16,7 +16,7 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates ''' -import os, sys, time, errno, signal, socket, traceback, select +import os, sys, time, errno, signal, socket, traceback, select, platform import array, struct from base64 import b64encode, b64decode @@ -251,7 +251,10 @@ Sec-WebSocket-Accept: %s\r data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'), offset=pstart, count=int(plen / 4)) #b = numpy.bitwise_xor(data, mask).data - b = numpy.bitwise_xor(data, mask).tostring() + if platform.machine().startswith('ppc'): + b = numpy.bitwise_xor(data, mask).byteswap().tostring() + else: + b = numpy.bitwise_xor(data, mask).tostring() if plen % 4: #print("Partial unmask") -- 1.9.3

From: Eli Qiao <taget@linux.vnet.ibm.com> Add support to tablet type as input devive into vmtemplate.py to provide an absolute pointer device. This also helps with getting a consistent mouse cursor position in VNC. Signed-off-by: Eli Qiao <taget@linux.vnet.ibm.com> --- src/kimchi/osinfo.py | 5 +++-- src/kimchi/vmtemplate.py | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py index 1ad353c..6ee5e48 100644 --- a/src/kimchi/osinfo.py +++ b/src/kimchi/osinfo.py @@ -49,11 +49,12 @@ template_specs = {'x86': {'old': dict(common_spec, disk_bus='ide', nic_model='spapr-vlan', cdrom_bus='scsi', kbd_bus='usb', mouse_bus='usb', - memory=1280), + tablet_bus='usb', memory=1280), 'modern': dict(common_spec, disk_bus='virtio', nic_model='virtio', cdrom_bus='scsi', kbd_bus='usb', - mouse_bus='usb', memory=1280)}} + mouse_bus='usb', tablet_bus='usb', + memory=1280)}} modern_version_bases = {'x86': {'debian': '6.0', 'ubuntu': '7.10', diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py index 761bac5..ddb1f35 100644 --- a/src/kimchi/vmtemplate.py +++ b/src/kimchi/vmtemplate.py @@ -349,12 +349,17 @@ drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/> keyboard = """ <input type='kbd' bus='%(kbd_bus)s'> </input> """ + tablet = """ + <input type='tablet' bus='%(kbd_bus)s'> </input> + """ input_output = "" if 'mouse_bus' in self.info.keys(): input_output += mouse % self.info if 'kbd_bus' in self.info.keys(): input_output += keyboard % self.info + if 'tablet_bus' in self.info.keys(): + input_output += tablet % self.info if 'sound_model' in self.info.keys(): input_output += sound % self.info return input_output -- 1.9.3

Applied. Thanks. Regards, Aline Manera

From: Mark Wu <wudxw@linux.vnet.ibm.com> This patches adds a sos plugin to collect kimchi's configuration, log files and other information for diagnosis. Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Signed-off-by: Eli Qiao <taget@linux.vnet.ibm.com> --- contrib/kimchi.spec.fedora.in | 3 +++ src/kimchi/Makefile.am | 4 +++- src/kimchi/sos.py | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/kimchi/sos.py diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in index 5766784..78dd423 100644 --- a/contrib/kimchi.spec.fedora.in +++ b/contrib/kimchi.spec.fedora.in @@ -78,6 +78,8 @@ make %install rm -rf %{buildroot} make DESTDIR=%{buildroot} install +install -Dm 0644 src/kimchi/sos.py \ + %{buildroot}/%{python_sitelib}/sos/plugins/kimchi.py %if 0%{?with_systemd} # Install the systemd scripts @@ -158,6 +160,7 @@ rm -rf $RPM_BUILD_ROOT %{python_sitelib}/kimchi/model/*.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/kimchi-guest.png diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am index e2b5bea..a405782 100644 --- a/src/kimchi/Makefile.am +++ b/src/kimchi/Makefile.am @@ -19,10 +19,12 @@ SUBDIRS = control model -kimchi_PYTHON = $(filter-out config.py, $(wildcard *.py)) +kimchi_PYTHON = $(filter-out config.py sos.py, $(wildcard *.py)) nodist_kimchi_PYTHON = config.py +dist_noinst_PYTHON = sos.py + EXTRA_DIST = \ API.json \ config.py.in diff --git a/src/kimchi/sos.py b/src/kimchi/sos.py new file mode 100644 index 0000000..8a0e34a --- /dev/null +++ b/src/kimchi/sos.py @@ -0,0 +1,37 @@ +### This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. + +## This program 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 General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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) -- 1.9.3

On 08/25/2014 08:18 PM, Paulo Vital wrote:
From: Mark Wu <wudxw@linux.vnet.ibm.com>
This patches adds a sos plugin to collect kimchi's configuration, log files and other information for diagnosis.
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Signed-off-by: Eli Qiao <taget@linux.vnet.ibm.com> --- contrib/kimchi.spec.fedora.in | 3 +++ src/kimchi/Makefile.am | 4 +++- src/kimchi/sos.py | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/kimchi/sos.py
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in index 5766784..78dd423 100644 --- a/contrib/kimchi.spec.fedora.in +++ b/contrib/kimchi.spec.fedora.in @@ -78,6 +78,8 @@ make %install rm -rf %{buildroot} make DESTDIR=%{buildroot} install +install -Dm 0644 src/kimchi/sos.py \ + %{buildroot}/%{python_sitelib}/sos/plugins/kimchi.py
%if 0%{?with_systemd} # Install the systemd scripts @@ -158,6 +160,7 @@ rm -rf $RPM_BUILD_ROOT %{python_sitelib}/kimchi/model/*.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/kimchi-guest.png diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am index e2b5bea..a405782 100644 --- a/src/kimchi/Makefile.am +++ b/src/kimchi/Makefile.am @@ -19,10 +19,12 @@
SUBDIRS = control model
-kimchi_PYTHON = $(filter-out config.py, $(wildcard *.py)) +kimchi_PYTHON = $(filter-out config.py sos.py, $(wildcard *.py))
nodist_kimchi_PYTHON = config.py
+dist_noinst_PYTHON = sos.py + EXTRA_DIST = \ API.json \ config.py.in diff --git a/src/kimchi/sos.py b/src/kimchi/sos.py new file mode 100644 index 0000000..8a0e34a --- /dev/null +++ b/src/kimchi/sos.py @@ -0,0 +1,37 @@ +### This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. + +## This program 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 General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +
This license header differs in terms of layout from the others. Any special reason? What about the copyright note?
+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)

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- src/kimchi/isoinfo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/kimchi/isoinfo.py b/src/kimchi/isoinfo.py index 532b8bf..fb87949 100644 --- a/src/kimchi/isoinfo.py +++ b/src/kimchi/isoinfo.py @@ -115,6 +115,7 @@ iso_dir = [ ('fedora', lambda m: m.group(1), 'Fedora[ -](\d+)'), ('fedora', lambda m: m.group(1), 'Fedora.*-(\d+)-'), ('gentoo', lambda m: m.group(1), 'Gentoo Linux \w+ (\d+)'), + ('powerkvm', 'live_cd', 'POWERKVM_LIVECD'), ] -- 1.9.3

Applied. Thanks. Regards, Aline Manera

I will apply patches 2 and 4 right now. About patch 1: I still need to check the license guide carefully before accepting the changes. About patch 3: You need to adjust the license header layout and add the copyright. Next time, please, send a separated patches for 1 and 3. On 08/25/2014 08:18 PM, Paulo Vital wrote:
v1 -> v2: * Re-wrote commit message for patch 2/5 (now 2/4) with 80 characters/line * Joined patches 3/5 and 4/5 in only one (now 3/4) about sosreport support
V1: This patch set enables Power(ppc) support by default on Kimchi.
Whithout them, the upstream code of Kimchi is not fully compatible with the Power architecture.
Eli Qiao (1): Support tablet type as input device in VM's XML.
Mark Wu (1): Add sos plugin for kimchi
Paulo Vital (2): PowerKVM: Workaround of numpy byte order bug on PowerPC Add PowerKVM information as ISO otpion to installation.
contrib/kimchi.spec.fedora.in | 3 +++ src/kimchi/Makefile.am | 4 +++- src/kimchi/isoinfo.py | 1 + src/kimchi/osinfo.py | 5 +++-- src/kimchi/sos.py | 37 +++++++++++++++++++++++++++++++++++++ src/kimchi/vmtemplate.py | 5 +++++ src/kimchi/websocket.py | 7 +++++-- 7 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 src/kimchi/sos.py

On Wed, 2014-08-27 at 14:54 -0300, Aline Manera wrote:
I will apply patches 2 and 4 right now.
Thanks!
About patch 1: I still need to check the license guide carefully before accepting the changes. About patch 3: You need to adjust the license header layout and add the copyright.
Next time, please, send a separated patches for 1 and 3.
Got it!
On 08/25/2014 08:18 PM, Paulo Vital wrote:
v1 -> v2: * Re-wrote commit message for patch 2/5 (now 2/4) with 80 characters/line * Joined patches 3/5 and 4/5 in only one (now 3/4) about sosreport support
V1: This patch set enables Power(ppc) support by default on Kimchi.
Whithout them, the upstream code of Kimchi is not fully compatible with the Power architecture.
Eli Qiao (1): Support tablet type as input device in VM's XML.
Mark Wu (1): Add sos plugin for kimchi
Paulo Vital (2): PowerKVM: Workaround of numpy byte order bug on PowerPC Add PowerKVM information as ISO otpion to installation.
contrib/kimchi.spec.fedora.in | 3 +++ src/kimchi/Makefile.am | 4 +++- src/kimchi/isoinfo.py | 1 + src/kimchi/osinfo.py | 5 +++-- src/kimchi/sos.py | 37 +++++++++++++++++++++++++++++++++++++ src/kimchi/vmtemplate.py | 5 +++++ src/kimchi/websocket.py | 7 +++++-- 7 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 src/kimchi/sos.py
participants (3)
-
Aline Manera
-
Paulo Ricardo Paz Vital
-
Paulo Vital