On 27/01/2015 11:25, Paulo Ricardo Paz Vital wrote:
Aline, the point is not the kdb_bus used to configure the keyboard, but the type.

You are right.


Ramon, I guess you can update, on osinfo.py file, the common_spec dictionary to add the kdb_type value - this will be common to all cases. Then, you can add a new key into power specs specific to ppc64le that have this different value. Anyway, a little modification on vmtemplate.py will be necessary to use the new variable/key.

+1


On Tue Jan 27 2015 at 2:14:15 PM Aline Manera <alinefm@linux.vnet.ibm.com> wrote:

On 27/01/2015 10:38, Ramon Medeiros wrote:
> Changes
>
> v2:
>
> Improve coding by removing duplicated actions
> Fix typo
>
> On LE systems, some changes on libvirt xml is needed. The input device
> for keyboard is not kbd anymore, the architecture is still ppc64 and the
> qemu binary is not qemu-kvm as in the other archs.
>
> Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com>
> ---
>   src/kimchi/config.py.in  | 11 +++++++++--
>   src/kimchi/osinfo.py     |  6 +++++-
>   src/kimchi/vmtemplate.py | 11 +++++++++--
>   3 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
> index 83a5dd0..d5e0f6c 100644
> --- a/src/kimchi/config.py.in
> +++ b/src/kimchi/config.py.in
> @@ -68,12 +68,19 @@ def find_qemu_binary(find_emulator=False):
>           raise Exception("Unable to get qemu binary location: %s" % e)
>       try:
>           xml = connect.getCapabilities()
> +
> +        # On Little Endian system, the qemu binary is
> +        # qemu-system-ppc64, not qemu-system-ppc64le as expected
> +        arch = platform.machine()
> +        if arch == "ppc64le":
> +            arch = "ppc64"
> +
>           if find_emulator:
>               expr = "/capabilities/guest/arch[@name='%s']\
> -                    /emulator" % platform.machine()
> +                    /emulator" % arch
>           else:
>               expr = "/capabilities/guest/arch[@name='%s']\
> -                    /domain[@type='kvm']/emulator" % platform.machine()
> +                    /domain[@type='kvm']/emulator" % arch
>           res = xpath_get_text(xml, expr)
>           location = res[0]
>       except Exception, e:
> diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
> index 0e16b50..9bfd148 100644
> --- a/src/kimchi/osinfo.py
> +++ b/src/kimchi/osinfo.py
> @@ -29,7 +29,7 @@ from kimchi.config import paths
>
>
>   SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'),
> -                   'power': ('ppc', 'ppc64')}
> +                   'power': ('ppc', 'ppc64', 'ppc64le')}

In osinfo.py we have a dict for each supported arch.

template_specs = {'x86': {'old': dict(common_spec, disk_bus='ide',
                                       nic_model='e1000',
sound_model='ich6'),
                           'modern': dict(common_spec, disk_bus='virtio',
nic_model='virtio',
sound_model='ich6')},
                   'power': {'old': dict(common_spec, disk_bus='scsi',
nic_model='spapr-vlan',
cdrom_bus='scsi',
                                         kbd_bus='usb', mouse_bus='usb',
                                         tablet_bus='usb', memory=1280),
                             'modern': dict(common_spec, disk_bus='virtio',
nic_model='virtio',
cdrom_bus='scsi', kbd_bus='usb',
                                            mouse_bus='usb',
tablet_bus='usb',
                                            memory=1280)}}

You should add the new ppc64le there with the right bus values.
So for ppc64el we should point the kbd_bus="keyboard"

And vmtemplate.py will not change.

>
>
>   common_spec = {'cpus': 1, 'memory': 1024, 'disks': [{'index': 0, 'size': 10}],
> @@ -94,6 +94,10 @@ def lookup(distro, version):
>       params['os_version'] = version
>       arch = _get_arch()
>
> +    # set up arch to ppc64 instead of ppc64le due to libvirt compatibility
> +    if params["arch"] == "ppc64le":
> +        params["arch"] = "ppc64"
> +
>       if distro in modern_version_bases[arch]:
>           if LooseVersion(version) >= LooseVersion(
>                   modern_version_bases[arch][distro]):
> diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
> index e41a959..bcfbab6 100644
> --- a/src/kimchi/vmtemplate.py
> +++ b/src/kimchi/vmtemplate.py
> @@ -245,9 +245,16 @@ class VMTemplate(object):
>           mouse = """
>               <input type='mouse' bus='%(mouse_bus)s'/>
>           """
> +
> +        # PPC64EL does not uses kbd
> +        self.info["kbd_type"] = "kbd"
> +        if os.uname()[4] == "ppc64le":
> +           self.info["kbd_type"] = "keyboard"
> +
>           keyboard = """
> -            <input type='kbd' bus='%(kbd_bus)s'> </input>
> -        """
> +            <input type='%(kbd_type)s' bus='%(kbd_bus)s'> </input>
> +        """
> +
>           tablet = """
>               <input type='tablet' bus='%(kbd_bus)s'> </input>
>           """

_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel