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

WIP test_host_evacuate: check for IP in xenstore first #182

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

Conversation

ydirson
Copy link
Contributor

@ydirson ydirson commented Dec 8, 2023

This can show when after migration an IP address has been published to Xenstore, but XAPI misses it nevertheless.

@ydirson ydirson marked this pull request as draft December 8, 2023 16:31
@@ -34,6 +34,7 @@ def _host_evacuate_test(source_host, dest_host, network_uuid, vm, expect_error=F
source_host.xe('host-evacuate', args)
wait_for(lambda: vm.all_vdis_on_host(dest_host), "Wait for all VDIs on destination host")
wait_for(lambda: vm.is_running_on_host(dest_host), "Wait for VM to be running on destination host")
vm.host = dest_host
Copy link
Contributor

Choose a reason for hiding this comment

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

it is not related to wait for xenstore VM IP right? It looks like a bug fix when evacuation is done on the destination host currently self.host is not updated no? If it is the case I think that it is a fix that should be done in its own PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is indeed required so the upcoming check for VM IP runs xenstore commands on the destination host, although it is a workaround that can likely be used for other things. Could be moved in a separate commit for more clarity.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok I see 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps a vm.resident_on would be better.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed with @benjamreis here: as I said earlier, vm.host really should be vm.pool and will probably be in the future. It is not where the VM is running, it's the pool master of the pool to which the VM belongs, and is badly named.

You need to use the VM.get_residence_host method in VM.try_get_ip_xenstore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so we're indeed evacuating the host into another pool?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed with @benjamreis here: as I said earlier, vm.host really should be vm.pool and will probably be in the future. It is not where the VM is running, it's the pool master of the pool to which the VM belongs, and is badly named.

And in the test we are sure that we migrate a VM from a slave to the master (or another slave) during the evacuate? Because if the evacuation is done from the master than we need to update vm.host in this case. Or we are sure that it cannot happens.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wait, in fact no because evacuate from master doesn't mean that we need to change the master... maybe.

Copy link
Member

@stormi stormi Dec 13, 2023

Choose a reason for hiding this comment

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

What I mean is VM.host is not where the VM is currently executed. There is no guarantee about this, and it usually just is the master host, regardless of where the VM is (note also that the concept of residence for a VM on a host doesn't mean anything for a VM which is turned off and is on a shared SR. When you start it from XAPI, any host of the pool can become temporarily where it resides). And thus we shouldn't change the value in the test, and should use VM.get_residence_host in order to find which host's xenstore we need to check.

so we're indeed evacuating the host into another pool?

No, host evacuate is intra-pool and doesn't involve storage migration (that's why the VM disks being stored on a shared SR is a prerequisite).

lib/vm.py Show resolved Hide resolved
Copy link
Member

@stormi stormi left a comment

Choose a reason for hiding this comment

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

Marking "changes requested".

lib/vm.py Outdated
if result.returncode != 0 or result.stdout.startswith('169.254.'):
return False
else:
logging.info("Xenstore VM IP: %s" % result.stdout)
Copy link
Member

@stormi stormi Dec 18, 2023

Choose a reason for hiding this comment

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

stdout must be stripped, because it ends with a newline character.

This can show when after migration an IP address has been published to
Xenstore, but XAPI misses it nevertheless.
@stormi
Copy link
Member

stormi commented Jan 22, 2024

I see there were pushes on this PR. Do you want a re-review?

@ydirson ydirson requested a review from stormi January 22, 2024 16:47
Copy link
Member

@stormi stormi left a comment

Choose a reason for hiding this comment

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

It looks useful, but I think we'll need to take IPv6 into account now, before merging.
A VM could be IPv6-only.

@benjamreis
Copy link
Contributor

It looks useful, but I think we'll need to take IPv6 into account now, before merging. A VM could be IPv6-only.

IPv6 can be found in xenstore under 0/ipv6/, 1/ipv6/... and shouldn't start with fe80: as they're link local addresses that are not reachable from the host.

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