From f5815d681bfccaac1c6b9c99fd1f69d2817d2e06 Mon Sep 17 00:00:00 2001 From: Harel Braha Date: Wed, 13 Apr 2022 14:15:51 +0300 Subject: [PATCH] he: add storage network for vms To maintain uniformity across all suites using storage VMs, add storage network and NICs. --- common/deploy-scripts/setup_storage.sh | 8 +------- common/deploy-scripts/setup_storage_he_extra.sh | 8 +------- .../init-configs/1_hosted_engine_2_hosts.json | 17 ++++++++++++++--- .../test-scenarios/conftest.py | 5 +++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/common/deploy-scripts/setup_storage.sh b/common/deploy-scripts/setup_storage.sh index 1012257e..2ed25be6 100755 --- a/common/deploy-scripts/setup_storage.sh +++ b/common/deploy-scripts/setup_storage.sh @@ -52,13 +52,7 @@ set_selinux_on_nfs() { } setup_iscsi() { - # this is ugly, assumes that dedicated storage VMs (ost-[suite]-storage) use their primary network as storage network only on HE suite, and VMs with co-located engine have a dedicated storage network on eth1 (like basic-suite-master). - echo $SUITE - if [[ $(hostname) == *"-storage"* ]] && [[ $(hostname) == *"he-"* ]]; then - NIC=eth0 - else - NIC=eth1 - fi + NIC=eth1 IP=$(/sbin/ip -o addr show dev $NIC scope global | tac | awk '{split($4,a,"."); print a[1] "." a[2] "." a[3] "." a[4]}'| awk -F/ '{print $1; exit}') pvcreate --zero n /dev/${ISCSI_DEV} diff --git a/common/deploy-scripts/setup_storage_he_extra.sh b/common/deploy-scripts/setup_storage_he_extra.sh index b342da10..bfac3492 100644 --- a/common/deploy-scripts/setup_storage_he_extra.sh +++ b/common/deploy-scripts/setup_storage_he_extra.sh @@ -34,13 +34,7 @@ setup_he_lun() { # The rest of this function is copied from setup_storage.sh. Keep in sync. # TODO: Unite or rewrite some day - - # this is ugly, assumes that dedicated storage VMs (ost-[suite]-storage) use their primary network as storage network, and VMs with co-located engine have a dedicated storage network on eth1 (like basic-suite-master). - if [[ $(hostname) == *"-storage"* ]]; then - NIC=eth0 - else - NIC=eth1 - fi + NIC=eth1 IP=$(/sbin/ip -o addr show dev $NIC scope global | tac | awk '{split($4,a,"."); print a[1] "." a[2] "." a[3] "." a[4]}'| awk -F/ '{print $1; exit}') iscsiadm -m discovery -t sendtargets -p $IP diff --git a/common/init-configs/1_hosted_engine_2_hosts.json b/common/init-configs/1_hosted_engine_2_hosts.json index 1ec8b955..768055a3 100644 --- a/common/init-configs/1_hosted_engine_2_hosts.json +++ b/common/init-configs/1_hosted_engine_2_hosts.json @@ -8,6 +8,14 @@ "host-0", "host-1" ] + }, + "storage": { + "template": "common/libvirt-templates/net_template", + "nics": [ + "host-0-storage", + "host-1-storage", + "storage-storage" + ] } }, "vms" : { @@ -19,7 +27,8 @@ "common/deploy-scripts/setup_storage_he_extra.sh" ], "nics": { - "storage": { "template": "common/libvirt-templates/nic_template" } + "storage": { "template": "common/libvirt-templates/nic_template" }, + "storage-storage": { "template": "common/libvirt-templates/nic_template" } }, "root_disk_var": "OST_IMAGES_BASE", "disks": { @@ -47,7 +56,8 @@ "common/deploy-scripts/setup_host.sh" ], "nics": { - "host-0": { "template": "common/libvirt-templates/nic_template" } + "host-0": { "template": "common/libvirt-templates/nic_template" }, + "host-0-storage": { "template": "common/libvirt-templates/nic_template" } }, "root_disk_var": "OST_IMAGES_HE_INSTALLED", "disks": {} @@ -59,7 +69,8 @@ "common/deploy-scripts/setup_host.sh" ], "nics": { - "host-1": { "template": "common/libvirt-templates/nic_template" } + "host-1": { "template": "common/libvirt-templates/nic_template" }, + "host-1-storage": { "template": "common/libvirt-templates/nic_template" } }, "root_disk_var": "OST_IMAGES_NODE", "disks": {} diff --git a/he-basic-suite-master/test-scenarios/conftest.py b/he-basic-suite-master/test-scenarios/conftest.py index 1933101e..65c7475d 100644 --- a/he-basic-suite-master/test-scenarios/conftest.py +++ b/he-basic-suite-master/test-scenarios/conftest.py @@ -37,9 +37,10 @@ @pytest.fixture(scope="session") def sd_iscsi_host_ip( - storage_management_ips, + storage_ips_for_network, + storage_network_name, ): # pylint: disable=function-redefined - return storage_management_ips[0] + return storage_ips_for_network(storage_network_name)[0] @pytest.fixture(scope="session")