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

CA-398958 Cope with concurrent read-only activations #707

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

rdn32
Copy link
Contributor

@rdn32 rdn32 commented Sep 5, 2024

It should be possible to activate a VDI on two different hosts in a pool simultaneously, provided read-only access is all that it required. So, if one host tries to activate in a brief window when another host has put the transient "activating" key on the VDI, it should be allowed to retry.

@rdn32
Copy link
Contributor Author

rdn32 commented Sep 5, 2024

This is currently only a draft as I haven't yet worked out how to reproduce the problem, let alone test that the fix works.

Copy link
Contributor

@MarkSymsCtx MarkSymsCtx left a comment

Choose a reason for hiding this comment

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

You might need a unit test to cover the new cases to get this through SonarQube. The existing lines are covered.

@rdn32
Copy link
Contributor Author

rdn32 commented Sep 5, 2024

I've now tested this, probably in an overly complex manner. Using a pool of two hosts and an lvmoiscsi SR:

  • Created a VDI, and populated it using with-vdi
  • On each host, created a VBD in the manner that with-vdi would, namely using CONTROL_DOMAIN_UUID as the vm-uuid.
  • On the first host, modified /opt/xensource/sm/blktap2.py so that there's a 10 second sleep in VDI._add_tag just after the "activating" key has been set.
  • Plug each VBD in from its associated host - first first host swiftly followed by the second host.

Without the fix in place on the second host, plugging in it's VBD fails with this in the log: ***** BLKTAP2:<function VDI._activate_locked at 0x7f545ab3c620>: EXCEPTION <class 'XenAPI.Failure'>, ['MAP_DUPLICATE_KEY', 'VDI', 'sm_config', 'OpaqueRef:ebde1b9c-f6d7-c2de-f430-ae14185553ec', 'activating'].

With the fix in place on the second host, plugging in its VBD succeeds (although taking about 10 seconds to complete, as you might expect) and its associated device can be read and shows the expected content.

It should be possible to activate a VDI on two different hosts in a
pool simultaneously, provided read-only access is all that it required.
So, if one host tries to activate in a brief window when another host
has put the transient "activating" key on the VDI, it should be allowed
to retry.

Signed-off-by: Robin Newton <[email protected]>
@rdn32 rdn32 marked this pull request as ready for review September 5, 2024 16:53
@rdn32 rdn32 merged commit 130615c into xapi-project:master Sep 6, 2024
2 checks passed
@rdn32 rdn32 deleted the private/rnewton/CA-398958 branch September 6, 2024 10:57
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.

3 participants