Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

rdo/packstack could not get config-drive properly working.

Hello,

quite a newbee on openstack, I did an all-in-one rdo installation (icehouse), I'm trying to create and use a custom rhel6 image with config-drive.

  • I created a custom rhel6 image with cloud-init package added (cloud-init-0.7.5-10.el6.centos.2.x86_64)
  • I'm want to pass the network configuration (ifcfg-eth0, ...) and run a script on nova-boot using config-drive, but can't egt it working.

I'm using something like:

 # nova boot --config-drive=true --file /etc/sysconfig/network-scripts/ifcfg-eth0=mypath/ifeth0 --file /etc/sysconfig/network-scripts/route-eth0=mypath/rteth0 --user-data user-data-net-restart.sh  --image myrh6-img --nic port-id=2d68835a-9f3f-4475-999f-d2b0e38bddb8 --flavor m1.small rh6ca-tst2

After the instance is started, I can see the config-drive was actually created, and I can mount it manually and find my files:

# mount /dev/disk/by-label/config-2 /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
# find /media/cdrom
/media/cdrom
/media/cdrom/ec2
/media/cdrom/ec2/2009-04-04
/media/cdrom/ec2/2009-04-04/meta-data.json
/media/cdrom/ec2/2009-04-04/user-data
/media/cdrom/ec2/latest
/media/cdrom/ec2/latest/meta-data.json
/media/cdrom/ec2/latest/user-data
/media/cdrom/openstack
/media/cdrom/openstack/2012-08-10
/media/cdrom/openstack/2012-08-10/meta_data.json
/media/cdrom/openstack/2012-08-10/user_data
/media/cdrom/openstack/2013-04-04
/media/cdrom/openstack/2013-04-04/meta_data.json
/media/cdrom/openstack/2013-04-04/user_data
/media/cdrom/openstack/2013-10-17
/media/cdrom/openstack/2013-10-17/meta_data.json
/media/cdrom/openstack/2013-10-17/user_data
/media/cdrom/openstack/2013-10-17/vendor_data.json
/media/cdrom/openstack/content
/media/cdrom/openstack/content/0000
/media/cdrom/openstack/content/0001
/media/cdrom/openstack/latest
/media/cdrom/openstack/latest/meta_data.json
/media/cdrom/openstack/latest/user_data
/media/cdrom/openstack/latest/vendor_data.json

and mete-data looks ok:

# cat /media/cdrom/openstack/latest/meta_data.json
{"files": [{"path": "/etc/sysconfig/network-scripts/ifcfg-eth0", "content_path": "/content/0000"}, {"path": "/etc/sysconfig/network-scripts/route-eth0", "content_path": "/content/0001"}], "admin_pass": "QV38k3ybg5vT", "random_seed": "KErKo2rh/R5AYSRUqRNHuHRPSKKoC8KkQcpGd1twyEd9W5wisVtCCOyK/BT/hBMZSG7jXjcVX+JIqLzZp6RsKOpYKsE+IIjBOMmJDD9DPS+y9U/J8sV7gmxu7bmFztWP3M/G+JalhPmYyYbLcApjMnzFMG8NohCVkS87K/CIqz6s4rOInhy2ZucX2E7R1paIzXpWfQG/XlHlCfP2lyxaWLNKg8+ixU1+FviUehPl+fz49nmajFOuwJJ3S2rkCm/KzeEoGYWl6lXNIh43ljp+GNI0+vNuaXVanH8OluZgi/1VS65anlWobRAt7qM4yxnoHLkeDh5k9vADNyX7+SIqntIfOo6frawRlD/OQYiXazhkiRTKXcm0eZjetYL9stDq7SrEZLlMgqp7bzKSHcle3SydkklCP1zf937v7njSWF2DqmvpfqvgkAgdGbhEYfOGnPptROScjzlpFmKqnQtHLo1kjgpeHrPatTamWiFr15vpHx1GQot0Ng6uwtPaxKcMvHwIHalMUrpTnHi5d7d9SAtdt66JCHLhNRtw1bLxvsqQP36NNweYfLFVLwI5uNt4d4oEwFRl/c0M2nKnPN/OHO3T5P1iKv+zYpOOX4pXaRLF23twUh/OI8qmf/ZHS6fWz+jTjjrxNYhCLRsl7yqMEeVqdLeVaLnvA09CabSxeT8=", "uuid": "5c3f3e8f-4c6a-4f1c-a370-2bb45ac26df8", "availability_zone": "nova", "hostname": "rh6ca-tst2.novalocal", "launch_index": 0, "name": "rh6ca-tst2"}[

But files haven't been copied to target locations, and script was not executed.

In /var/log/cloud-init.log (truncated to keep only config-drive related info) :

Mar 12 10:14:42 localhost [CLOUDINIT] importer.py[DEBUG]: Found DataSourceConfigDrive with attributes ['get_datasource_list'] in ['cloudinit.sources.DataSourceConfigDrive']
Mar 12 10:14:43 localhost [CLOUDINIT] __init__.py[DEBUG]: Seeing if we can get any data from <class 'cloudinit.sources.DataSourceConfigDrive.DataSourceConfigDrive'>
Mar 12 10:14:43 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-odevice', '/dev/sr0'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:43 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-odevice', '/dev/sr1'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:43 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-tTYPE=vfat', '-odevice'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:43 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-tTYPE=iso9660', '-odevice'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:43 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-tLABEL=config-2', '-odevice'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:45 localhost [CLOUDINIT] stages.py[DEBUG]: Loaded datasource DataSourceConfigDriveNet - DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0]

Mar 12 10:14:48 localhost [CLOUDINIT] helpers.py[DEBUG]: Running config-mounts using lock (<FileLock using file '/var/lib/cloud/instances/5c3f3e8f-4c6a-4f1c-a370-2bb45ac26df8/sem/config_mounts'>)
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: Attempting to determine the real name of ephemeral0
Mar 12 10:14:48 localhost [CLOUDINIT] DataSourceConfigDrive.py[DEBUG]: Using ec2 metadata lookup to find device ['ephemeral0']
Mar 12 10:14:48 localhost [CLOUDINIT] DataSourceConfigDrive.py[DEBUG]: Using os lookup to find device ['ephemeral0']
Mar 12 10:14:48 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-tLABEL=ephemeral0', '-odevice'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: Ignoring nonexistant default named mount ephemeral0
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: Attempting to determine the real name of swap
Mar 12 10:14:48 localhost [CLOUDINIT] DataSourceConfigDrive.py[DEBUG]: Using ec2 metadata lookup to find device ['swap']
Mar 12 10:14:48 localhost [CLOUDINIT] DataSourceConfigDrive.py[DEBUG]: Using os lookup to find device ['swap']
Mar 12 10:14:48 localhost [CLOUDINIT] util.py[DEBUG]: Running command ['blkid', '-tTYPE=swap', '-odevice'] with allowed return codes [0, 2] (shell=False, capture=True)
Mar 12 10:14:48 localhost [CLOUDINIT] DataSourceConfigDrive.py[DEBUG]: Using cfg drive lookup mapped to device /dev/mapper/vg00-lvswap
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: Mapped metadata name swap to /dev/mapper/vg00-lvswap
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: did not find entry for vg00-lvswap in /sys/block
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: Ignoring nonexistant default named mount swap
Mar 12 10:14:48 localhost [CLOUDINIT] cc_mounts.py[DEBUG]: No modifications to fstab needed.
Mar 12 10:14:48 localhost [CLOUDINIT] util.py[DEBUG]: Writing to /var/lib/cloud/instances/5c3f3e8f-4c6a-4f1c-a370-2bb45ac26df8/sem/config_locale - wb: [420] 20 bytes

Mar 12 10:14:52 localhost [CLOUDINIT] util.py[DEBUG]: Cloud-init v. 0.7.4 finished at Thu, 12 Mar 2015 09:14:52 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0].  Up 34.05 seconds