Commit Graph

7 Commits

Author SHA1 Message Date
Robert Collins
c7875398b3 Fix resource exhaustion with upstart.
When high VM churn is encountered dhcp-all-interfaces got tangled up
and leaked instances until upstart run out of filedescriptors.

This happened because we were locking on every invocation, and the
lock logic was disabling the single-interface code - so we always
probed every interface every time - and this was serialized across
every instance of dhcp-all-interfaces.

Change-Id: I4ef1fb83d978cc99d4cb9cc2666bde302c6db7d1
2014-04-01 22:45:12 +13:00
Dan Prince
6f764d9119 dhcp-all-interfaces: correct ifquery return stmt
Corrects an issue in the config_exists function that could
cause duplicate interfaces to be configured on Ubuntu.

Previously we used 'return ifquery' directly which caused
a silent 'numberic argument required' error to go unnoticed.
This would also return 1 meaning a new interface would get
configured.

The new logic should handle things properly.

Change-Id: I625225e15113d7e184e3bcb5054df1616dec008a
Closes-bug: #1298430
2014-03-27 10:47:55 -04:00
Dan Prince
f10e614579 Support adding DHCP interfaces one at a time.
Refactors dhcp-all-interfaces.sh so that if an optional
INTERFACE argument (the first argument) is passed to the script
it only inspects that single interface. If no argument is
passed then the previous default behaviour is used which
causes all interfaces to be inspected.

To avoid a collision with the previous $1 we move to using
$FLOCKED for the exec flock command which runs on distributions
using ENI.

Also sets PATH so that the commands within the script
can all be found if it isn't set properly (/sbin/ip, /bin/cat, etc.)

This is a move towards using udev rules to add these types
of interfaces automatically.

Change-Id: I3ec8fd2cc2071bfc6943c744ca619e31b71146fc
2014-03-14 13:30:17 -04:00
Robert Collins
39e6f7a5c4 Revert "Support adding DHCP interfaces one at a time. "
This reverts commit a1b469b10b.

This broke testenv deployments - it does not yet work on Ubuntu.

Change-Id: I0f74abc6b99da4b8cabca8ed673c606bae7de0e1
2014-02-14 14:42:58 +13:00
Dan Prince
a1b469b10b Support adding DHCP interfaces one at a time.
Refactors dhcp-all-interfaces.sh so that if an optional
INTERFACE argument (the first argument) is passed to the script
it only inspects that single interface. If no argument is
passed then the previous default behaviour use used which
causes all interfaces to be inspected.

Also sets PATH so that the commands within the script
can all be found if it isn't set properly (/sbin/ip, /bin/cat, etc.)

This is a move towards using udev rules to add these types
of interfaces automatically.

Change-Id: Ia482c1d3ddce0f0d8d77f9bc3ac76d6924640715
2014-02-12 11:57:56 -05:00
Dan Prince
01e25c378b ifquery doesn't exist on Fedora
Updates dhcp-all-interfaces so that we avoid using
ifquery on Fedora to determine if an interface exists.

Adds a new config_exists function which simply looks for
the ifcfg config file on distro's that use netscripts.

Change-Id: Ie55524b83820fe4fab28cc9d3f7e08ca2e42c182
2014-02-07 13:33:35 -05:00
Dan Prince
5da1f1324b Rename generate-interfaces-file.sh...
Rename generate-interfaces-file.sh to dhcp-all-interfaces.sh
so that it is easier to find/remember in the $PATH on a deployed
image.

Also, on some distros the script actually generates many files
so the previous name was a bit confusing.

Change-Id: I7152fa7c28e8ade251311da2cd5f75972423b66c
2014-01-23 16:38:41 -05:00