Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait until guest get IP in setup_dns #20261

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions data/virt_autotest/setup_dns_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,26 @@ if [[ ${vmguest_failed} -ne 0 ]];then
exit 1
fi
#Wait for vm guests get assigned ip addresses
sleep 90s
sleep 60s
echo -e "Virtual machines ${vm_guestnames_array[@]} have already been refreshed\n" | tee -a ${setup_log_file}

#Write vm_hash_forward_ipaddr and vm_hash_reverse_ipaddr arrays
for vmguest in ${vm_guestnames_array[@]};do
get_vm_macaddress=`virsh domiflist --domain ${vmguest} | grep -oE "([0-9|a-z]{2}:){5}[0-9|a-z]{2}"`
vm_macaddresses_array[${vm_hash_index}]=$(echo -e ${get_vm_macaddress})
for i in {1..30} ; do
get_vm_ipaddress=`tac $dhcpd_lease_file | awk '!($0 in S) {print; S[$0]}' | tac | grep -iE "${vm_macaddresses_array[${vm_hash_index}]}" -B8 | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | tail -1`
[[ -n "$vm_ipaddress" ]] && break
sleep 10
done
Copy link
Contributor

@waynechen55 waynechen55 Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that if guest gets ip address from internal dns service, it will not take so long to get a ip address. According to my observation, such guest can be fully up and running within 60 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 tests always failed since sle15sp7:
https://10.145.10.207/tests/15612775#next_previous
https://10.145.10.207/tests/15612782#next_previous
They spent more time in getting an IP with unknown reasons.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long do they need ? Is it this specific to SRIOV scenario (SRIOV attached network interface) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long do they need ?

I reproduced before the long holiday, it took nearly 3 minutes if I recalled correctly... I am not quite certain about the exact time since it has been too long since then.

Is it this specific to SRIOV scenario (SRIOV attached network interface) ?

No, this module is ahead of SRIOV tests. It runs after downloading and restoring a guest disk.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this issue happens frequently, is really significant and does not happen to other machines, I think you can do comparison with/out SRIOV settings ??? Or it only happens to certain machines regardless of SRIOV ???

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW @waynechen55 , how do you suggest to go for this PR now? Merge it and you debug separately to have sooner milestone result, or not merge it and wait for a potential new solution by you?

I think I gave my opinions clearly, but I do not mind doing it again.

I think it worth having a look because test run on a network SR-IOV enabled host. You can still have a deeper look with this pull request in place when there is resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup_dns has been always running on SR-IOV enabled host for a long time ... If you think there is a bug or problem on sle15sp7 in setup_dns, it will be good that you can open a bug. but for sriov passthrough tests to guest, I did not find a bug so far.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think it worth having a look because test run on a network SR-IOV enabled host. You can still have a deeper look with this pull request in place when there is resource. I am happy if you confirm there is no issue at the moment or in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I will only take care of sriov test failure. About setup_dns problems, such as why the guest gets its IP longer than sle15sp6, it is beyond my knowledge and out of my fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. You can intervene test run manually and try boot vm manually on your SR-IOV enabled host to have a deeper look at this issue in the future.

get_vm_ipaddress=`tac $dhcpd_lease_file | awk '!($0 in S) {print; S[$0]}' | tac | grep -iE "${vm_macaddresses_array[${vm_hash_index}]}" -B8 | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | tail -1`
vm_ipaddress=$(echo -e ${get_vm_ipaddress})
#missing ip will make named fail to load domain zones due to malformed zone file
if [ -z "$vm_ipaddress" ]; then
echo -e "Unable to get the ip of $vmguest. Abort the test!\n" | tee -a ${setup_log_file}
date >> ${setup_log_file}
echo -e "cat $dhcpd_lease_file" >> ${setup_log_file}
cat $dhcpd_lease_file >> ${setup_log_file}
exit 1
fi
vm_ipaddress_lastpart=$(echo -e ${vm_ipaddress} | grep -Eo "[0-9]{1,3}$")
Expand Down Expand Up @@ -283,20 +291,10 @@ echo "" | tee -a ${setup_log_file}

#Start named service. Quit if failed.
dns_service_name="named"
get_os_installed_release=`lsb_release -r | grep -oE "[[:digit:]]{2}"`
os_installed_release=$(echo ${get_os_installed_release})
get_os_installed_sp=`cat /etc/os-release | grep "SUSE Linux Enterprise Server" | grep -oE "SP[0-9]{1,}" | grep -oE "[0-9]{1,}"`
os_installed_sp=$(echo ${get_os_installed_sp})
if [[ ${os_installed_release} -gt '11' ]];then
systemctl enable ${dns_service_name}
systemctl restart ${dns_service_name}
dns_service_failed=$(echo $?)
systemctl status ${dns_service_name} | tee -a ${setup_log_file}
else
service ${dns_service_name} restart
dns_service_failed=$(echo $?)
service ${dns_service_name} status | tee -a ${setup_log_file}
fi
systemctl enable ${dns_service_name}
systemctl restart ${dns_service_name}
dns_service_failed=$(echo $?)
systemctl status ${dns_service_name} | tee -a ${setup_log_file}
if [[ ${dns_service_failed} -ne 0 ]];then
echo -e "DNS service did not start up as normal. Please investigate.\n" | tee -a ${setup_log_file}
echo -e "DNS resolver file content:\n" | tee -a ${setup_log_file}
Expand Down Expand Up @@ -341,9 +339,9 @@ done
echo "" | tee -a ${setup_log_file}
echo "# virsh list --all" | tee -a ${setup_log_file}
virsh list --all | tee -a ${setup_log_file}
ehco "" | tee -a ${setup_log_file}
echo "" | tee -a ${setup_log_file}

ehco "" | tee -a ${setup_log_file}
echo "" | tee -a ${setup_log_file}
echo "the new /etc/named.conf after modified: " | tee -a ${setup_log_file}
echo "cat /etc/named.conf" | tee -a ${setup_log_file}
echo "---------" | tee -a ${setup_log_file}
Expand Down Expand Up @@ -403,11 +401,7 @@ else
vmguest_index=0
#Use sshpass to copy public key into vm guest for the first time and store results
for vmguest in ${vm_guestnames_array[@]};do
if [[ ${os_installed_release} -ge '15' ]] || [[ ${os_installed_release} -ge '12' && ${os_installed_sp} -ge '2' ]];then
sshpass -p ${ssh_key_pass} ssh-copy-id -i ${ssh_key_path}/id_rsa.pub -f root@${vmguest}
else
sshpass -p ${ssh_key_pass} ssh-copy-id -i ${ssh_key_path}/id_rsa.pub root@${vmguest}
fi
sshpass -p ${ssh_key_pass} ssh-copy-id -i ${ssh_key_path}/id_rsa.pub -f root@${vmguest}
vmguest_sshcopyid_failed[${vmguest_index}]=`echo $?`
vmguest_index=$((${vmguest_index} + 1))
done
Expand Down
2 changes: 1 addition & 1 deletion products/sle/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ elsif (get_var("VIRT_AUTOTEST")) {
loadtest "virt_autotest/install_package";
loadtest "virt_autotest/update_package";
# Skip reset_partition for s390x due to there just be 42Gib disk space for each s390x LPAR
loadtest "virt_autotest/reset_partition" if (!is_s390x);
loadtest "virt_autotest/reset_partition" if (!is_s390x and get_var('VIRT_PRJ1_GUEST_INSTALL'));
loadtest "virt_autotest/reboot_and_wait_up_normal" if (!get_var('AUTOYAST') && get_var('REPO_0_TO_INSTALL'));
loadtest "virt_autotest/download_guest_assets" if get_var("SKIP_GUEST_INSTALL") && is_x86_64;
}
Expand Down
11 changes: 2 additions & 9 deletions tests/virt_autotest/setup_dns_service.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,8 @@ sub post_fail_hook {
script_run("sed -irn '/^nameserver 192\\.168\\.123\\.1/d' /etc/resolv.conf");
script_run("rm /var/lib/named/testvirt.net.zone; rm /var/lib/named/123.168.192.zone");

my $get_os_installed_release = "lsb_release -r | grep -oE \"[[:digit:]]{2}\"";
my $os_installed_release = script_output($get_os_installed_release, 30, type_command => 0, proceed_on_failure => 0);
if ($os_installed_release gt '11') {
script_run("systemctl stop named.service");
script_run("systemctl disable named.service");
}
else {
script_run("service named stop");
}
script_run("systemctl stop named.service");
script_run("systemctl disable named.service");

my $vm_types = "sles|win";
my $get_vm_hostnames = "virsh list --all | grep -E \"${vm_types}\" | awk \'{print \$2}\'";
Expand Down
Loading