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>
(cherry picked from commit
5493e2d3300c115795987d6f63134af2437e83fc)
Conflicts:
qa/suites/orch/cephadm/dashboard/0-distro/centos_8.stream_container_tools.yaml
qa/suites/orch/cephadm/thrash-old-clients/0-size-min-size-overrides/.qa
qa/suites/orch/cephadm/workunits/task/test_iscsi_container/.qa
qa/suites/orch/cephadm/workunits/task/test_iscsi_container/centos_8.stream_container_tools.yaml
qa/suites/orch/cephadm/workunits/task/test_iscsi_container/test_iscsi_container.yaml
qa/suites/orch/cephadm/workunits/task/test_iscsi_pids_limit.yaml
qa/suites/orch/cephadm/workunits/task/test_iscsi_pids_limit/.qa
qa/suites/orch/cephadm/workunits/task/test_iscsi_pids_limit/centos_8.stream_container_tools.yaml
qa/suites/orch/cephadm/workunits/task/test_iscsi_pids_limit/test_iscsi_pids_limit.yaml
(due to test_iscsi_pids_limit not backported)
--- /dev/null
+../.qa/
\ No newline at end of file
--- /dev/null
+../.qa/
\ No newline at end of file
--- /dev/null
+.qa/distros/podman/centos_8.stream_container_tools.yaml
\ No newline at end of file
--- /dev/null
+roles:
+- - host.a
+ - osd.0
+ - osd.1
+ - osd.2
+ - mon.a
+ - mgr.a
+ - client.0
+tasks:
+- install:
+- cephadm:
+- cephadm.shell:
+ host.a:
+ - ceph osd pool create foo
+ - rbd pool init foo
+ - ceph orch apply iscsi foo u p
+- workunit:
+ clients:
+ client.0:
+ - cephadm/test_iscsi_pids_limit.sh
+ - cephadm/test_iscsi_etc_hosts.sh
+++ /dev/null
-roles:
-- - host.a
- - osd.0
- - osd.1
- - osd.2
- - mon.a
- - mgr.a
- - client.0
-tasks:
-- install:
-- cephadm:
-- cephadm.shell:
- host.a:
- - ceph osd pool create foo
- - rbd pool init foo
- - ceph orch apply iscsi foo u p
-- workunit:
- clients:
- client.0:
- - cephadm/test_iscsi_pids_limit.sh
--- /dev/null
+#!/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