[PATCH] [Kimchi 0/2] s390x architecture based changes

From: Archana Singh <archus@linux.vnet.ibm.com> 1) On s390x machine, guestfs is not supported, hence made the change in imageinfo.py to return unknown as distro and version on import error of guestfs. 2) On s390x machine, scan cannot use El Torito boot specification. Hence for now set bootable as True till we don't get the way to scan on s390x. Archana Singh (2): Modified code, to return distro and version as unknown, if guestfs import failed. s390x based architecture changes. imageinfo.py | 10 ++++++---- isoinfo.py | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) -- 2.7.4

From: Archana Singh <archus@linux.vnet.ibm.com> guestfs is used to get the distro and version, if guestfs is not installed distro and version returned as unknown. Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- imageinfo.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/imageinfo.py b/imageinfo.py index 8874917..30c08ae 100644 --- a/imageinfo.py +++ b/imageinfo.py @@ -17,7 +17,6 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -import guestfs import json import os import sys @@ -48,11 +47,14 @@ def probe_image(image_path): if not os.access(image_path, os.R_OK): raise ImageFormatError("KCHIMG0003E", {'filename': image_path}) - g = guestfs.GuestFS(python_return_dict=True) - g.add_drive_opts(image_path, readonly=1) - g.launch() try: + import guestfs + g = guestfs.GuestFS(python_return_dict=True) + g.add_drive_opts(image_path, readonly=1) + g.launch() roots = g.inspect_os() + except ImportError: + return ("unknown", "unknown") except: raise ImageFormatError("KCHIMG0001E") -- 2.7.4

From: Archana Singh <archus@linux.vnet.ibm.com> On s390x machine current implemented code cannot be used for checking iso is bootable or not. Make changes to set it always True for s390x machine, and can be implemenated in future. Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- isoinfo.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/isoinfo.py b/isoinfo.py index d7ca044..d8bec2d 100644 --- a/isoinfo.py +++ b/isoinfo.py @@ -395,6 +395,14 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ # If reached this point the file wasn't found = not bootable self.bootable = False + def _scan_s390x(self): + """ + s390x firmware does not use the conventional El Torito boot + specification. This method will be used to check s390x image + is bootable or not. Till then this will set bootable True. + """ + self.bootable= True + def _scan_primary_vol(self, data): """ Scan one sector for a Primary Volume Descriptor and extract the @@ -445,6 +453,8 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ self._scan_primary_vol(data) if platform.machine().startswith('ppc'): self._scan_ppc() + elif platform.machine().startswith('s390x'): + self._scan_s390x() else: self._scan_el_torito(data) -- 2.7.4

Archana, have you tried to test the PPC boot detection with the s390x ISOs? The PPC boot detection is based on finding a file named /ppc/bootinfo.txt. Perhaps something similar can be made for s390x? This is a topic that I have interest in investigating (I wrote an article about this PPC boot detection code I've wrote in Kimchi) so let me know if you need any assistance with that. Daniel On 08/09/2016 05:53 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
On s390x machine current implemented code cannot be used for checking iso is bootable or not. Make changes to set it always True for s390x machine, and can be implemenated in future.
Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- isoinfo.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/isoinfo.py b/isoinfo.py index d7ca044..d8bec2d 100644 --- a/isoinfo.py +++ b/isoinfo.py @@ -395,6 +395,14 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ # If reached this point the file wasn't found = not bootable self.bootable = False
+ def _scan_s390x(self): + """ + s390x firmware does not use the conventional El Torito boot + specification. This method will be used to check s390x image + is bootable or not. Till then this will set bootable True. + """ + self.bootable= True + def _scan_primary_vol(self, data): """ Scan one sector for a Primary Volume Descriptor and extract the @@ -445,6 +453,8 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ self._scan_primary_vol(data) if platform.machine().startswith('ppc'): self._scan_ppc() + elif platform.machine().startswith('s390x'): + self._scan_s390x() else: self._scan_el_torito(data)

Hi Daniel, Sure, I will try similar to ppc boot detection and will be working on figure out how can we detect it on s390x, and will be sending followup patches for same. Till then we can have bootable as yes on s390x machine as without which template creation cannot be proceeded further on s390x. I will send V2 patch solving all make check-local issues. Thanks, Archana On 08/09/2016 06:38 PM, Daniel Henrique Barboza wrote:
Archana, have you tried to test the PPC boot detection with the s390x ISOs? The PPC boot detection is based on finding a file named /ppc/bootinfo.txt. Perhaps something similar can be made for s390x?
This is a topic that I have interest in investigating (I wrote an article about this PPC boot detection code I've wrote in Kimchi) so let me know if you need any assistance with that.
Daniel
On 08/09/2016 05:53 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
On s390x machine current implemented code cannot be used for checking iso is bootable or not. Make changes to set it always True for s390x machine, and can be implemenated in future.
Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- isoinfo.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/isoinfo.py b/isoinfo.py index d7ca044..d8bec2d 100644 --- a/isoinfo.py +++ b/isoinfo.py @@ -395,6 +395,14 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ # If reached this point the file wasn't found = not bootable self.bootable = False + def _scan_s390x(self): + """ + s390x firmware does not use the conventional El Torito boot + specification. This method will be used to check s390x image + is bootable or not. Till then this will set bootable True. + """ + self.bootable= True + def _scan_primary_vol(self, data): """ Scan one sector for a Primary Volume Descriptor and extract the @@ -445,6 +453,8 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ self._scan_primary_vol(data) if platform.machine().startswith('ppc'): self._scan_ppc() + elif platform.machine().startswith('s390x'): + self._scan_s390x() else: self._scan_el_torito(data)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 08/10/2016 02:42 AM, Archana Singh wrote:
Hi Daniel,
Sure, I will try similar to ppc boot detection and will be working on figure out how can we detect it on s390x, and will be sending followup patches for same. Till then we can have bootable as yes on s390x machine as without which template creation cannot be proceeded further on s390x.
Hopefully it will be something like "check if a file named /<some_dir>/bootinfo.txt" exists. Then you can use the same PPC code but with a different file path.
I will send V2 patch solving all make check-local issues.
Thanks,
Archana
On 08/09/2016 06:38 PM, Daniel Henrique Barboza wrote:
Archana, have you tried to test the PPC boot detection with the s390x ISOs? The PPC boot detection is based on finding a file named /ppc/bootinfo.txt. Perhaps something similar can be made for s390x?
This is a topic that I have interest in investigating (I wrote an article about this PPC boot detection code I've wrote in Kimchi) so let me know if you need any assistance with that.
Daniel
On 08/09/2016 05:53 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
On s390x machine current implemented code cannot be used for checking iso is bootable or not. Make changes to set it always True for s390x machine, and can be implemenated in future.
Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- isoinfo.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/isoinfo.py b/isoinfo.py index d7ca044..d8bec2d 100644 --- a/isoinfo.py +++ b/isoinfo.py @@ -395,6 +395,14 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ # If reached this point the file wasn't found = not bootable self.bootable = False + def _scan_s390x(self): + """ + s390x firmware does not use the conventional El Torito boot + specification. This method will be used to check s390x image + is bootable or not. Till then this will set bootable True. + """ + self.bootable= True + def _scan_primary_vol(self, data): """ Scan one sector for a Primary Volume Descriptor and extract the @@ -445,6 +453,8 @@ lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux\ self._scan_primary_vol(data) if platform.machine().startswith('ppc'): self._scan_ppc() + elif platform.machine().startswith('s390x'): + self._scan_s390x() else: self._scan_el_torito(data)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

There is make check-local issues in the patch set: make[3]: Entering directory '/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi' contrib/check_i18n.py ./i18n.py Checking for invalid i18n string... Checking for invalid i18n string successfully /bin/pep8 --version 1.6.2 /bin/pep8 --filename '*.py,*.py.in' --exclude="*config.py,*i18n.py,*tests/test_config.py" . ./isoinfo.py:399:8: E111 indentation is not a multiple of four ./isoinfo.py:404:8: E111 indentation is not a multiple of four ./isoinfo.py:404:21: E225 missing whitespace around operator Apart from that I have a design question/comment in patch 2/2 too. Daniel On 08/09/2016 05:53 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
1) On s390x machine, guestfs is not supported, hence made the change in imageinfo.py to return unknown as distro and version on import error of guestfs.
2) On s390x machine, scan cannot use El Torito boot specification. Hence for now set bootable as True till we don't get the way to scan on s390x.
Archana Singh (2): Modified code, to return distro and version as unknown, if guestfs import failed. s390x based architecture changes.
imageinfo.py | 10 ++++++---- isoinfo.py | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-)
participants (3)
-
Archana Singh
-
archus@linux.vnet.ibm.com
-
Daniel Henrique Barboza