lxc-test-cloneconfig revision d0a6bd39400a6d14cfec94ad647f3af1bda1e321
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# lxc: linux Container library
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# Serge Hallyn <serge.hallyn@ubuntu.com>
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# This is a test script for the lxc-user-nic program
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# This library is free software; you can redistribute it and/or
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# modify it under the terms of the GNU Lesser General Public
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# License as published by the Free Software Foundation; either
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# version 2.1 of the License, or (at your option) any later version.
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# This library is distributed in the hope that it will be useful,
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# but WITHOUT ANY WARRANTY; without even the implied warranty of
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# Lesser General Public License for more details.
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# You should have received a copy of the GNU Lesser General Public
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# License along with this library; if not, write to the Free Software
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn n2=`grep ^$key $CONTAINER2_PATH/config | wc -l`
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn if [ $n1 -ne $n2 ]; then
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn verify_unchanged_number lxc.network.type "network defs"
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn verify_unchanged_number lxc.network.hwaddr "hwaddr defs"
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn grep ^lxc.network.hwaddr $CONTAINER_PATH/config | while read line; do
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn echo "looking for $addr in $CONTAINER2_PATH/config"
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn grep ^lxc.hook $CONTAINER_PATH/config | while read line; do
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn if ! grep -q "$nline" $CONTAINER2_PATH/config; then
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.network.type = veth
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.network.link = lxcbr0
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# Simple nic with hwaddr; verify hwaddr changed
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.network.type = veth
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.network.link = lxcbr0
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# No nics, but nic from include
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.network.type = veth
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.network.link = lxcbr0
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.hook.start = /bin/bash
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.include = $s/1.include
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# No nics, one clone hook in /bin
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.hook.start = /bin/bash
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# Figure out container dirname
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# We need this in 5.conf
67702c2129c462b5e8124020a496fbf6b7ae5540Serge HallynCONTAINER_PATH=$(dirname $(lxc-info -n lxctestb -c lxc.rootfs -H))
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallyn# No nics, one clone hook in $container
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynlxc.hook.start = $CONTAINER_PATH/x1
67702c2129c462b5e8124020a496fbf6b7ae5540Serge Hallynfor f in $s/*.conf; do