lxc-start-ephemeral needs tweak to handle centos and fedora hostname setting
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxc (Ubuntu) |
Fix Released
|
Medium
|
Serge Hallyn | ||
Precise |
Fix Released
|
Medium
|
Unassigned |
Bug Description
=======
SRU Justification:
1. Impact: lxc-start-ephemeral does not update hostname for fedora containers
2. Development fix: add the necessary files (/etc/sysconfig/) for fedora hosts to the list of files to be updated.
3. Stable fix: same as development fix.
4. test case: create a fedora container, then start an ephemeral one based on it:
lxc-create -t fedora -n f14
lxc-start-
and check its hostname
5. Regression potential: none - we only attempt updates if the file exists.
=======
As discussed in the thread "lxc template for RHEL?"
http://
lxc-start-ephemeral only knows how to tweak the hostname for ubuntu and debian,
and needs to be taught about where rhel and centos put hostname, something like this:
--- lxc-start-
+++ lxc-start-ephemeral 2012-08-27 12:19:54.471514479 -0700
@@ -154,7 +154,19 @@
LXC_MOUNTED=1
# Update the ephemeral lxc's configuration to reflect the new
container name.
- sudo sed -i -e "s/$LXC_
+ # Check all the places known distros keep hostnames.
+ # FIXME: should we sanity check the hostname to make sure it contains no bad chars?
+ for file in $LXC_DIR/fstab $LXC_DIR/config \
+ $LXC_DIR/
+ $LXC_DIR/
+ $LXC_DIR/
+ $LXC_DIR/
+ do
+ if test -f "$file"
+ then
+ sudo sed -i -e "s/$LXC_
+ fi
+ done
# Update the fstab to have all bind mounts be ephemeral.
sudo cp $LXC_DIR/fstab $LXC_DIR/fstab.old
This affects 12.04 and the ppa for lxc, so probably also 12.10 alpha 3.
Changed in lxc (Ubuntu): | |
assignee: | nobody → Serge Hallyn (serge-hallyn) |
tags: | added: needsru |
description: | updated |
Changed in lxc (Ubuntu Precise): | |
status: | New → In Progress |
importance: | Undecided → Medium |
tags: |
added: verification-done removed: verification-needed |
Thanks, Dan, for the bug report and the patch.