diskimage-builder: Software Deployments Broken In Xenial

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

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"

TIMESTAMP=$(date +%Y%m%d%H%M%S)

disk-image-create vm $BASE_ELEMENTS $AGENT_ELEMENTS \

openstack image create --disk-format raw --container-format bare \

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>
  File "/opt/stack/venvs/os-collect-config/lib/python3.5/site-packages/os_collect_config/collect.py", line 262, in __main__
  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'

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


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 -0600 )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 -0600 )edit

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

doka.ua gravatar imagedoka.ua ( 2017-03-16 08:46:31 -0600 )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 -0600 )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 -0600 )edit

2 answers

Sort by ยป oldest newest most voted

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

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


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 -0600 )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 -0600 )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 -0600 )edit

Nobody has any ideas?

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

Did you manage to solve the problem?

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

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

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
- tripleo-image-elements/elements/os-collect-config/install.d/os-collect-config-source-install/10-os-collect-config
  • 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.


edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


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

Seen: 584 times

Last updated: May 18 '17