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

Paulo Ricardo Paz Vital pvital at gmail.com
Fri Jan 23 22:04:53 UTC 2015


> On 23 Jan 2015, at 19:20, Ramon Medeiros <ramonn at linux.vnet.ibm.com> wrote:
> 
> 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/osinfo.py     |  6 +++++-
> src/kimchi/vmtemplate.py |  8 ++++++++
> 3 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
> index 83a5dd0..f0089dc 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()
> +
> +        # ISSUE #573: On POWER8 debian little endian, the qemu binary is
> +        # qemu-system-ppc64, not qemu-system-ppc64el as expected

typo: s/qemu-system-ppc64el/qemu-system-ppc64le

Is this whole patch solving Issue #573? Why not add issue info on commit message, like commit fc99a95?

> +        arch = platform.machine()
> +        if platform.machine() == "ppc64le”:

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..2f6558d 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’)}
> 
> 
> 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()
> 
> +    # ppc64le hack: qemu ppc64le uses ppc64 in libvirt xml

The word ‘hack’ sounds something is wrong here :-D
I suggest to change the comment text to something like: “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..a017874 100644
> --- a/src/kimchi/vmtemplate.py
> +++ b/src/kimchi/vmtemplate.py
> @@ -245,9 +245,17 @@ class VMTemplate(object):
>         mouse = """
>             <input type='mouse' bus='%(mouse_bus)s'/>
>         """
> +
>         keyboard = """
>             <input type='kbd' bus='%(kbd_bus)s'> </input>
>         """
> +
> +        # PPC64EL does not uses kbd
> +        if os.uname()[4] == "ppc64le":
> +            keyboard = """
> +                <input type='keyboard' bus='%(kbd_bus)s'> </input>
> +            ""”
> +

Why not create a variable called kdb_type and set it based on the architecture before the whole block where all parameters is set up?
Then you only need change the keyboard to be something like:

keyboard = “””
	<input type=‘%(kdb_type)s’ bus=‘%(kdb_bus)s’> </input>
“”"

>         tablet = """
>             <input type='tablet' bus='%(kbd_bus)s'> </input>
>         """
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel




More information about the Kimchi-devel mailing list