Ask Your Question
0

diskimage-builder: Software Deployments Broken In Xenial

asked 2017-03-16 06:17:53 -0500

mathias gravatar image

I am trying to build an image for ubuntu trusty and xenial that works with OS::Heat::SoftwareDeployment using diskimage-builder. I installed diskimage-builde with

pip install diskimage-builder

an run the following scripts to build the images:

export DISTRIBUTION="ubuntu"
export DIB_RELEASE="trusty"

git clone https://git.openstack.org/openstack/tripleo-image-elements.git
git clone https://git.openstack.org/openstack/heat-agents.git

export ELEMENTS_PATH=tripleo-image-elements/elements:heat-agents/
export BASE_ELEMENTS="$DISTRIBUTION selinux-permissive"
export AGENT_ELEMENTS="os-collect-config os-refresh-config os-apply-config"
export DEPLOYMENT_BASE_ELEMENTS="heat-config heat-config-script heat-config-ansible"
export DEPLOYMENT_TOOL=""

TIMESTAMP=$(date +%Y%m%d%H%M%S)
export IMAGE_NAME="$DISTRIBUTION-$DIB_RELEASE_$TIMESTAMP"

disk-image-create vm $BASE_ELEMENTS $AGENT_ELEMENTS \
     $DEPLOYMENT_BASE_ELEMENTS $DEPLOYMENT_TOOL -t raw -o $IMAGE_NAME.raw

openstack image create --disk-format raw --container-format bare \
    $IMAGE_NAME < $IMAGE_NAME.raw

To build xenial I just set DIB_RELEASE to "xenial". The build process runs fine and the images a uploaded. Then I deploy instances from both images and check the os-collect-config service. On trusty the service is running and executing os-collect-config manually results in a successful run as expected.

On xenial though, this is what I see:

root@test:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:   xenial
root@test:~# os-collect-config --debug --force
Source [heat_local] Unavailable.
Traceback (most recent call last):
  File "/usr/local/bin/os-collect-config", line 11, in <module>
    sys.exit(__main__())
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/collect.py", line 262, in __main__
    collector_kwargs_map=collector_kwargs_map)
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/collect.py", line 166, in collect_all
    content = module.Collector(**collector_kwargs).collect()
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/ec2.py", line 75, in collect
    md = config_drive.get_metadata()
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/config_drive.py", line 173, in get_metadata
    bd = config_drive()
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/config_drive.py", line 166, in config_drive
    for bd in all_block_devices():
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/config_drive.py", line 155, in all_block_devices
    for device in out.split('\n\n'):
TypeError: a bytes-like object is required, not 'str'
root@test:~#

I have no idea what this means or where it might come from. Any help is very much appreciated.

edit retag flag offensive close merge delete

Comments

I was trying to find out the problem - https://ask.openstack.org/en/question... - but decided to stop for a while, using 14.04 and waiting for fix :)

doka.ua gravatar imagedoka.ua ( 2017-03-16 07:41:07 -0500 )edit

I read your post before I wrote this and figured the problems are different. As described above all works fine for 14.04, so you should not see any problems with the python-requests package.

mathias gravatar imagemathias ( 2017-03-16 08:08:21 -0500 )edit

Yes, everything is fine for 14.04, while fails on 16.04.

doka.ua gravatar imagedoka.ua ( 2017-03-16 08:46:31 -0500 )edit

Actually, I just noticed that trusty doesn't work either. It's still not python-requests but it cannot finde keystone cient:

  File "/usr/local/bin/heat-config-notify", line 143, in main
    ks = ksclient.Client(
AttributeError: 'NoneType' object has no attribute 'Client'
mathias gravatar imagemathias ( 2017-03-16 09:53:58 -0500 )edit

To fix the absence of python-keystoneclient just add the package to https://github.com/openstack/heat-age...

mathias gravatar imagemathias ( 2017-03-16 11:16:39 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-05-18 17:13:02 -0500

doka.ua gravatar image

Finally, there are couple of changes to few files. Below is list of files and what I've changed to get HEAT-aware Xenial-based custom image. Before you'll be able to create custom image, you need to install diskimage-builder (https://docs.openstack.org/developer/...).

Clone HEAT modules using stable/ocata branch:

git clone -b stable/ocata https://git.openstack.org/openstack/tripleo-image-elements.git
git clone -b stable/ocata https://git.openstack.org/openstack/heat-agents.git

and change the following files:

  • custom image script:
export BASE_ELEMENTS="ubuntu selinux-permissive dib-run-parts"
export DIB_RELEASE=xenial
  • diskimage-builder/diskimage_builder/elements/dib-run-parts/package-installs.yaml
python-dib-utils:
- tripleo-image-elements/elements/os-collect-config/install.d/os-collect-config-source-install/10-os-collect-config
[Install]
WantedBy=cloud-init.target
  • heat-agents/heat-config/install.d/heat-config-source-install/50-heat-config-soure
pip install python-heatclient python-zaqarclient python-keystoneclient

and then you can launch custom image script to get 16.04 custom image.

Enjoy!

edit flag offensive delete link more
0

answered 2017-03-16 10:59:15 -0500

This is an os-collect-config bug where it seems it is not python3 compatible and xenial only ships with python3 by default. Can you try to export DIB_PYTHON_VERSION=2 when you run your diskimage-create command as a workaround?

edit flag offensive delete link more

Comments

Thanks for your response, I tried your suggestion: The output I get is https://gist.github.com/f413b6f76194f... No image is created at all

mathias gravatar imagemathias ( 2017-03-16 12:29:43 -0500 )edit

Odd, can you re-run with a -x flag added to disk-image-create and re-paste the output.

greghaynes gravatar imagegreghaynes ( 2017-03-16 17:04:18 -0500 )edit

Sorry, was busy for a while: This is what I ran: https://gist.github.com/59d3e7cc35864... Here is the output: https://gist.github.com/d3eaa19809c6d...

mathias gravatar imagemathias ( 2017-03-30 02:37:57 -0500 )edit

Nobody has any ideas?

mathias gravatar imagemathias ( 2017-04-06 03:09:05 -0500 )edit

Did you manage to solve the problem?

doka.ua gravatar imagedoka.ua ( 2017-05-18 08:16:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-03-16 06:17:53 -0500

Seen: 133 times

Last updated: May 18