Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qa/cephadm: add check that iscsi daemon /etc/hosts matches host /etc/…
…hosts To make sure we aren't being affected by any podman introduced changes to the /etc/hosts file and test that we're properly mounting /etc/hosts in our daemon containers Signed-off-by: Adam King <adking@redhat.com>
- Loading branch information
Showing
5 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ tasks: | |
clients: | ||
client.0: | ||
- cephadm/test_iscsi_pids_limit.sh | ||
- cephadm/test_iscsi_etc_hosts.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# checks if the container and host's /etc/hosts files match | ||
# Necessary to avoid potential bugs caused by podman making | ||
# edits to /etc/hosts file in the container | ||
# exits with code 1 if host and iscsi container /etc/hosts do no match | ||
|
||
set -ex | ||
|
||
ISCSI_DAEMON=$(sudo /home/ubuntu/cephtest/cephadm ls | jq -r '.[] | select(.service_name == "iscsi.foo") | .name') | ||
sudo /home/ubuntu/cephtest/cephadm enter --name $ISCSI_DAEMON -- cat /etc/hosts > iscsi_daemon_etc_hosts.txt | ||
if cmp --silent /etc/hosts iscsi_daemon_etc_hosts.txt; then | ||
echo "Daemon and host /etc/hosts files successfully matched" | ||
else | ||
echo "ERROR: /etc/hosts on host did not match /etc/hosts in the iscsi container!" | ||
echo "Host /etc/hosts:" | ||
cat /etc/hosts | ||
echo "Iscsi container /etc/hosts:" | ||
cat iscsi_daemon_etc_hosts.txt | ||
exit 1 | ||
fi |