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

CP-10986: Return read-caching status on VDI.attach. #242

Closed
wants to merge 1 commit into from

Conversation

siddharthv
Copy link
Contributor

Signed-off-by: Siddharth Vinothkumar siddharth.vinothkumar@citrix.com

@@ -1467,6 +1467,7 @@ def attach(self, sr_uuid, vdi_uuid, writable, activate = False):
# Return backend/ link
back_path = self.BackendLink.from_uuid(sr_uuid, vdi_uuid).path()
struct = { 'params': back_path,
'o_direct': util.read_caching_is_restricted(self._session),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a race condition. The blktap driver gets hold of this value here and it's this that's passed to the Tapdisk class: https://github.com/siddharthv/sm/blob/CP-10986/drivers/blktap2.py#L1564-L1565.

In between these two places the licensing could have changed meaning the tapdisk is forked with one option but the return data says the opposite.

@simonjbeaumont
Copy link
Contributor

Also, we need to ensure that all implementations of the SMAPI returns a sensible default for all SRs. I've just grep'd around and see a few other places where this kind of dictionary is created (obviously without o_direct) and returned.

This will break since it will no longer be implementing the full SMAPI: xapi-project/xcp-idl#49.

@siddharthv siddharthv force-pushed the CP-10986 branch 3 times, most recently from bec6417 to ae45494 Compare February 18, 2015 12:42
@siddharthv
Copy link
Contributor Author

@simonjbeaumont Ping!

@franciozzy
Copy link
Contributor

The patch looks good to me. Ship it!

Reviewed-by: Felipe Franciosi felipe.franciosi@citrix.com

Returning the status of read caching during VDI Attach is a bit tricky.
This is because the SM only works out whether or not O_DIRECT should be
used during VDI Activate (which happens after attach). This is determined by a
number of elements: licensing, override parameters or VDI Type, etc.

This patch isolates this check in a separate (private) method and
caches it. Both VDI attach and activate use this method to work out whether
tapdisk will be enabling read caching or not.

We also add this information to the return struct in VDI.attach as
requested by the ticket.

Signed-off-by: Felipe Franciosi <felipe@paradoxo.org>
Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 31.67% when pulling b8fdbf8 on siddharthv:CP-10986 into c1de61a on xapi-project:master.

@siddharthv siddharthv closed this in 86a988b Mar 4, 2015
robertbreker pushed a commit to robertbreker/sm that referenced this pull request Mar 10, 2015
Returning the status of read caching during VDI Attach is a bit tricky.
This is because the SM only works out whether or not O_DIRECT should be
used during VDI Activate (which happens after attach). This is determined by a
number of elements: licensing, override parameters or VDI Type, etc.

This patch isolates this check in a separate (private) method and
caches it. Both VDI attach and activate use this method to work out whether
tapdisk will be enabling read caching or not.

We also add this information to the return struct in VDI.attach as
requested by the ticket.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Acked-by: Felipe Franciosi <felipe@paradoxo.org>

Github: closes xapi-project#242 on xapi-project/sm
andrey-podko pushed a commit to andrey-podko/sm that referenced this pull request Aug 16, 2022
Returning the status of read caching during VDI Attach is a bit tricky.
This is because the SM only works out whether or not O_DIRECT should be
used during VDI Activate (which happens after attach). This is determined by a
number of elements: licensing, override parameters or VDI Type, etc.

This patch isolates this check in a separate (private) method and
caches it. Both VDI attach and activate use this method to work out whether
tapdisk will be enabling read caching or not.

We also add this information to the return struct in VDI.attach as
requested by the ticket.

Acked-by: Felipe Franciosi <felipe@paradoxo.org>

Github: closes xapi-project#242 on xapi-project/sm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants