[SRU] ConfigDrive fails to provision when network interface key is "interfaces"

Bug #1492468 reported by Ben Howard
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Invalid
Medium
Unassigned
Precise
Fix Released
Undecided
Unassigned

Bug Description

[SRU Justification]

[IMPACT] The ConfigDrive datasource fails to provision on ConfigDrive capable clouds that use "interfaces" rather than "network-interfaces".

This is only seen on 12.04. As a result, some Cloud providers are unable to use Cloud-init to provision Ubuntu Instances

[FIX] The fix is simple: allow for both "network-interfaces" and "interfaces" when reading the meta-data.

[REGRESSION POTENTIAL] This is a mild-risk change. CloudDrive has been implemented by many Cloud Providers and this change implements a new set of behavior. The most likely scenerio is that Cloud-init on Ubuntu 12.04 will start work where it has been broken previously.

[TEST CASES 1] :
1. Build new images from proposed
2. Boot image on Cloud w/ "instance" as the metadata value
3. Boot image on Cloud w/ "network-interfaces" as the metadata value
4. Check to make sure that cloud-init provisioned with out errors

[TEST CASE 2]:
1. Build existing Ubuntu image on ConfigDrive provisioned cloud
2. Check for any errors in the logs
3. Upgrade cloud-init
4. Reboot and check for errors in logs
5. Create a new instance from existing instance
6. Check for errors in the log.

The following meta_data.json is from an instance showing the problem:
{
    "domain": "foobar.com",
    "files": [
        []
    ],
    "hostname": "utl-precise-0904-88f2e9",
    "meta": {
        "dsmode": "net"
    },
    "name": "utl-precise-0904-88f2e9",
    "network_config": {
        "content_path": "/content/interfaces"
    },
    "public_keys": {
        "177313": "<REDACTED FOR READABILITY>"
    },
    "uuid": "9ba148b1-74d2-7f3f-2e8d-68746513d09f"
}

Changed in cloud-init (Ubuntu Precise):
status: New → In Progress
Changed in cloud-init (Ubuntu Precise):
assignee: nobody → Ben Howard (utlemming)
Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Simple fix:

--- cloud-init-0.6.3.orig/cloudinit/DataSourceConfigDrive.py
+++ cloud-init-0.6.3/cloudinit/DataSourceConfigDrive.py
@@ -198,8 +198,14 @@
             LOG.debug("Updating network interfaces from config drive (%s)",
                       dsmode)

- util.write_file("/etc/network/interfaces",
- md['network-interfaces'])
+ # Look at network-interfaces first and then use interfaces
+ # to support OpenNimbula clouds.
+ for iname in ("network-interfaces", "interfaces"):
+ iface_def = md.get(iname, None)
+ if iface_def is not None:
+ util.write_file("/etc/network/interfaces", iface_def)
+ break
+
             try:
                 (out, err) = util.subp(['ifup', '--all'])
                 if len(out) or len(err):

description: updated
Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :
description: updated
description: updated
summary: - ConfigDrive fails to provision when network interface key is
+ [SRU] ConfigDrive fails to provision when network interface key is
"interfaces"
tags: added: patch
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Ben, or anyone else affected,

Accepted cloud-init into precise-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.6.3-0ubuntu1.21 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):
status: Confirmed → Invalid
Changed in cloud-init (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
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.6.3-0ubuntu1.21

---------------
cloud-init (0.6.3-0ubuntu1.21) precise; urgency=medium

  * debian/patches/lp-1492420-config-drive_skip-invalid-file-paths.patch:
     - skip null length paths defined on some Cloud Drive implementations
       (LP: #1492420).
  * debian/patches/lp-1492468-config-drive_alternative-interface-path.patch:
     - use alternative interface definition of "interfaces" when
       "network-interfaces" is invalid as used on some Cloud Drive
       implementations (LP: #1492468).

 -- Ben Howard <email address hidden> Tue, 08 Sep 2015 14:45:36 -0600

Changed in cloud-init (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for cloud-init 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 regressions.

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.