Skip to content

Commit

Permalink
he: add storage network for vms
Browse files Browse the repository at this point in the history
To maintain uniformity across all suites using storage VMs, add storage network and NICs.
  • Loading branch information
hbraha authored and tinez committed May 25, 2022
1 parent 092cad7 commit f5815d6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
8 changes: 1 addition & 7 deletions common/deploy-scripts/setup_storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 1 addition & 7 deletions common/deploy-scripts/setup_storage_he_extra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions common/init-configs/1_hosted_engine_2_hosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {}
Expand All @@ -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": {}
Expand Down
5 changes: 3 additions & 2 deletions he-basic-suite-master/test-scenarios/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f5815d6

Please sign in to comment.