It should be possible to access the ConfigDrive as a CDROM drive as well

Bug #1100545 reported by Alessandro Pilotti
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Scott Moser
cloud-init (Ubuntu)
Fix Released
Low
Scott Moser
Precise
Fix Released
Medium
Scott Moser
Quantal
Fix Released
Medium
Scott Moser

Bug Description

== Begin SRU Information ==
[Impact]
'config-drive' is a mechanism for passing data from the hypervisor (or
cloud platform) to the guest (instance). cloud-init as delivered in 12.10
correctly implements locating this drive as it is present in OpenStack
in the folsom release.

A change is being made in grizzly to allow for the device that contains
the data to be presented as a CD-ROM rather than a block device as it was
done in folsom. This changes is primarily driven by non-linux
hypervisors.

In order to support Ubuntu cloud images running as a guest on grizzly
hypervisors that choose to attach the config-drive as a CD-ROM, we need
to make a change to cloud-init to consider CD-ROMs as a possible source.
Previously, cloud-init would ignore any device that ended with a digit
(0-9). Now, it allows the data to come from any block device that is
not a partition.

[Test Case]
Attached to this bug is an ISO that provides config-drive-v2 data.
The following is the current situation:
 attached-as-cdrom: cloud-init ignores.
 attached-as-disk: cloud-init processes

After the fix is applied, you will see;
 attached-as-cdrom: cloud-init processes
 attached-as-disk: cloud-init processes

The provided ISO file simply sets a password for the 'ubuntu' user to
'passw0rd'. So, verification that the test worked is as easy as logging
in with 'ubuntu' and 'passw0rd', either via ssh or via the console.

To perform this test, download a quantal cloud-image from
http://cloud-images.ubuntu.com and boot it with kvm.

$ imgurl="http://cloud-images.ubuntu.com/releases/quantal/release-20121218/ubuntu-12.10-server-cloudimg-amd64-disk1.img"
$ deburl="https://launchpad.net/~smoser/+archive/cloud-init-test/+files/cloud-init_0.7.0-0ubuntu2.3%7Eppa0_all.deb"
$ isourl="https://bugs.launchpad.net/cloud-init/+bug/1100545/+attachment/3509470/+files/disk.config.gz"

$ wget $imgurl -O quantal-amd64.img.dist
$ wget $deburl -O cloud-init.deb
$ wget $isourl -O cfgdisk.img.dist;

$ qemu-img convert -O qcow2 quantal-amd64.img.dist disk1.img.dist
$ qemu-img create -f qcow2 -b disk1.img.dist patched.img.dist

$ zcat --force cfgdisk.img.dist > cfgdisk.img
$ chmod 600 cfgdisk.img disk1.img.dist

# patch the patched.img.dist with new cloud-init
$ bzr branch lp:~smoser/+junk/backdoor-image ./bi
$ sudo ./bi/mount-callback-umount patched.img.dist -- \
    sh -ec 'mp=$1; cp cloud-init.deb $mp/tmp &&
            LANG=C chroot $mp dpkg -i /tmp/cloud-init.deb ;
            rm $mp/tmp/cloud-init.deb' --

$ qemu-img create -f qcow2 -b patched.img.dist patched.img

# boot patched and unpatched images as cdrom and as disk
## unpatched-disk (works)
$ qemu-img create -f qcow2 -b disk1.img.dist unpatched.img
$ kvm -m 512 -drive file=unpatched.img,if=virtio -drive file=cfgdisk.img,if=virtio

## unpatched-cdrom (config-drive ignored, long boot, fail)
$ qemu-img create -f qcow2 -b disk1.img.dist unpatched.img
$ kvm -m 512 -drive file=unpatched.img,if=virtio -cdrom cfgdisk.img

## patched-disk (works)
$ qemu-img create -f qcow2 -b patched.img.dist patched.img
$ kvm -m 512 -drive file=patched.img,if=virtio -drive file=cfgdisk.img,if=virtio

## patched-cdrom (FIXED)
$ qemu-img create -f qcow2 -b patched.img.dist patched.img
$ kvm -m 512 -drive file=patched.img,if=virtio -cdrom cfgdisk.img

The unpatched version with cdrom will take quite a long time to boot, and
you'll messages on the serial console like:see:
 2013-01-31 18:53:18,185 - DataSourceEc2.py[CRITICAL]: giving up on md after 120

[Regression Potential]
The potential for regression is low. The most likely possibility for
error would be in incorrectly identifying a cd-rom and its content as a
config-drive.
== End SRU Information ==

Currently Cloud-Init requires the ConfigDrive to be available on an unpartitioned disk, not a CDROM drive. Windows doesn't recognise this type of devices and mounting them requires the extraction of the data from the raw disk to an ISO file to be mounted / extracted afterwards.

It should be optionally possible to access the ConfigDrive as a plain CDROM as well to simplify the access on any operating system.

The raw HDD option compared to the CDROM one offers slightly better data access protection especially for the admin_pass field, but as this is going to be a deprecated option in the short term, the benefits are very limited compared to the additional complications for accessing the ConfigDrive data.

Related branches

Revision history for this message
Scott Moser (smoser) wrote :

"The raw HDD option compared to the CDROM one offers slightly better data access protection especially for the admin_pass field, but as this is going to be a deprecated option in the short term, the benefits are very limited compared to the additional complications for accessing the ConfigDrive data."

Did you raise this on the openstack mailing list ?

Changed in cloud-init:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Scott Moser (smoser) wrote :

This was fixed in trunk in revision 760.

Changed in cloud-init:
assignee: nobody → Scott Moser (smoser)
status: Confirmed → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote :

Fixed in 0.7.1-0ubuntu5.

Changed in cloud-init (Ubuntu):
assignee: nobody → Scott Moser (smoser)
importance: Undecided → Low
status: New → Fix Released
Changed in cloud-init (Ubuntu Precise):
status: New → Triaged
Changed in cloud-init (Ubuntu Quantal):
status: New → Triaged
Changed in cloud-init (Ubuntu Precise):
importance: Undecided → Medium
Changed in cloud-init (Ubuntu Quantal):
importance: Undecided → Medium
Changed in cloud-init (Ubuntu Precise):
assignee: nobody → Scott Moser (smoser)
Changed in cloud-init (Ubuntu Quantal):
assignee: nobody → Scott Moser (smoser)
Scott Moser (smoser)
description: updated
Revision history for this message
Scott Moser (smoser) wrote :
Scott Moser (smoser)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Alessandro, or anyone else affected,

Accepted cloud-init into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/cloud-init/0.7.0-0ubuntu2.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in cloud-init (Ubuntu Quantal):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Scott Moser (smoser) wrote :

verified using the test above, but instead of using the deb, patched to use proposed like:
sudo ./bi/mount-callback-umount patched.img.dist -- \
    env LANG=C chroot MOUNTPOINT sh -ec '
       rel=$(lsb_release -sc)
       echo "deb http://archive.ubuntu.com/ubuntu $rel-proposed main" > \
            /etc/apt/sources.list.d/$rel-proposed.list
       apt-get update -q -y
       apt-get install cloud-init -q -y'

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.0-0ubuntu2.3

---------------
cloud-init (0.7.0-0ubuntu2.3) quantal-proposed; urgency=low

  * debian/patches/lp-1100545-allow-config-drive-from-cdrom.patch:
    in config-drive data to be provided from a CD-ROM (LP: #1100545)
 -- Scott Moser <email address hidden> Thu, 31 Jan 2013 15:13:30 -0500

Changed in cloud-init (Ubuntu Quantal):
status: Fix Committed → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hello Alessandro, or anyone else affected,

Accepted cloud-init into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/cloud-init/0.6.3-0ubuntu1.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in cloud-init (Ubuntu Precise):
status: Triaged → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Scott Moser (smoser) wrote :

Verified using latest released 12.04 image from raring under kvm:

$ imgurl="http://cloud-images.ubuntu.com/releases/precise/release-20130204/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
$ deburl="https://launchpad.net/ubuntu/+source/cloud-init/0.6.3-0ubuntu1.5/+build/4312778/+files/cloud-init_0.6.3-0ubuntu1.5_all.deb"
$ isourl="https://bugs.launchpad.net/cloud-init/+bug/1037567/+attachment/3509468/+files/disk.config.gz"

$ wget $imgurl -O precise-amd64.img.dist
$ wget $deburl -O cloud-init.deb
$ wget $isourl -O cfgdisk.img.dist;

$ qemu-img convert -O qcow2 precise-amd64.img.dist disk1.img.dist
$ qemu-img create -f qcow2 -b disk1.img.dist patched.img.dist

$ zcat --force cfgdisk.img.dist > cfgdisk.img
$ chmod 600 cfgdisk.img disk1.img.dist

## patch the patched.img.dist with new cloud-init
$ bzr branch lp:~smoser/+junk/backdoor-image ./bi
$ sudo ./bi/mount-callback-umount patched.img.dist -- \
    sh -ec 'mp=$MOUNTPOINT; cp cloud-init.deb $mp/tmp &&
            LANG=C chroot $mp dpkg -i /tmp/cloud-init.deb ;
            rm $mp/tmp/cloud-init.deb' --

$ qemu-img create -f qcow2 -b disk1.img.dist unpatched.img
$ qemu-img create -f qcow2 -b patched.img.dist patched.img

# boot patched and unpatched images
$ kvm -m 512 -drive file=patched.img,if=virtio -cdrom cfgdisk.img -curses

% grep found.data.source /var/log/cloud-init.log
2013-02-19 21:50:40,887 - __init__.py[DEBUG]: found data source DataSourceConfigDriveNet
2013-02-19 21:50:40,957 - cloud-init[DEBUG]: found data source: DataSourceConfigDrive [net,ver=2][source=/dev/sr0]

tags: added: verification-done
removed: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.6.3-0ubuntu1.5

---------------
cloud-init (0.6.3-0ubuntu1.5) precise-proposed; urgency=low

  * debian/update-grub-legacy-ec2: consider kernels bootable on ec2
    that are named -generic, in addition to -virtual. This fixes a problem
    where the kernels installed by linux-lts-quantal were not added to
    /boot/grub/menu.lst (LP: #1005551)
  * debian/patches/lp-1077020-fix-ca-certificates-blanklines.patch: fix
    adding of empty lines in ca-certificates file (LP: #1077020)
  * debian/patches/lp-1031065-nonet-not-start-networking.patch: do not 'start
    networking' in cloud-init-nonet upstart job. Doing so can cause networking
    to be started earlier than it should be. Instead, add a
    cloud-init-container job that runs only in a container and emits
    net-device-added (LP: #1031065).
  * debian/patches/lp-1037567-add-config-drive-v2-support.conf:
    backport support for config-drive-v2 which is part of Openstack Nova in
    Folsom and later. (LP: #1037567) (LP: #1100545)
 -- Scott Moser <email address hidden> Wed, 16 Jan 2013 19:37:57 -0500

Changed in cloud-init (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Scott Moser (smoser) wrote :

fixed in 0.7.2

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
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.