← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1281305] [NEW] NoCloud source broken in Trusty cloud images

 

Public bug reported:

I have a test script that verifies virtualization is working correctly,
it does so by downloading and booting a cloud image (as the main use
case is verification of cloud infrastructure). Since I just care about
correctly booting the VM, I don't need to connect to an actual cloud
controller or anything, so my script just builds a noCloud source with a
basic config file that just uses runcmd and final_message to give me
something in the logs to grep for, to ensure the VM initialized
correctly.

This script started failing with trusty cloud images recently :( I
noticed because the text I grep for wasn't being found, which means the
config isn't being read correctly.


Steps to reproduce:

I came up with a script that can be run (assuming a proper qemu setup).
This is very heavily inspired in doc/sources/nocloud/README.rst which has a similar example.

#Download the image
IMAGE=trusty-server-cloudimg-i386-disk1.img
wget -c http://cloud-images.ubuntu.com/trusty/current/$IMAGE
# Create a seed.iso per doc/sources/nocloud/README.rst
{ echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
printf "#cloud-config\npassword: passw0rd\nchpasswd: { expire: False }\nssh_pwauth: True\n" > user-data
# Two additional tests to ensure these parameters are considered
printf "\n\nruncmd:\n - [sh, -c, echo ' ==== I WILL NOT SEE THIS ==== ' >/tmp/runcmd.txt ]\n" >> user-data
printf "\n\nfinal_message: FINAL MESSAGE\n" >> user-data
genisoimage  -output seed.iso -volid cidata -joliet -rock user-data meta-data

# Create qcow image to boot, per the same README file
qemu-img create -f qcow2 -b $IMAGE boot-disk.img

# Boot the image, also per the README
kvm -m 256 \
 -drive file=boot-disk.img,if=virtio \
 -drive file=seed.iso,if=virtio, \
 -net nic -net user,hostfwd=tcp::2222-:22 \


Expected result: (This was verified with a saucy cloud image):
- The node boots and leaves me at the ubuntu login: prompt.
- Logging in with ubuntu/passw0rd works
- /tmp/runcmd.txt exists and contains I WILL NOT SEE THIS
- grep FINAL /var/log/cloud-init.log returns a match in that file.

Actual result:
- The node takes much longer to boot than the saucy one.
- Unable to login with ubuntu/passw0rd (suggesting the configuration wasn't loaded)
- No /tmp/runcmd.txt
- No FINAL text in /var/log/cloud-init.log
- The final two items were determined by shutting down the VM and mounting the .img file for manual review.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1281305

Title:
  NoCloud source broken in Trusty cloud images

Status in Init scripts for use on cloud images:
  New

Bug description:
  I have a test script that verifies virtualization is working
  correctly, it does so by downloading and booting a cloud image (as the
  main use case is verification of cloud infrastructure). Since I just
  care about correctly booting the VM, I don't need to connect to an
  actual cloud controller or anything, so my script just builds a
  noCloud source with a basic config file that just uses runcmd and
  final_message to give me something in the logs to grep for, to ensure
  the VM initialized correctly.

  This script started failing with trusty cloud images recently :( I
  noticed because the text I grep for wasn't being found, which means
  the config isn't being read correctly.

  
  Steps to reproduce:

  I came up with a script that can be run (assuming a proper qemu setup).
  This is very heavily inspired in doc/sources/nocloud/README.rst which has a similar example.

  #Download the image
  IMAGE=trusty-server-cloudimg-i386-disk1.img
  wget -c http://cloud-images.ubuntu.com/trusty/current/$IMAGE
  # Create a seed.iso per doc/sources/nocloud/README.rst
  { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
  printf "#cloud-config\npassword: passw0rd\nchpasswd: { expire: False }\nssh_pwauth: True\n" > user-data
  # Two additional tests to ensure these parameters are considered
  printf "\n\nruncmd:\n - [sh, -c, echo ' ==== I WILL NOT SEE THIS ==== ' >/tmp/runcmd.txt ]\n" >> user-data
  printf "\n\nfinal_message: FINAL MESSAGE\n" >> user-data
  genisoimage  -output seed.iso -volid cidata -joliet -rock user-data meta-data

  # Create qcow image to boot, per the same README file
  qemu-img create -f qcow2 -b $IMAGE boot-disk.img

  # Boot the image, also per the README
  kvm -m 256 \
   -drive file=boot-disk.img,if=virtio \
   -drive file=seed.iso,if=virtio, \
   -net nic -net user,hostfwd=tcp::2222-:22 \

  
  Expected result: (This was verified with a saucy cloud image):
  - The node boots and leaves me at the ubuntu login: prompt.
  - Logging in with ubuntu/passw0rd works
  - /tmp/runcmd.txt exists and contains I WILL NOT SEE THIS
  - grep FINAL /var/log/cloud-init.log returns a match in that file.

  Actual result:
  - The node takes much longer to boot than the saucy one.
  - Unable to login with ubuntu/passw0rd (suggesting the configuration wasn't loaded)
  - No /tmp/runcmd.txt
  - No FINAL text in /var/log/cloud-init.log
  - The final two items were determined by shutting down the VM and mounting the .img file for manual review.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1281305/+subscriptions


Follow ups

References