Bug 1552596

Summary: sahara-image-pack: RHEL-based images can not be generated with various plugins
Product: Red Hat OpenStack Reporter: Luigi Toscano <ltoscano>
Component: openstack-saharaAssignee: Telles Nobrega <tenobreg>
Status: CLOSED ERRATA QA Contact: Luigi Toscano <ltoscano>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 13.0 (Queens)CC: jschluet, matt, mimccune, pkshiras, scohen, srevivo
Target Milestone: betaKeywords: Triaged
Target Release: 13.0 (Queens)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-sahara-8.0.1-0.20180320232516.d3322ef.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-27 13:35:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1337661    

Description Luigi Toscano 2018-03-07 12:21:43 UTC
Description of problem:
The various plugins for Plugin-Declared Image Generation have some trouble with RHEL-based images. Few issues identified so far:

* 'rhel': 'redhat' should be added to _DISTRO_FAMILES in sahara/plugins/images.py; libguestfs identifies RHEL with 'rhel', and otherwise the process bails out;
* few conditionals in the declarative definition of image check/build contains:
  - os_case:
     - centos:

but that should really be 'redhat:' instead, which encompasses both centos and RHEL.

Even when enabling those, there are probably other issues; for example, when generating a MapR image on RHEL, even with the fixes above applied, the process ends with:

2018-03-06 19:51:34.088 13863 INFO sahara.cli.image_pack.cli [-] Issuing command: rpm -q cups cdparanoia-libs cups-libs createrepo cvs cyrus-sasl-gssapi cyrus-sasl-plain foomatic foomatic-db foomatic-db-f[21/1992]
 foomatic-db-ppds gdbm-devel gettext ghostscript ghostscript-fonts glibc glibc-common glibc-devel glibc-headers gstreamer gstreamer-plugins-base gstreamer-tools hdparm irqbalance iso-codes kernel-headers libXt lib
Xv libXxf86vm libgomp libgudev1 libicu libmng liboil libtheora libtirpc libvisual libxslt mesa-dri-drivers mesa-libGL mesa-libGLU mesa-private-llvm nmap-ncat numactl openjpeg-libs patch pax perl-CGI perl-ExtUtils-
MakeMaker perl-ExtUtils-ParseXS perl-Test-Harness perl-Test-Simple perl-devel phonon-backend-gstreamer poppler poppler-data poppler-utils portreserve qt qt-x11 qt3 redhat-lsb redhat-lsb-core redhat-lsb-printing ur
w-fonts yum-utils xml-common
2018-03-06 19:51:44.297 13863 CRITICAL sahara [-] Unhandled error: RuntimeError: sh:
2018-03-06 19:51:44.297 13863 ERROR sahara Traceback (most recent call last):
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/bin/sahara-image-pack", line 10, in <module>
2018-03-06 19:51:44.297 13863 ERROR sahara     sys.exit(main())
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/cli/image_pack/cli.py", line 121, in main
2018-03-06 19:51:44.297 13863 ERROR sahara     CONF.root_fs, CONF.test_only)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/cli/image_pack/api.py", line 127, in pack_image
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/mapr/plugin.py", line 108, in pack_image
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/mapr/base/base_version_handler.py", line 193, in pack_image
2018-03-06 19:51:44.297 13863 ERROR sahara     remote, test_only=test_only, image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/mapr/images.py", line 31, in pack_image
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 52, in handler
2018-03-06 19:51:44.297 13863 ERROR sahara     func(*args, **kwargs)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 411, in validate
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=argument_values)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 892, in validate
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 966, in validate
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 892, in validate
2018-03-06 19:51:44.297 13863 ERROR sahara     image_arguments=image_arguments)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 52, in handler
2018-03-06 19:51:44.297 13863 ERROR sahara     func(*args, **kwargs)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 532, in validate
2018-03-06 19:51:44.297 13863 ERROR sahara     check(self, remote)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 544, in _rpm_check
2018-03-06 19:51:44.297 13863 ERROR sahara     return _sudo(remote, check_cmd)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/plugins/images.py", line 1111, in _sudo
2018-03-06 19:51:44.297 13863 ERROR sahara     return remote.execute_command(cmd, run_as_root=True, **kwargs)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib/python2.7/site-packages/sahara/cli/image_pack/api.py", line 92, in execute_command
2018-03-06 19:51:44.297 13863 ERROR sahara     stdout = self.guest.sh(cmd)
2018-03-06 19:51:44.297 13863 ERROR sahara   File "/usr/lib64/python2.7/site-packages/guestfs.py", line 9470, in sh
2018-03-06 19:51:44.297 13863 ERROR sahara     r = libguestfsmod.sh(self._o, command)
2018-03-06 19:51:44.297 13863 ERROR sahara RuntimeError: sh: 
2018-03-06 19:51:44.297 13863 ERROR sahara 

The tests have been done against a RHEL 7.4 image (-191) due to some issues with repositories availability for RHEL 7.5.

Version-Release number of selected component (if applicable):
openstack-sahara-image-pack-8.0.1-0.20180228170523.abcc07a.el7ost.noarch


How reproducible:
Always


Steps to Reproduce:
virt-customize -a sahara-rhel7-mapr-5.2.0.qcow2 \
    --sm-register \
    --sm-credentials ${REG_USER}:password:${REG_PASSWORD} \
    --sm-attach pool:${REG_POOL_ID}

# create the image
sahara-image-pack --image sahara-rhel7-mapr-5.2.0.qcow2 \
    mapr \
    5.2.0.mrv2


Actual results:
RHEL-based image generated

Expected results:
Various errors depending on how many of the above described fixes are applied.

Comment 7 Luigi Toscano 2018-04-12 13:58:49 UTC
The reported issue is now fixed.

Tested on:
openstack-sahara-image-pack-8.0.1-0.20180320232516.d3322ef.el7ost.noarch

The build process completes for all plugins; there are then few other issues related to some differences between the output of sahara-image-create and sahara-image-pack, but they are out of scope for this bug.

Comment 9 errata-xmlrpc 2018-06-27 13:35:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:2086