[PATCH V2 0/2] Support ppc64 isos in Templates

V2: - Sort UI list of remote distros - Change names of Fedora distros - Allow ISOs of similar architectures but with different names to be displayed, like (amd64 and x86_64) V1: If Kimchi server is running in a PPC machine, the guests should be PPC. Currently, when user tries to create a template, only x86 isos are showed to user. This patch filters the ISOs, and also, adds ARCH to UI. Rodrigo Trujillo (2): Support ppc64 isos in Templates: Add arch and urls to distro jsons Support ppc64 isos in Templates: Filter remote isos and change UI src/distros.d/debian.json | 1 + src/distros.d/fedora.json | 30 +++++++++++++++++++++++++++--- src/distros.d/gentoo.json | 1 + src/distros.d/opensuse.json | 1 + src/distros.d/ubuntu.json | 2 ++ src/kimchi/distroloader.py | 10 +++++++++- src/kimchi/model/config.py | 2 +- ui/pages/template-add.html.tmpl | 8 ++++++-- 8 files changed, 48 insertions(+), 7 deletions(-) -- 1.8.5.3

If Kimchi is running in a PPC machine, user can create a template that uses a remote x86_64 iso. Adding an os_arch field to the distro so we can filter distros on systems with other architectures. This prevents a user from creating unusable templates. This patch also changes the name field of Fedora distros. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com> --- src/distros.d/debian.json | 1 + src/distros.d/fedora.json | 30 +++++++++++++++++++++++++++--- src/distros.d/gentoo.json | 1 + src/distros.d/opensuse.json | 1 + src/distros.d/ubuntu.json | 2 ++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/distros.d/debian.json b/src/distros.d/debian.json index 0a00ae0..0754cf3 100644 --- a/src/distros.d/debian.json +++ b/src/distros.d/debian.json @@ -2,6 +2,7 @@ { "name": "debian-Wheezy", "os_distro": "debian", + "os_arch": "x86_64", "os_version": "7.2.0", "path": "http://cdimage.debian.org/debian-cd/7.2.0-live/amd64/iso-hybrid/debian-live-..." } diff --git a/src/distros.d/fedora.json b/src/distros.d/fedora.json index b4a82eb..cba0fe0 100644 --- a/src/distros.d/fedora.json +++ b/src/distros.d/fedora.json @@ -1,20 +1,44 @@ [ { - "name": "fedora-18", + "name": "Fedora 18", "os_distro": "fedora", + "os_arch": "x86_64", "os_version": "18", "path": "http://fedora.mirrors.tds.net/pub/fedora/releases/18/Live/x86_64/Fedora-18-x..." }, { - "name": "fedora-19", + "name": "Fedora 19", "os_distro": "fedora", + "os_arch": "x86_64", "os_version": "19", "path": "http://fedora.mirrors.tds.net/pub/fedora/releases/19/Live/x86_64/Fedora-Live..." }, { - "name": "fedora-20", + "name": "Fedora 20", "os_distro": "fedora", + "os_arch": "x86_64", "os_version": "20", "path": "http://fedora.mirrors.tds.net/pub/fedora/releases/20/Live/x86_64/Fedora-Live..." + }, + { + "name": "Fedora 18 (PPC64)", + "os_distro": "fedora", + "os_arch": "ppc64", + "os_version": "18", + "path": "http://mirrors.kernel.org/fedora-secondary/releases/18/Fedora/ppc64/iso/Fedo..." + }, + { + "name": "Fedora 19 (PPC64)", + "os_distro": "fedora", + "os_arch": "ppc64", + "os_version": "19", + "path": "http://mirrors.kernel.org/fedora-secondary/releases/19/Fedora/ppc64/iso/Fedo..." + }, + { + "name": "Fedora 20 (PPC64)", + "os_distro": "fedora", + "os_arch": "ppc64", + "os_version": "20", + "path": "http://mirrors.kernel.org/fedora-secondary/releases/20/Fedora/ppc64/iso/Fedo..." } ] diff --git a/src/distros.d/gentoo.json b/src/distros.d/gentoo.json index dffeadf..fa5e55b 100644 --- a/src/distros.d/gentoo.json +++ b/src/distros.d/gentoo.json @@ -2,6 +2,7 @@ { "name": "gentoo-20131010", "os_distro": "gentoo", + "os_arch": "x86_64", "os_version": "20131010", "path": "http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/install-am..." } diff --git a/src/distros.d/opensuse.json b/src/distros.d/opensuse.json index ff03f41..315cf78 100644 --- a/src/distros.d/opensuse.json +++ b/src/distros.d/opensuse.json @@ -2,6 +2,7 @@ { "name": "opensuse-12.3", "os_distro": "opensuse", + "os_arch": "x86_64", "os_version": "12.3", "path": "http://suse.mirrors.tds.net/pub/opensuse/distribution/12.3/iso/openSUSE-12.3..." } diff --git a/src/distros.d/ubuntu.json b/src/distros.d/ubuntu.json index 4ad6a19..fbd931a 100644 --- a/src/distros.d/ubuntu.json +++ b/src/distros.d/ubuntu.json @@ -2,12 +2,14 @@ { "name": "Ubuntu 13.04 (Raring Ringtail)", "os_distro": "ubuntu", + "os_arch": "x86_64", "os_version": "13.04", "path": "http://ubuntu-releases.cs.umn.edu/13.04/ubuntu-13.04-desktop-amd64.iso" }, { "name": "Ubuntu 13.10 (Saucy Salamander)", "os_distro": "ubuntu", + "os_arch": "x86_64", "os_version": "13.10", "path": "http://ubuntu-releases.cs.umn.edu/13.10/ubuntu-13.10-desktop-amd64.iso" } -- 1.8.5.3

This patch filters remote isos that should be showed to user by the system architecture. The UI now shows the architecture of the remote iso and sort the names of the distros. If host architecture is not found, all remote ISOs will be showed. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com> --- src/kimchi/distroloader.py | 10 +++++++++- src/kimchi/model/config.py | 2 +- ui/pages/template-add.html.tmpl | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py index daa5d5b..142cab6 100644 --- a/src/kimchi/distroloader.py +++ b/src/kimchi/distroloader.py @@ -28,6 +28,11 @@ from kimchi.exception import NotFoundError, OperationFailed 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']} + + class DistroLoader(object): def __init__(self, location=None): @@ -49,9 +54,12 @@ class DistroLoader(object): raise OperationFailed("KCHDL0002E", msg_args) def get(self): + arch_list = ARCHS.get(os.uname()[4]) all_json_files = glob.glob("%s/%s" % (self.location, "*.json")) distros = [] for f in all_json_files: distros.extend(self._get_json_info(f)) - return dict([(distro['name'], distro) for distro in distros]) + # Return all remote ISOs arch not found + return dict([(distro['name'], distro) for distro in distros if \ + (arch_list is None or distro['os_arch'] in arch_list)]) diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py index e201737..5c90f0d 100644 --- a/src/kimchi/model/config.py +++ b/src/kimchi/model/config.py @@ -91,7 +91,7 @@ class DistrosModel(object): self.distros = distroloader.get() def get_list(self): - return self.distros.keys() + return sorted(self.distros.keys()) class DistroModel(object): diff --git a/ui/pages/template-add.html.tmpl b/ui/pages/template-add.html.tmpl index edce8d2..5c66753 100644 --- a/ui/pages/template-add.html.tmpl +++ b/ui/pages/template-add.html.tmpl @@ -158,11 +158,15 @@ <div class="iso-info-item" title="{os_distro}"> $_("OS: "){os_distro} </div> - </div> - <div class="iso-info-col"> <div class="iso-info-item" title="{os_version}"> $_("Version: "){os_version} </div> + + </div> + <div class="iso-info-col"> + <div class="iso-info-item" title="{os_arch}"> + $_("Arch: "){os_arch} + </div> </div> </div> </div> -- 1.8.5.3

The patch is breaking tests ... I am fixing. Sorry. Rodrigo On 03/06/2014 12:08 PM, Rodrigo Trujillo wrote:
This patch filters remote isos that should be showed to user by the system architecture. The UI now shows the architecture of the remote iso and sort the names of the distros. If host architecture is not found, all remote ISOs will be showed.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com> --- src/kimchi/distroloader.py | 10 +++++++++- src/kimchi/model/config.py | 2 +- ui/pages/template-add.html.tmpl | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py index daa5d5b..142cab6 100644 --- a/src/kimchi/distroloader.py +++ b/src/kimchi/distroloader.py @@ -28,6 +28,11 @@ from kimchi.exception import NotFoundError, OperationFailed 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']} + + class DistroLoader(object):
def __init__(self, location=None): @@ -49,9 +54,12 @@ class DistroLoader(object): raise OperationFailed("KCHDL0002E", msg_args)
def get(self): + arch_list = ARCHS.get(os.uname()[4]) all_json_files = glob.glob("%s/%s" % (self.location, "*.json")) distros = [] for f in all_json_files: distros.extend(self._get_json_info(f))
- return dict([(distro['name'], distro) for distro in distros]) + # Return all remote ISOs arch not found + return dict([(distro['name'], distro) for distro in distros if \ + (arch_list is None or distro['os_arch'] in arch_list)]) diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py index e201737..5c90f0d 100644 --- a/src/kimchi/model/config.py +++ b/src/kimchi/model/config.py @@ -91,7 +91,7 @@ class DistrosModel(object): self.distros = distroloader.get()
def get_list(self): - return self.distros.keys() + return sorted(self.distros.keys())
class DistroModel(object): diff --git a/ui/pages/template-add.html.tmpl b/ui/pages/template-add.html.tmpl index edce8d2..5c66753 100644 --- a/ui/pages/template-add.html.tmpl +++ b/ui/pages/template-add.html.tmpl @@ -158,11 +158,15 @@ <div class="iso-info-item" title="{os_distro}"> $_("OS: "){os_distro} </div> - </div> - <div class="iso-info-col"> <div class="iso-info-item" title="{os_version}"> $_("Version: "){os_version} </div> + + </div> + <div class="iso-info-col"> + <div class="iso-info-item" title="{os_arch}"> + $_("Arch: "){os_arch} + </div> </div> </div> </div>
participants (1)
-
Rodrigo Trujillo