[Kimchi-devel] [PATCH] Add os_arch field to distros

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Thu Feb 6 12:45:59 UTC 2014


On Wed, 2014-02-05 at 21:38 -0200, Crístian Viana wrote:
> Am 05-02-2014 19:51, schrieb Christy Perez:
> > 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.
> Does this prevent a user running on an x86_64 host from creating an x86 
> guest?

Yes. I guess the best is create a dictionary with all architectures
supported. So, the distroloader.py should be also, like:

diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py
index 98fd764..d8e76bf 100644
--- a/src/kimchi/distroloader.py
+++ b/src/kimchi/distroloader.py
@@ -51,9 +51,10 @@ class DistroLoader(object):
             raise OperationFailed(msg)

     def get(self):
+        arch = {'x86_64': ['x86_64', 'amd64', 'i686', 'x86'],
                 'amd64': ['x86_64', 'amd64', 'i686', 'x86']}
         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'] in arch[os.uname()[4]]])

May be this can dictionary or map should be added in src/kimchi/utils.py
and the compatibility returned by a function.

In addition, the arch of Debian, Ubuntu and Gentoo entries should be
'amd64' instead of 'x86_64'.

Best regards, Paulo.

> 
> _______________________________________________
> 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