Make the oracle template honor the lxc.network.type and
lxc.network.link configuration items if a "base" configuration file is
passed to lxc-create. If no configuration file is passed, the template
falls back to the default name created by libvirt.

Signed-off-by: Dwight Engen <dwight.en...@oracle.com>
---
 templates/lxc-oracle.in |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
index ba62f8f..2d62396 100644
--- a/templates/lxc-oracle.in
+++ b/templates/lxc-oracle.in
@@ -27,10 +27,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
 
-# use virbr0 that is setup by default by libvirtd
-lxc_network_type=veth
-lxc_network_link=virbr0
-
 die()
 {
     echo "failed: $1"
@@ -250,6 +246,18 @@ container_config_create()
                      head -1 |awk '{print $2}' | cut -c1-10 |\
                      sed 's/\(..\)/\1:/g; s/.$//'`"
     mkdir -p $cfg_dir || die "unable to create config dir $cfg_dir"
+
+    # see if the network settings are specified in the file thats handed to us
+    lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= 
\t]+' '{ print $2 }'`
+    if [ -z "$lxc_network_type" ]; then
+       lxc_network_type="veth"
+    fi
+
+    lxc_network_link=`grep '^lxc.network.link' $cfg_dir/config | awk -F'[= 
\t]+' '{ print $2 }'`
+    if [ -z "$lxc_network_link" ]; then
+       lxc_network_link="virbr0"
+    fi
+
     rm -f $cfg_dir/config
     cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
 # Container configuration for Oracle Linux $release_major.$release_minor
-- 
1.7.1


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to