[Kimchi-devel] [PATCH] Supports Kimchi on LE systems v4

Royce Lv lvroyce at linux.vnet.ibm.com
Thu Jan 29 07:00:24 UTC 2015


I think we are almost there, one nit below.

On 01/28/2015 09:51 AM, Ramon Medeiros wrote:
> Changes:
>
> v4:
> Add ppc64le to distroloaders, avoiding to select a template with a
> mismatch architecture
>
> v3:
> Create a new entry for ppc64le arch
> Create key for keyboard type
>
> 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 at linux.vnet.ibm.com>
> ---
>   src/kimchi/config.py.in    | 11 +++++++++--
>   src/kimchi/distroloader.py |  4 +++-
>   src/kimchi/osinfo.py       | 30 ++++++++++++++++++++++++++++--
>   src/kimchi/vmtemplate.py   |  4 +++-
>   4 files changed, 43 insertions(+), 6 deletions(-)
>
> diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
> index a952fb3..f207e3f 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/distroloader.py b/src/kimchi/distroloader.py
> index 64505f4..de43238 100644
> --- a/src/kimchi/distroloader.py
> +++ b/src/kimchi/distroloader.py
> @@ -30,7 +30,9 @@ from kimchi.utils import kimchi_log
>
>   ARCHS = {'x86_64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
>            'amd64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
> -         'ppc64': ['ppc', 'ppc64']}
> +         'ppc64': ['ppc', 'ppc64'],
> +         'ppc64le': ['ppc64', 'ppc64le']}
> +
Update this ARCHS means to tell distroloader to import proper remote ISO 
url for this host arch.
So you may need to update the files under "distro.d", because there is 
no distro in these json files specified remote link with arch "ppc64le".
>
>   class DistroLoader(object):
> diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
> index 0e16b50..d13dd92 100644
> --- a/src/kimchi/osinfo.py
> +++ b/src/kimchi/osinfo.py
> @@ -29,7 +29,8 @@ from kimchi.config import paths
>
>
>   SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'),
> -                   'power': ('ppc', 'ppc64')}
> +                   'power': ('ppc', 'ppc64'),
> +                   'ppc64le':('ppc64le')}
>
>
>   common_spec = {'cpus': 1, 'memory': 1024, 'disks': [{'index': 0, 'size': 10}],
> @@ -47,11 +48,28 @@ template_specs = {'x86': {'old': dict(common_spec, disk_bus='ide',
>                     'power': {'old': dict(common_spec, disk_bus='scsi',
>                                           nic_model='spapr-vlan',
>                                           cdrom_bus='scsi',
> +                                        kbd_type="kbd",
>                                           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',
> +                                           cdrom_bus='scsi',
> +                                           kbd_bus='usb',
> +                                           kbd_type="kbd",
> +                                           mouse_bus='usb', tablet_bus='usb',
> +                                           memory=1280)},
> +                  'ppc64le': {'old': dict(common_spec, disk_bus='virtio',
> +                                           nic_model='virtio',
> +                                           cdrom_bus='scsi',
> +                                           kbd_bus='usb',
> +                                           kbd_type="keyboard",
> +                                           mouse_bus='usb', tablet_bus='usb',
> +                                           memory=1280),
> +                              'modern': dict(common_spec, disk_bus='virtio',
> +                                           nic_model='virtio',
> +                                           cdrom_bus='scsi',
> +                                           kbd_bus='usb',
> +                                           kbd_type="keyboard",
>                                              mouse_bus='usb', tablet_bus='usb',
>                                              memory=1280)}}
>
> @@ -63,6 +81,10 @@ modern_version_bases = {'x86': {'debian': '6.0', 'ubuntu': '7.10',
>                           'power': {'rhel': '6.5', 'fedora': '19',
>                                     'ubuntu': '14.04',
>                                     'opensuse': '13.1',
> +                                  'sles': '11sp3'},
> +                        'ppc64le': {'rhel': '6.5', 'fedora': '19',
> +                                  'ubuntu': '14.04',
> +                                  'opensuse': '13.1',
>                                     'sles': '11sp3'}}
>
>
> @@ -94,6 +116,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..0a3f8ea 100644
> --- a/src/kimchi/vmtemplate.py
> +++ b/src/kimchi/vmtemplate.py
> @@ -245,9 +245,11 @@ class VMTemplate(object):
>           mouse = """
>               <input type='mouse' bus='%(mouse_bus)s'/>
>           """
> +
>           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>
>           """




More information about the Kimchi-devel mailing list