From c281e32f623360bb50ebd7043bb64e785909bde9 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 16 Mar 2020 17:13:07 +0300 Subject: [PATCH] Rename network interfaces to eth1g*, eth10g* --- README.md | 4 ++-- network.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++------ opennebula.sh | 2 ++ run.sh | 20 +++++++++++-------- 4 files changed, 65 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 067cc39..c89eec5 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ - Убрать quiet из опций GRUB + На все ноды поставить qemu 4.x из sid (там virtio-blk discard=unmap умеет) - Везде прописать все ноды в /etc/hosts -- Переименовать сеть в eth1gX + eth10gX (X=1,2), иначе имена сетевых интерфейсов едут при перестановке NVMe-шек ++ Переименовать сеть в eth1gX + eth10gX (X=1,2), иначе имена сетевых интерфейсов едут при перестановке NVMe-шек - Везде убрать DHCP - Удалять network-manager - Добавить passwordless ssh от рута между всеми серверами (чисто для удобства, oneadmin и так есть) -- Настроить live миграцию при reschedule: https://github.com/OpenNebula/one/blob/612300b191224b172fa4511845f2a17faa5f547c/src/scheduler/etc/sched.conf#L99 ++ Настроить live миграцию при reschedule: https://github.com/OpenNebula/one/blob/612300b191224b172fa4511845f2a17faa5f547c/src/scheduler/etc/sched.conf#L99 - Добавить аналог inventory (перечень хостов с их переменными) - Шаблонизировать mon_initial_members в ceph.conf (?) - Мониторинг и алерты - пока Prometheus+Grafana настроены вручную на 172.31.1.13 ("подоконник") diff --git a/network.sh b/network.sh index f46a80c..1634278 100755 --- a/network.sh +++ b/network.sh @@ -11,17 +11,60 @@ if [ -z "$play_host" -o -z "$node_name" -o -z "$int_ip" ]; then exit 1 fi -### Find 1G and 10G network interfaces (10G is used for keepalived and galera) +### Rename 1G interfaces to eth1g[1,2,3...], 10G to eth10g[1,2,3...] +ssh root@$play_host ' + set -e -x + i10g=1 + i1g=1 + changed= + >tmp$$ + for i in /sys/class/net/eth1g* /sys/class/net/eth10g* `ls -d /sys/class/net/* | grep -vP "eth10?g"`; do + if [ -e "$i/device" ]; then + mac=`cat $i/address` + oldname=${i##/sys/class/net/} + newname=eth10g + if ethtool $oldname | grep -q 10000; then + newname=eth10g$i10g + i10g=$((i10g+1)) + else + newname=eth1g$i1g + i1g=$((i1g+1)) + fi + if [ "$newname" != "$oldname" ]; then + changed=1 + ip link set $oldname down + ip link set dev $oldname name $newname + ip link set $newname up + if [ -e /run/network/ifstate.$oldname ]; then + rm -f /run/network/ifstate.$oldname + echo $newname > /run/network/ifstate.$newname + fi + fi + cat >>tmp$$ </dev/null` == "x1" ]; then - if [ x`cat $i/speed 2>/dev/null` == "x10000" ]; then - echo eth10g=${i##/sys/class/net/} - elif [ x`cat $i/speed 2>/dev/null` == "x1000" ]; then - echo eth1g=${i##/sys/class/net/} + if [ x`cat $i/carrier 2>/dev/null` = "x1" ]; then + if [ x`cat $i/speed 2>/dev/null` = "x10000" -a "$eth10g" = "" ]; then + eth10g=${i##/sys/class/net/} + echo eth10g=$eth10g + elif [ x`cat $i/speed 2>/dev/null` = "x1000" -a "$eth1g" = "" ]; then + eth1g=${i##/sys/class/net/} + echo eth1g=$eth1g fi fi done') diff --git a/opennebula.sh b/opennebula.sh index 52a80fd..da18b85 100755 --- a/opennebula.sh +++ b/opennebula.sh @@ -116,6 +116,8 @@ set -e -x perl -i -pe 's!^DB\s*=.*!DB = [ backend = "mysql", server = "localhost", port = 0, user = "oneadmin", passwd = "$opennebula_db_password", db_name = "opennebula" ]!' /etc/one/oned.conf +perl -i -pe 's!^LIVE_RESCHEDS\s*=.*!LIVE_RESCHEDS = 1!' /etc/one/sched.conf + while ! echo SELECT 1 | mysql; do echo Waiting for MySQL... done diff --git a/run.sh b/run.sh index 6ee5a95..c58053b 100755 --- a/run.sh +++ b/run.sh @@ -2,16 +2,20 @@ set -e -x +play_host=172.31.1.9 node_name=ripper4 int_ip=192.168.5.14 ./general.sh +play_host=172.31.1.9 node_name=ripper4 int_ip=192.168.5.14 ./opennebula.sh +play_host=172.31.1.9 node_name=ripper4 int_ip=192.168.5.14 ./ceph.sh + +exit + +play_host=172.31.1.16 node_name=ripper5 int_ip=192.168.5.15 ./general.sh +play_host=172.31.1.16 node_name=ripper5 int_ip=192.168.5.15 ./opennebula.sh +play_host=172.31.1.16 node_name=ripper5 int_ip=192.168.5.15 ./ceph.sh + +exit + play_host=172.31.1.17 node_name=ripper6 int_ip=192.168.5.16 ./general.sh play_host=172.31.1.17 node_name=ripper6 int_ip=192.168.5.16 ./opennebula.sh play_host=172.31.1.17 node_name=ripper6 int_ip=192.168.5.16 ./ceph.sh exit - -play_host=172.31.1.9 node_name=ripper4 int_ip=192.168.5.14 ./general.sh -play_host=172.31.1.9 node_name=ripper4 int_ip=192.168.5.14 ./opennebula.sh -play_host=172.31.1.9 node_name=ripper4 int_ip=192.168.5.14 ./ceph.sh - -play_host=172.31.1.16 node_name=ripper5 int_ip=192.168.5.15 ./general.sh -play_host=172.31.1.16 node_name=ripper5 int_ip=192.168.5.15 ./opennebula.sh -play_host=172.31.1.16 node_name=ripper5 int_ip=192.168.5.15 ./ceph.sh