Skip to content

Commit

Permalink
remove the insertion of agent.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
pengshanyu committed Aug 29, 2024
1 parent c6b70a5 commit 20b8a77
Showing 1 changed file with 2 additions and 50 deletions.
52 changes: 2 additions & 50 deletions tests/ffi/agent-flood/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,69 +79,21 @@ get_qm_network_mode(){
echo "${qm_network_mode}"
}

confirm_bluechi_is_active(){
if [ "$(systemctl is-active bluechi-controller)" != "active" ]; then
info_message "enable bluechi services"
info_message "=============================="
systemctl enable bluechi-controller
systemctl enable bluechi-agent
# Start services
info_message "start bluechi services"
info_message "=============================="
systemctl start bluechi-controller
systemctl start bluechi-agent
# Restart qm to read lates bluechi-agent.conf
systemctl restart qm
fi

if [ "$(systemctl is-active bluechi-controller)" == "active" ]; then
info_message "bluechi-controller is active."
else
info_message "bluechi-controller is still not active."
fi

regex_qm_localrootfs="qm.localrootfs * \| online"
regex_host_localrootfs="localrootfs * \| online"
if [[ ! "$(bluechictl status)" =~ ${regex_qm_localrootfs} ]]; then
info_message "QM bluechi-agent not online.\n $(bluechictl status)"
elif [[ ! "$(bluechictl status)" =~ ${regex_host_localrootfs} ]]; then
info_message "host bluechi-agent not online.\n $(bluechictl status)"
else
info_message "QM bluechi-agent is online."
info_message "host bluechi-agent is online."
fi
}

disk_cleanup
prepare_test
reload_config
init_ffi
prepare_images

confirm_bluechi_is_active

# Assign value to ${controller_host_ip} according to qm network mode
if [ "$(get_qm_network_mode)" == "private" ]; then
controller_host_ip=$(hostname -I | awk '{print $1}')
else
echo "qm network mode should be private not: $(get_qm_network_mode)"
info_message "qm network mode should be private, not: $(get_qm_network_mode)"
exit 1
fi

#Stop QM bluechi-agent
exec_cmd "podman exec -it qm /bin/bash -c \
\"systemctl stop bluechi-agent\""

# This is the workaround when ControllerHost is not in /etc/qm/bluechi/agent.conf.d/agent.conf
# Add ControllerHost to this configuration file
qm_bluechi_agent_config_file="/etc/qm/bluechi/agent.conf.d/agent.conf"
if [[ -f "${qm_bluechi_agent_config_file}" ]]; then
if ! grep "ControllerHost=${controller_host_ip}" "${qm_bluechi_agent_config_file}" >/dev/null; then
sed -i '$a \ControllerHost='"${controller_host_ip}"'' ${qm_bluechi_agent_config_file}
fi
else
echo "Configuration file not found: ${qm_bluechi_agent_config_file}"
fi

#Prepare quadlet files for testing containers
setup_test_containers_in_qm
#Run containers through systemd
Expand Down

0 comments on commit 20b8a77

Please sign in to comment.