1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# lxc: linux Container library
# Authors:
# Serge Hallyn <serge.hallyn@ubuntu.com>
#
# This is a test script for the lxc-user-nic program
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
set -e
s=`mktemp -d /tmp/lxctest-XXXXXX`
DONE=0
key=$1
desc=$2
echo "Test $testnum failed"
echo "unequal number of $desc"
false
fi
}
}
verify_unchanged_number lxc.network.type "network defs"
}
verify_unchanged_number lxc.network.hwaddr "hwaddr defs"
grep ^lxc.network.hwaddr $CONTAINER_PATH/config | while read line; do
echo "looking for $addr in $CONTAINER2_PATH/config"
if grep -q $addr $CONTAINER2_PATH/config; then
echo "Test $testnum failed"
echo "hwaddr $addr was not changed"
false
fi
done
}
verify_unchanged_number lxc.hook "hooks"
grep ^lxc.hook $CONTAINER_PATH/config | while read line; do
echo "Test $testnum failed"
echo "Failed to find $nline in:"
fi
done
}
# Simple nic
lxc.network.type = veth
lxc.network.link = lxcbr0
EOF
# Simple nic with hwaddr; verify hwaddr changed
lxc.network.type = veth
lxc.network.link = lxcbr0
EOF
# No nics, but nic from include
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.hook.start = /bin/bash
EOF
lxc.include = $s/1.include
EOF
# No nics, one clone hook in /bin
lxc.hook.start = /bin/bash
EOF
# Figure out container dirname
# We need this in 5.conf
# No nics, one clone hook in $container
lxc.hook.start = $CONTAINER_PATH/x1
EOF
CONTAINER2_PATH="${CONTAINER_PATH}2"
testnum=1
echo "Test $testnum starting ($f)"
# verify that # nics did not change
# verify hwaddr, if any changed
# verify hooks are correct
done
DONE=1