[PATCH 0/2] Support ppc64 isos in Templates

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 | 24 ++++++++++++++++++++++++ src/distros.d/gentoo.json | 1 + src/distros.d/opensuse.json | 1 + src/distros.d/ubuntu.json | 2 ++ src/kimchi/distroloader.py | 3 ++- ui/pages/template-add.html.tmpl | 3 +++ 7 files changed, 34 insertions(+), 1 deletion(-) -- 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. 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 | 24 ++++++++++++++++++++++++ src/distros.d/gentoo.json | 1 + src/distros.d/opensuse.json | 1 + src/distros.d/ubuntu.json | 2 ++ 5 files changed, 29 insertions(+) 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..1f92f2c 100644 --- a/src/distros.d/fedora.json +++ b/src/distros.d/fedora.json @@ -2,19 +2,43 @@ { "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", "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", "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", + "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", + "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", + "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

-- Tested-by: Paulo Vital <pvital@linux.vnet.ibm.com> Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On Wed, 2014-03-05 at 15:18 -0300, Rodrigo Trujillo wrote:
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.
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 | 24 ++++++++++++++++++++++++ src/distros.d/gentoo.json | 1 + src/distros.d/opensuse.json | 1 + src/distros.d/ubuntu.json | 2 ++ 5 files changed, 29 insertions(+)
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..1f92f2c 100644 --- a/src/distros.d/fedora.json +++ b/src/distros.d/fedora.json @@ -2,19 +2,43 @@ { "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", "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", "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", + "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", + "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", + "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" }

This patche filters remote isos that should be showed to user by the system architecture. The UI now shows the architecture of the remote iso as well. 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 | 3 ++- ui/pages/template-add.html.tmpl | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py index daa5d5b..7745e0d 100644 --- a/src/kimchi/distroloader.py +++ b/src/kimchi/distroloader.py @@ -49,9 +49,10 @@ class DistroLoader(object): raise OperationFailed("KCHDL0002E", msg_args) def get(self): + arch = 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 dict([(distro['name'], distro) for distro in distros if distro['os_arch'] == arch]) diff --git a/ui/pages/template-add.html.tmpl b/ui/pages/template-add.html.tmpl index edce8d2..8d20f66 100644 --- a/ui/pages/template-add.html.tmpl +++ b/ui/pages/template-add.html.tmpl @@ -158,6 +158,9 @@ <div class="iso-info-item" title="{os_distro}"> $_("OS: "){os_distro} </div> + <div class="iso-info-item" title="{os_arch}"> + $_("Arch: "){os_arch} + </div> </div> <div class="iso-info-col"> <div class="iso-info-item" title="{os_version}"> -- 1.8.5.3

-- Tested-by: Paulo Vital <pvital@linux.vnet.ibm.com> Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On Wed, 2014-03-05 at 15:18 -0300, Rodrigo Trujillo wrote:
This patche filters remote isos that should be showed to user by the system architecture. The UI now shows the architecture of the remote iso as well.
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 | 3 ++- ui/pages/template-add.html.tmpl | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py index daa5d5b..7745e0d 100644 --- a/src/kimchi/distroloader.py +++ b/src/kimchi/distroloader.py @@ -49,9 +49,10 @@ class DistroLoader(object): raise OperationFailed("KCHDL0002E", msg_args)
def get(self): + arch = 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 dict([(distro['name'], distro) for distro in distros if distro['os_arch'] == arch]) diff --git a/ui/pages/template-add.html.tmpl b/ui/pages/template-add.html.tmpl index edce8d2..8d20f66 100644 --- a/ui/pages/template-add.html.tmpl +++ b/ui/pages/template-add.html.tmpl @@ -158,6 +158,9 @@ <div class="iso-info-item" title="{os_distro}"> $_("OS: "){os_distro} </div> + <div class="iso-info-item" title="{os_arch}"> + $_("Arch: "){os_arch} + </div> </div> <div class="iso-info-col"> <div class="iso-info-item" title="{os_version}">

When I submitted this the first time, I think it was Cristian that pointed out that a) the arch for the amd64 ones should be amd64, and also, an x86 guest should be allowed to run on an x86_64 host. I must have sent you an old version of my patch, and thought you had also read those replies. I can forward you the e-mail when I find it. I just searched for a while and can't. If someone else wants to send Rodrigo that mail, or review this patch with those things in mind, that would be much appreciated! Regards, - Christy On Wed, 2014-03-05 at 15:18 -0300, Rodrigo Trujillo wrote:
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 | 24 ++++++++++++++++++++++++ src/distros.d/gentoo.json | 1 + src/distros.d/opensuse.json | 1 + src/distros.d/ubuntu.json | 2 ++ src/kimchi/distroloader.py | 3 ++- ui/pages/template-add.html.tmpl | 3 +++ 7 files changed, 34 insertions(+), 1 deletion(-)

Am 06-03-2014 00:57, schrieb Christy Perez:
When I submitted this the first time, I think it was Cristian that pointed out that a) the arch for the amd64 ones should be amd64, and also, an x86 guest should be allowed to run on an x86_64 host. I must have sent you an old version of my patch, and thought you had also read those replies. I can forward you the e-mail when I find it. I just searched for a while and can't. If someone else wants to send Rodrigo that mail, or review this patch with those things in mind, that would be much appreciated! Exactly, Christy, thanks for reminding us!
I do not agree that we should filter the available templates/guests to those that have the exact same architecture. Some of them are able to run guests in different architectures (e.g. running x86 from an x86_64 guest). For each arch, I think we should have a list of supported archs instead of expecting it to be the same as the guest's.

Hi Chirsty and Cristian, thank you for point this problem. I found previous thread and I think the concerns make sense. I just have some points: - The filter will not prevent user of running a x86 in a x86_64 machine, he still can select a 32 bits iso manually and create the template. - We don't have 32 iso listed, so the feature will not impact at this time (of course, we can change this in future) I am going to resend the patch =] Rodrigo On 03/06/2014 10:08 AM, Crístian Viana wrote:
Am 06-03-2014 00:57, schrieb Christy Perez:
When I submitted this the first time, I think it was Cristian that pointed out that a) the arch for the amd64 ones should be amd64, and also, an x86 guest should be allowed to run on an x86_64 host. I must have sent you an old version of my patch, and thought you had also read those replies. I can forward you the e-mail when I find it. I just searched for a while and can't. If someone else wants to send Rodrigo that mail, or review this patch with those things in mind, that would be much appreciated! Exactly, Christy, thanks for reminding us!
I do not agree that we should filter the available templates/guests to those that have the exact same architecture. Some of them are able to run guests in different architectures (e.g. running x86 from an x86_64 guest).
For each arch, I think we should have a list of supported archs instead of expecting it to be the same as the guest's.
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (4)
-
Christy Perez
-
Crístian Viana
-
Paulo Ricardo Paz Vital
-
Rodrigo Trujillo