cloud-init will have race conditions for cloud-config with multiple network adapters

Bug #810044 reported by Scott Moser
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Unassigned
cloud-init (Ubuntu)
Fix Released
Medium
Unassigned
ifupdown (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

right now, if there are multiple network adapters in a system, cloud-init coudl start running cloud-config jobs before network was really up.

That means installing additional packages could be attempted before the network required was up. cloud-config could start as early as the first network coming up.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: cloud-init 0.6.1-0ubuntu11
ProcVersionSignature: User Name 3.0-3.4-virtual 3.0.0-rc5
Uname: Linux 3.0-3-virtual x86_64
Architecture: amd64
Date: Wed Jul 13 17:46:07 2011
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

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

The belief is that Clint is going to add some event in upstart that will be fired when all 'auto' network interfaces in /etc/network/interfaces are up. Given that event named 'NEW_NETWORK_DEVICES_ARE_UP_EVENT', the patch for this bug looks something (I think) like this:

--- upstart/cloud-init-nonet.conf 2011-06-28 10:41:05 +0000
+++ upstart/cloud-init-nonet.conf 2011-07-19 17:15:51 +0000
@@ -3,7 +3,7 @@
 # * to block running of cloud-init until a non 'lo' interface is up
 # * timeout if one doens't come up in a reasonable amount of time
 start on mounted MOUNTPOINT=/ and stopped cloud-init-local
-stop on net-device-up IFACE!=lo
+stop on NEW_NETWORK_DEVICES_ARE_UP_EVENT
 task

 console output

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

Clint pointed me at lp:~clint-fewbar/ubuntu/oneiric/ifupdown/static-network-up/ a few weeks ago.
I made some changes to that to avoid the temp file needs and pushed those to
  lp:~smoser/ubuntu/oneiric/ifupdown/static-network-up/

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

@clint,
  I think there is an issue with the branch you've been working on when mappings are used.
  I've fixed my branch to use the first token of /var/run/network/ifstate rather than the second. Experimentation showed that the first field will be the physical interface and the second would be the virtual. 'auto' lines in interfaces reference virtual.

  That would seem to be fine, but my issue right now is that 'ifquery --list' does not show any interfaces that have had mappings done. Sadly:

$ cat /etc/network/interfaces
auto eth0
mapping eth0
  script /usr/local/bin/print-last
  map AUTO xdhcp
  map MANUAL xmanual
iface xdhcp inet dhcp
iface xmanual inet static
  address 192.168.42.1
  netmask 255.255.255.0

$ cat /usr/local/bin/print-last
#!/bin/sh
while read name val; do last=$val; done
echo $last

$ sudo ifquery --list
lo
Ignoring unknown interface eth0=eth0.

$ sudo ifup eth0
$ cat /var/run/network/ifstate
lo=lo
eth0=xmanual

$ sudo ifquery --list
lo
Ignoring unknown interface eth0=eth0.

The 'Ignoring' message goes to stderr.

The issue, is that with the current implementation, the 'static-network-up' would fire as soon as 'lo' was up. Because the 'ifquery --list' is not providing a complete list to stdout as expected.

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

My branch (linked above) has a fix for the 'ifquery --list' issue (manually parsing /etc/interfaces). I realize that is less than ideal.

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

This bug was fixed in the package ifupdown - 0.6.10ubuntu5

---------------
ifupdown (0.6.10ubuntu5) oneiric; urgency=low

  [Scott Moser]
  * debian/ifupdown.upstart.if-up: emit static-network-up when all auto
    network interfaces are up. (LP: #810044)

  [ Clint Byrum ]
  * debian/rules: dh_installinit has changed and exposes that the
    network-interface-security job should also have --noscripts
 -- Clint Byrum <email address hidden> Mon, 01 Aug 2011 12:40:37 -0700

Changed in ifupdown (Ubuntu):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.6.1-0ubuntu13

---------------
cloud-init (0.6.1-0ubuntu13) oneiric; urgency=low

  * do not install 92-uec-upgrade-available as a motd hook. This file was
    installed but did not do anything since updates-check was removed.
  * support multiple staticly configured network devices, as long as
    all of them come up early (LP: #810044)

  [Marc Cluet]
  * add support for passing mcollective keys via cloud-config
  * add support for 'include-once' type. include-once urls are only
    retrieved once-per-instance rather than on every boot.
 -- Scott Moser <email address hidden> Mon, 01 Aug 2011 16:45:40 -0400

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

Just for reference, the code added here for ifupdown is expected to be used to fix bug 580319 .

Scott Moser (smoser)
Changed in cloud-init:
importance: Undecided → Medium
status: Triaged → Fix Committed
Scott Moser (smoser)
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.