Merge lp:~benji/ubuntu/precise/lxc/bug-949956 into lp:ubuntu/precise/lxc

Proposed by Benji York
Status: Merged
Merged at revision: 74
Proposed branch: lp:~benji/ubuntu/precise/lxc/bug-949956
Merge into: lp:ubuntu/precise/lxc
Diff against target: 32 lines (+17/-0)
2 files modified
.bzrignore (+2/-0)
debian/local/lxc-start-ephemeral (+15/-0)
To merge this branch: bzr merge lp:~benji/ubuntu/precise/lxc/bug-949956
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+96601@code.launchpad.net

Commit message

add MAC address randomization to lxc-start-ephemeral. (LP: #949956)

Description of the change

This branch adds the lxc-clone MAC address randomization functionality
to lxc-start-ephemeral.

The code was copied nearly verbatim, with only a slight tweak to account
for the different variable names used in lxc-start-ephemeral.

The change has been manually tested in an application that requires
starting multiple ephemeral containers based on the same original
container.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2012-03-08 16:03:06 +0000
@@ -0,0 +1,2 @@
1tags
2TAGS
03
=== modified file 'debian/local/lxc-start-ephemeral'
--- debian/local/lxc-start-ephemeral 2012-03-02 17:20:46 +0000
+++ debian/local/lxc-start-ephemeral 2012-03-08 16:03:06 +0000
@@ -125,6 +125,21 @@
125fi125fi
126sudo sed -i -e "s/$LXC_BASE/$LXC_NAME/" $LXC_DIR/fstab $LXC_DIR/config $LXC_DIR/rootfs/etc/hostname $LXC_DIR/rootfs/etc/hosts126sudo sed -i -e "s/$LXC_BASE/$LXC_NAME/" $LXC_DIR/fstab $LXC_DIR/config $LXC_DIR/rootfs/etc/hostname $LXC_DIR/rootfs/etc/hosts
127127
128# update the ephemeral container's MAC address (lifted from lxc-clone)
129c=$LXC_DIR/config
130# change hwaddrs
131mv ${c} ${c}.old
132(
133while read line; do
134 if [ "${line:0:18}" = "lxc.network.hwaddr" ]; then
135 echo "lxc.network.hwaddr= 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')"
136 else
137 echo $line
138 fi
139done
140) < ${c}.old > ${c}
141rm -f ${c}.old
142
128# precise is now the worst - its dhclient *uses*143# precise is now the worst - its dhclient *uses*
129# /var/lib/dhcp3/dhclient.eth0.leases but ships without that144# /var/lib/dhcp3/dhclient.eth0.leases but ships without that
130# directory, so you get no leases file at all.145# directory, so you get no leases file at all.

Subscribers

People subscribed via source and target branches

to all changes: