Pls ignore this email.
On Tue, Mar 16, 2021 at 09:13:02PM +0800, Wang Chenglong wrote:
[How] Use the 'nr_nic' to set the number of network cards in yaml.
nr_nic: 2
root@vm-2p8g ~# ifconfig enp0s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.18.115.162 netmask 255.255.0.0 broadcast 172.18.255.255 inet6 fe80::835:ffff:fedf:384e prefixlen 64 scopeid 0x20<link> ether 0a:35:ff:df:38:4e txqueuelen 1000 (Ethernet) RX packets 586 bytes 180087 (175.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 80 bytes 12579 (12.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::868:97ff:fe92:59bb prefixlen 64 scopeid 0x20<link> ether 0a:68:97:92:59:bb txqueuelen 1000 (Ethernet) RX packets 527 bytes 173034 (168.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20 bytes 4760 (4.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Signed-off-by: Wang Chenglong 18509160991@163.com
providers/qemu.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/providers/qemu.sh b/providers/qemu.sh index 2fa5771..24211bc 100755 --- a/providers/qemu.sh +++ b/providers/qemu.sh @@ -2,6 +2,7 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. # - hostname +# - nr_nic
. $LKP_SRC/lib/yaml.sh . $CCI_SRC/container/defconfig.sh @@ -10,26 +11,40 @@ load_cci_defaults
: ${hostname:="vm-1p1g-1"} : ${queues:="vm-1p1g.$(arch)"} +: ${nr_nic:=1} # unicast prefix: x2, x6, xA, xE -export mac=$(echo $hostname | md5sum | sed 's/^(..)(..)(..)(..)(..).*$/0a-\1-\2-\3-\4-\5/')
+set_mac() +{
- export nr_nic=$(expr $nr_nic - 1)
- for i in $(seq 0 $nr_nic)
- do
mac=$(echo $hostname$i | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/0a-\1-\2-\3-\4-\5/')
mac_arr[$i]=$mac
- done
+} +set_mac
echo hostname: $hostname -echo mac: $mac -echo $mac > mac -echo "arp -n | grep ${mac//-/:}" > ip.sh +echo mac: ${mac_arr[*]} +echo ${mac_arr[*]} > mac +echo "arp -n | grep ${mac_arr[0]//-/:}" > ip.sh chmod +x ip.sh
set_host_info() { # use "," replace " " local api_queues=$(echo $queues | sed -r 's/ +/,/g')
- curl -X PUT "http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/set_host_mac?ho..." curl -X PUT "http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/set_host2queues..."
} set_host_info
del_host_info() {
- curl -X PUT "http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/del_host_mac?ma..." > /dev/null 2>&1
- curl -X PUT "http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/del_host_mac?ma..." > /dev/null 2>&1 curl -X PUT "http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/del_host2queues..." > /dev/null 2>&1
}
-- 2.23.0