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

Obtaining the ip address of the guest and update address cache #4002

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TasmiyaNalatwad
Copy link
Contributor

Few of the times it is seen that the ip address is not being fetch and the avocado runs were failed with error "ERROR: Failures occurred while postprocess:\n\n: Guest virt-tests-vm1 dmesg verification failed: Login timeout expired (output: 'exceeded 240 s timeout, last failure: No ipv4 DHCP lease for MAC aa:bb:cc:dd:ee:ff') "

To handle this error the patch has been sent. The patch helps in obtaining ip address of the guest using "virsh-net-dhcp-leases default" command. If the guest mac address is found in the command output, the mac ipv4 address is obatined and updated in the address.cache

Few of the times it is seen that the ip address is not being fetch and the avocado runs were failed with error "ERROR: Failures occurred while postprocess:\n\n: Guest virt-tests-vm1 dmesg verification failed: Login timeout expired (output: 'exceeded 240 s timeout, last failure: No ipv4 DHCP lease for MAC aa:bb:cc:dd:ee:ff') "

To handle this error the patch has been sent. The patch helps in obtaining ip address of the guest using "virsh-net-dhcp-leases default" command. If the guest mac address is found in the command output, the mac ipv4 address is obatined and updated in the address.cache

Signed-off-by: Tasmiya Nalatwad <[email protected]>
@TasmiyaNalatwad
Copy link
Contributor Author

@luckyh @lmr @yanglei-rh Requesting to please review this PR and let me know the valuable inputs.

Thank you!

@luckyh
Copy link
Contributor

luckyh commented Sep 19, 2024

Requesting to please review this PR and let me know the valuable inputs.

Forwarding this to the maintainers who have better experience on libvirt use cases than me.

@dzhengfy @chunfuwen @chloerh @Yingshun would you mind to help review this PR? thanks in advance!

@yanglei-rh
Copy link
Contributor

Hi @TasmiyaNalatwad Thanks for help sync this MR first, I am not a libvirt tester, so @luckyh mentioned user are more suitable candidate.

@chloerh
Copy link
Contributor

chloerh commented Sep 26, 2024

I'll run some tests with this pr.

@TasmiyaNalatwad
Copy link
Contributor Author

Hi @chloerh Would like to know if you've had a chance to run the tests for the patch. Please let me know if there's any feedback or input you can share. Will work on it.

Thanks!

:return: return ip-address if found for given mac in the
virsh-net-dhcp-leases default table, else return None
"""
output = virsh.net_dhcp_leases("default")
Copy link
Contributor

Choose a reason for hiding this comment

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

This function will get dhcp lease from network "default" only, which might not be the default setting for test vms, right?

return super()._get_address(index, ip_version, session, timeout)
except virt_vm.VMIPAddressMissingError:
mac = self.get_mac_address(index).lower()
ipaddr = utils_net.obtain_guest_ip_from_dhcp_leases(mac)
Copy link
Contributor

Choose a reason for hiding this comment

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

I have another concern: we have this scenario:
modifying interface type from network to bridge, but keep the mac address. Seems the dhcp-lease will not be deleted for a while, but the ip address of interface must change. There's a chance we're getting the 'old' ip address, right?

@chloerh
Copy link
Contributor

chloerh commented Oct 15, 2024

Hi @chloerh Would like to know if you've had a chance to run the tests for the patch. Please let me know if there's any feedback or input you can share. Will work on it.

Thanks!

Hi @TasmiyaNalatwad I have finished the run, but met some error which I'm not sure was brought by this patch. I have left 2 comments, Please check. Thanks.

@TasmiyaNalatwad
Copy link
Contributor Author

Thanks @chloerh Will look into the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants