[R2.20-Build 17]: nova --user-data option is not working for docker container creation

Bug #1455944 reported by alok kumar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R2.20
Invalid
Medium
Ignatious Johnson Christopher
Trunk
Invalid
Medium
Ignatious Johnson Christopher

Bug Description

while creating nova instances, user-data script is not getting executed in case of docker containers.

root@nodeg18:~# cat script.sh
#!/bin/sh
echo "hello" > /tmp/output.txt

root@nodeg18:~# nova boot --flavor 2 --image e25699d4-f858-4abd-af3c-9822ee2809b2 --user-data "script.sh" --nic net-id=165f5f17-4830-4547-ac12-9dc3e10fee46 lxc-alok2

root@nodeg18:~# nova list
+--------------------------------------+-----------+--------+------------+-------------+--------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-----------+--------+------------+-------------+--------------+
| 834753ab-829a-4085-8aaf-266dd043b45b | lxc-alok2 | ACTIVE | - | Running | vn1=1.1.1.7 |
| c77a4c84-6077-423c-bae3-266cc55852ff | lxc1 | ACTIVE | - | Running | vn1=1.1.1.3 |
| de43e336-ad5f-4808-88ee-d5b67554f79e | lxc2 | ACTIVE | - | Running | vn1=1.1.1.5 |
| 9f4a4f55-2795-48e0-9cd9-6663d60fdd63 | vm-alok4 | ACTIVE | - | Running | vn1=1.1.1.11 |
| 4f6de287-d76e-4de0-96eb-e39d3c216583 | vm1 | ACTIVE | - | Running | vn1=1.1.1.4 |
| 8a4e6c1e-9c0a-4b85-acd5-e275f466cbc8 | vm2 | ACTIVE | - | Running | vn1=1.1.1.6 |
+--------------------------------------+-----------+--------+------------+-------------+--------------+

root@nodec62:/usr/lib/python2.7/dist-packages/novadocker/virt/docker# docker exec 73f2ddb6b29a ls /tmp
root@nodec62:/usr/lib/python2.7/dist-packages/novadocker/virt/docker#

information type: Proprietary → Public
tags: added: releasenote
tags: added: blocker
Revision history for this message
Ignatious Johnson Christopher (ijohnson-x) wrote :
Download full text (5.5 KiB)

I tried it test with cloud image in contrail mainline build 2712, It worked as expected, Possibly you were not using a cloud docker image, for the meta data services to be operational , we need cloud image( image with cloud-init package installed).

root@a5s194:~# contrail-version
Package Version Build-ID | Repo | Package Name
-------------------------------------- ------------------------------ ----------------------------------
contrail-analytics 3.0-2712 2712
contrail-config 3.0-2712 2712
contrail-config-openstack 3.0-2712 2712
contrail-control 3.0-2712 2712
contrail-dns 3.0-2712 2712
contrail-docs 3.0-2712 2712
contrail-f5 3.0-2712 2712
contrail-fabric-utils 3.0-2712 2712
contrail-heat 3.0-2712 2712
contrail-install-packages 3.0-2712~kilo 2712

root@a5s194:~# pwd
/root
root@a5s194:~# cat script.sh
#!/bin/sh
echo "hello" > /tmp/output.txt
root@a5s194:~#

root@a5s194:/opt/contrail/utils# docker pull cirros
Pulling repository cirros
64a920f75037: Download complete
c74e3fca9821: Download complete
e1ceeb0716f6: Download complete
cb5c6009bac1: Download complete
7725b0aea0a1: Download complete
Status: Downloaded newer image for cirros:latest ^C
 raw@a5s194:/opt/contrail/utils#
root@a5s194:/opt/contrail/utils# docker save cirros | glance image-create cirros --public --container-format docker --disk-format raw
 --name cirros
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 7985e2c80e85671b76323cafa3af9609 |
| container_format | docker |
| created_at | 2016-02-11T20:14:57.322982 |
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | 1fdd738a-8958-4951-a3cb-053b48c5da61 |
| is_public | True |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | 72b4127e873f4df597f7c2bd8cb92f90 |
| protected | False |
| size | 8131584 |
| status | active |
| updated_at | 2016-02-11T20:14:57.650256 |
| virtual_si...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.