-
Notifications
You must be signed in to change notification settings - Fork 92
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
Conversation
@@ -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), |
There was a problem hiding this comment.
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.
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 This will break since it will no longer be implementing the full SMAPI: xapi-project/xcp-idl#49. |
bec6417
to
ae45494
Compare
@simonjbeaumont Ping! |
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>
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
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
Signed-off-by: Siddharth Vinothkumar siddharth.vinothkumar@citrix.com